Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BLE_API mbed nRF51822
Revision 3:65ec992a421d, committed 2015-08-18
- Comitter:
- DDUdui
- Date:
- Tue Aug 18 10:39:03 2015 +0000
- Parent:
- 0:51c847e94a29
- Commit message:
- zz;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Mon Aug 17 09:17:25 2015 +0000
+++ b/main.cpp Tue Aug 18 10:39:03 2015 +0000
@@ -39,6 +39,45 @@
pc.printf("\r\n");
+ for(unsigned i = 0; i < 3; i++) {
+ if(list_addr[i][5] == params->peerAddr[5] && list_addr[i][4] == params->peerAddr[4] && list_addr[i][3] == params->peerAddr[3] && list_addr[i][2] == params->peerAddr[2] && list_addr[i][1] == params->peerAddr[1] && list_addr[i][0] == params->peerAddr[0]) {
+ /* Only RSSI Value update */
+ list_rssi[i] = params->rssi;
+ break;
+ }
+ if(list_addr[i][5] == 0 && list_addr[i][4] == 0 && list_addr[i][3] == 0 && list_addr[i][2] == 0 && list_addr[i][1] == 0 && list_addr[i][0] == 0) {
+ /* Save the address */
+ list_addr[i][5] = params->peerAddr[5];
+ list_addr[i][4] = params->peerAddr[4];
+ list_addr[i][3] = params->peerAddr[3];
+ list_addr[i][2] = params->peerAddr[2];
+ list_addr[i][1] = params->peerAddr[1];
+ list_addr[i][0] = params->peerAddr[0];
+ /* Save RSSI value */
+ list_rssi[i] = params->rssi;
+ if(i==2){
+ /* Find Maximum RSSI value */
+ for(unsigned j=0;j<NUM_LIST;j++) {
+ for(unsigned k=j ; k<NUM_LIST ; k++) {
+ if(list_rssi[j] > list_rssi[j+1]) {
+ /* Swap RSSI Value */
+ temp = list_rssi[j];
+ list_rssi[j] = list_rssi[j+1];
+ list_rssi[j+1] = temp;
+
+ /* Swap the address */
+ for(unsigned l = 0; l < 6 ; l++) {
+ temp = list_addr[j][l];
+ list_addr[j][l] = list_addr[j+1][l];
+ list_addr[j+1][l] = temp;
+ }
+ }
+ }
+ }
+ }
+ break;
+ }
+ }
}
void serviceDiscoveryCallback(const DiscoveredService *service) {