Tool/software: Linux
ADVERTISER side:
try:
# start_le_advertising(sock,
# min_interval=1000, max_interval=1000,
# data = (A , B , C) + (0,) * 28)
# data = (0x45,0x56,0x67);
#
while True:
start_le_advertising(sock,min_interval = 1000 , max_interval = 1000 , data = (A,B,C));
A = A + 1;
sleep(2)
except:
stop_le_advertising(sock)
raise
RECEIVER side:
try:
prev_data = None
def le_advertise_packet_handler(mac, data, rssi):
if mac == '38:D2:69:DD:2F:9B':
#global prev_data
data_str = raw_packet_to_str(data)
#data_wo_rssi = (mac, data_str)
#print("BLE packet: %s %s %d" % (mac, data_str, rssi))
print("first pack : %d",data_str[2:6]);
#if prev_data is not None:
#if data_wo_rssi != prev_data:
# color differences with previous packet data
# sys.stdout.write(' ' * 35 + 'data_diff=')
#for c1, c2 in zip(data_str, prev_data[1]):
#if c1 != c2:
#sys.stdout.write('\033[0;33m' + c1 + '\033[m')
#else:
#sys.stdout.write(c1)
#sys.stdout.write('\n')
#prev_data = data_wo_rssi
# Blocking call (the given handler will be called each time a new LE
# advertisement packet is detected)
parse_le_advertising_events(sock,
handler=le_advertise_packet_handler,
debug=False)
except KeyboardInterrupt:
disable_le_scan(sock)
here whenever I transmit the data with some minor delay my scan n receive code is not receiving the data with the same delay .. I wanna receive the broadcasted data with the same delay my advertising code is advertising with