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

    advpad="00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"
    
    ble_advertise_datetime(){
      values="$(( $1&255 )) $(( $2/256 )) $3 $4 $5 $6 $7 $8 $(( $9/4000000 ))"
      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
    }
    
    sudo hciconfig hci0 leadv 3
    i=60
    while [ $i -gt 0 ]  ; do
      echo $i
      ble_advertise_datetime  $(date "+%-Y %-Y %-m %-d %-H %-M %-S %-u %-N")
      sleep 0.5
      i=$((i-1))
    done
    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