Open DuRukun opened 6 years ago
For A0000000B 's device, add its label e.g. 2 to the front and get "2 A0000000B" for broadcast For A0000000B 's device, if it scans other devices, need to get their label (e.g. 3) and compare to decide whether to relay or not.
For lecturer side:
add advertise part to help student devices determine their labels.
maybe add a button to enable broadcast before entering "check attendance" (meanwhile ensure the scan is disabled). ensure it is stopped before entering "check attendance" the broadcast should last for some time.
This is in the test part such that we use a button/swtich.
In final stage, since no feedback could be obtained from students, the lecturer shall broadcast throughout the class. Should also scan in between.
Use timer to auto-switch advertise and listen states instead of using the button.
e.g. 3s advertise + 7s listen. (ideally 1+29 is roughly the best combination)
possible structure:
PERIOD = AdvertisingDuration + ListeningDuration; assign psedo-random bias time to each device. Start Attend; timer starts; (how often do we check this? or what should be the sampling rate?) if (timer%PERIOD <= AdvertisingDuration) { switch off scaning set to advertise advertise self's info and then advertise others if needs to relay (how to set priority??) } else { switch off advertise set to scan note down all the catches maybe count the number of occurance by showing them in NameList help relay here
} timer keeps coutning