• I have also modified your bash example a bit, it runs on raspberry pi and uses the 0x2a0c "Exact Time 256"

    1. advpad="00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
    2. ble_advertise_datetime(){
    3. values="$(( $1&255 )) $(( $2/256 )) $3 $4 $5 $6 $7 $8 $(( $9/4000000 ))"
    4. sudo hcitool -i hci0 cmd 0x08 0x0008 10 02 01 06 0c 16 0c 2a $(printf '%02X %02X %02X %02X %02X %02X %02X %02X %02X' $values) $advpad
    5. }
    6. sudo hciconfig hci0 leadv 3
    7. i=60
    8. while [ $i -gt 0 ] ; do
    9. echo $i
    10. ble_advertise_datetime $(date "+%-Y %-Y %-m %-d %-H %-M %-S %-u %-N")
    11. sleep 0.5
    12. i=$((i-1))
    13. done
    14. sudo hciconfig hci0 noleadv
  • That's certainly simpler than cross-compiling my Rust code to Raspberry Pi. (I just got that working and I'm now reading on systemd services to make this a service. I can provide executable for latest Raspberry Pi OS if anyone wants to test this.)

About

Avatar for fanoush @fanoush started