This software setup a central node of a star topology network

Dependencies:   MQTT target_st_bluenrg

Fork of ble-star-mbed by Lorenzo Invidia

Revision:
3:3f35e80ed848
Parent:
2:1525f4848cf2
Child:
4:4af40af2530e
--- a/source/BleSlaveService.cpp	Mon Feb 26 12:29:03 2018 +0000
+++ b/source/BleSlaveService.cpp	Tue Mar 13 16:31:07 2018 +0000
@@ -586,14 +586,14 @@
                     notifyP->conn_handle  = conn_handle;
                     notifyP->i            = i;
                     notifyP->feature_mask = FEATURE_MASK_ACC;
-                    notifyP->frequency    = notification_freq*SENDING_INTERVAL_100MS_MULTIPLE;
+                    notifyP->frequency    = SENDING_INTERVAL_100MS_MULTIPLE;
                 
                 
                     /* Then, call the Change_Notification_Status from the readCallback with these params */
                 
                 }else if (readCompleted == 1) {
                     //notificationPending = 0;
-                    Change_Notification_Status(att_data, attr_value, conn_handle, i, FEATURE_MASK_ACC, notification_freq*SENDING_INTERVAL_100MS_MULTIPLE);
+                    Change_Notification_Status(att_data, attr_value, conn_handle, i, FEATURE_MASK_ACC, SENDING_INTERVAL_100MS_MULTIPLE);
                 }
                 perDevs.agm_on[i] = attr_value[0];
 
@@ -635,13 +635,13 @@
                         notifyP->conn_handle  = conn_handle;
                         notifyP->i            = i;
                         notifyP->feature_mask = FEATURE_MASK_SENSORFUSION;
-                        notifyP->frequency    = notification_freq*SENDING_INTERVAL_100MS_MULTIPLE;
+                        notifyP->frequency    = SENDING_INTERVAL_100MS_MULTIPLE;
             
                         /* Then, call the Change_Notification_Status from the readCallback with these params */
             
                     }else if (readCompleted == 1) {
                         //notificationPending = 0;
-                        Change_Notification_Status(att_data, attr_value, conn_handle, i, FEATURE_MASK_SENSORFUSION, notification_freq*SENDING_INTERVAL_100MS_MULTIPLE);
+                        Change_Notification_Status(att_data, attr_value, conn_handle, i, FEATURE_MASK_SENSORFUSION, SENDING_INTERVAL_100MS_MULTIPLE);
                     }
                 
                     perDevs.sfusion_on[i] = attr_value[0];
@@ -745,7 +745,6 @@
         }
 
         
-//        if ((discoveryCompleted == 1)){
         
             ble_error_t err;
             
@@ -759,9 +758,6 @@
             }
 
 
-
-
-    
     /* WUP notification enable/disable */
     if(attr_value[0]==0x00){
         for (uint8_t j=0; j<(perDevs.connDevices+perDevs.discDevices); j++) {
@@ -771,8 +767,7 @@
     
                 setNotificationProperty(perDevs.connection_handle[j], j, FEATURE_MASK_WAKEUP_EVENTS, WAKEUP_NOTIFICATION_CMD, 1);
 
-                if (discoveryCompleted == 1){
-                    
+//                if (discoveryCompleted == 1){                  
                     writeDescriptorCompleted=0;
                     ble_error_t wupErrOn = writeCharacDescriptorWithError(perDevs.connection_handle[j], attr_handle, value_len, attr_value);
 
@@ -783,11 +778,11 @@
                     
                     } else {
                         printf("\r\nWrite WUP char descriptor failed! (%d)\n", wupErrOn);
-
+                        writeDescriptorCompleted=1;
                     }//if-else
-                    writeDescriptorCompleted=1;
+                    
                                            
-                }//if-else-discovery-completed
+//                }//if-else-discovery-completed
             }//if
         }//for
 
@@ -804,8 +799,7 @@
                 attr_value[0] = 0x00;
 
 
-                if (discoveryCompleted == 1){
-                    
+//                if (discoveryCompleted == 1){               
                     writeDescriptorCompleted=0;
                     ble_error_t wupErrOff = writeCharacDescriptorWithError(perDevs.connection_handle[j], attr_handle, value_len, attr_value);
 
@@ -816,11 +810,11 @@
 
                     } else {         
                         printf("\r\nWrite WUP char descriptor failed! (%d)\n", wupErrOff);
-
+                        writeDescriptorCompleted=1;
                     }
-                    writeDescriptorCompleted=1;
+
                     
-                }//if-discovery-completed
+//                }//if-discovery-completed
             }//if
         }//for