Projet_BMC / X_NUCLEO_IDB0XA1

Dependents:   BMC

Files at this revision

API Documentation at this revision

Comitter:
Andrea Palmieri
Date:
Fri Oct 16 15:59:23 2015 +0200
Parent:
141:6859438f74f5
Child:
143:63f5e8a590d4
Commit message:
Get rid of warnings

Signed-off-by: Andrea Palmieri <andrea.palmieri@st.com>

Changed in this revision

source/BlueNRGGap.cpp Show annotated file Show diff for this revision Revisions of this file
source/BlueNRGGattClient.cpp Show annotated file Show diff for this revision Revisions of this file
source/BlueNRGGattServer.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/source/BlueNRGGap.cpp	Fri Oct 09 09:56:12 2015 +0200
+++ b/source/BlueNRGGap.cpp	Fri Oct 16 15:59:23 2015 +0200
@@ -524,6 +524,9 @@
 /**************************************************************************/
 ble_error_t BlueNRGGap::disconnect(Gap::DisconnectionReason_t reason)
 {
+    /* avoid compiler warnings about unused variables */
+    (void)reason;
+
     tBleStatus ret;
     //For Reason codes check BlueTooth HCI Spec
     
@@ -564,6 +567,9 @@
 /**************************************************************************/
 ble_error_t BlueNRGGap::disconnect(Handle_t connectionHandle, Gap::DisconnectionReason_t reason)
 {
+    /* avoid compiler warnings about unused variables */
+    (void)reason;
+
     tBleStatus ret;
     //For Reason codes check BlueTooth HCI Spec
     
@@ -713,6 +719,9 @@
 /**************************************************************************/
 ble_error_t BlueNRGGap::getPreferredConnectionParams(ConnectionParams_t *params) 
 {
+    /* avoid compiler warnings about unused variables */
+    (void)params;
+
     return BLE_ERROR_NONE;
 }
 
@@ -732,6 +741,9 @@
 /**************************************************************************/
 ble_error_t BlueNRGGap::setPreferredConnectionParams(const ConnectionParams_t *params) 
 {
+    /* avoid compiler warnings about unused variables */
+    (void)params;
+
     return BLE_ERROR_NONE;
 }
 
@@ -750,6 +762,10 @@
 /**************************************************************************/
 ble_error_t BlueNRGGap::updateConnectionParams(Handle_t handle, const ConnectionParams_t *params)
 {
+    /* avoid compiler warnings about unused variables */
+    (void) handle;
+    (void)params;
+
     return BLE_ERROR_NONE;
 }
 
@@ -965,6 +981,8 @@
                               uint8_t *data,
                               uint8_t *RSSI)
 {
+  /* avoid compiler warnings about unused variables */
+  (void)addr_type;
 
   switch (reason) {
   case DEVICE_FOUND:
@@ -985,6 +1003,9 @@
         break;
       case ADV_NONCONN_IND:
         type = GapAdvertisingParams::ADV_NON_CONNECTABLE_UNDIRECTED;
+        break;
+      default:
+        type = GapAdvertisingParams::ADV_CONNECTABLE_UNDIRECTED;
       }
     
       PRINTF("adv peerAddr[%02x %02x %02x %02x %02x %02x] \r\n",
@@ -1126,6 +1147,11 @@
                                  const ConnectionParams_t *connectionParams,
                                  const GapScanningParams *scanParams)
 {
+  /* avoid compiler warnings about unused variables */
+  (void)peerAddrType;
+  (void)connectionParams;
+  (void)scanParams;
+
     // Save the peer address
   for(int i=0; i<BDADDR_SIZE; i++) {
     _peerAddr[i] = peerAddr[i];
--- a/source/BlueNRGGattClient.cpp	Fri Oct 09 09:56:12 2015 +0200
+++ b/source/BlueNRGGattClient.cpp	Fri Oct 16 15:59:23 2015 +0200
@@ -82,6 +82,8 @@
   GattAttribute::Handle_t startHandle, endHandle;
   UUID uuid;
   uint8_t i, offset, numAttr;
+  /* avoid compiler warnings about unused variables */
+  (void)connectionHandle;
 
   numAttr = (event_data_length - 1) / attribute_data_length;
 
@@ -135,6 +137,8 @@
   GattAttribute::Handle_t startHandle, endHandle;
   UUID uuid;
   uint8_t i, offset, numHandlePairs;
+  /* avoid compiler warnings about unused variables */
+  (void)connectionHandle;
 
   numHandlePairs = (event_data_length - 1) / 2;
 
@@ -302,9 +306,9 @@
   PRINTF("findServiceChars\n\r");
   
   tBleStatus ret;
-  uint8_t uuid_type;
+  uint8_t uuid_type = UUID_TYPE_16;
   uint8_t short_uuid[2];
-  uint8_t *uuid;
+  uint8_t *uuid = NULL;
   
   DiscoveredService *service;
   
@@ -391,9 +395,9 @@
   PRINTF("launchServiceDiscovery\n\r");
   
   tBleStatus ret;
-  uint8_t uuid_type;
+  uint8_t uuid_type = UUID_TYPE_16;
   uint8_t short_uuid[2];
-  uint8_t *uuid;
+  uint8_t *uuid = NULL;
   unsigned j;
   
   _connectionHandle = connectionHandle;
@@ -465,6 +469,11 @@
                                                 ServiceDiscovery::ServiceCallback_t  callback,
                                                 const UUID                          &matchingServiceUUID)
 {
+  /* avoid compiler warnings about unused variables */
+  (void)connectionHandle;
+  (void)callback;
+  (void)matchingServiceUUID;
+
   return BLE_ERROR_NOT_IMPLEMENTED;
 }
 
@@ -473,6 +482,12 @@
                                                 GattAttribute::Handle_t              startHandle,
                                                 GattAttribute::Handle_t              endHandle)
 {
+  /* avoid compiler warnings about unused variables */
+  (void)connectionHandle;
+  (void)callback;
+  (void)startHandle;
+  (void)endHandle;
+
   return BLE_ERROR_NOT_IMPLEMENTED;
 }
 
@@ -511,6 +526,9 @@
 
 ble_error_t BlueNRGGattClient::read(Gap::Handle_t connHandle, GattAttribute::Handle_t attributeHandle, uint16_t offset) const
 {
+  /* avoid compiler warnings about unused variables */
+  (void)offset;
+
   tBleStatus ret;
   
   BlueNRGGattClient *gattc = const_cast<BlueNRGGattClient*>(this);
@@ -539,6 +557,9 @@
                                            uint16_t offset,
                                            uint8_t *part_attr_value)
 {
+  /* avoid compiler warnings about unused variables */
+  (void)connHandle;
+
   // Update the write response params
   writeCBParams.handle = attribute_handle;
   writeCBParams.offset = offset;
@@ -551,6 +572,9 @@
 void BlueNRGGattClient::charWriteExecCB(Gap::Handle_t connHandle,
                                         uint8_t event_data_length)
 {
+  /* avoid compiler warnings about unused variables */
+  (void)event_data_length;
+
   writeCBParams.connHandle = connHandle;
   
   BlueNRGGattClient::getInstance().processWriteResponse(&writeCBParams);
@@ -562,8 +586,10 @@
                                      size_t                   length,
                                      const uint8_t           *value) const
 {
+  /* avoid compiler warnings about unused variables */
+  (void)cmd;
+
   tBleStatus ret;
-
   
   BlueNRGGattClient *gattc = const_cast<BlueNRGGattClient*>(this);
     
--- a/source/BlueNRGGattServer.cpp	Fri Oct 09 09:56:12 2015 +0200
+++ b/source/BlueNRGGattServer.cpp	Fri Oct 16 15:59:23 2015 +0200
@@ -256,8 +256,14 @@
 /**************************************************************************/
 ble_error_t BlueNRGGattServer::readValue(uint16_t charHandle, uint8_t buffer[], uint16_t *const lengthP)
 {
-    PRINTF("ReadValue() Not Supported\n\r");
-    return BLE_ERROR_NONE;
+  PRINTF("ReadValue() Not Supported\n\r");
+
+  /* avoid compiler warnings about unused variables */
+  (void)charHandle;
+  (void)buffer;
+  (void)lengthP;
+
+  return BLE_ERROR_NONE;
 }
 
 /**************************************************************************/
@@ -287,18 +293,30 @@
 /**************************************************************************/
 // <<<ANDREA>>>
 ble_error_t BlueNRGGattServer::readValue(Gap::Handle_t connectionHandle, GattAttribute::Handle_t attributeHandle, uint8_t buffer[], uint16_t *lengthP) {
-    // Empty by now
-    return BLE_ERROR_NONE;
+
+  /* avoid compiler warnings about unused variables */
+  (void)connectionHandle;
+  (void)attributeHandle;
+  (void)buffer;
+  (void)lengthP;
+
+  return BLE_ERROR_NONE;
 }
 
 ble_error_t BlueNRGGattServer::write(Gap::Handle_t connectionHandle, GattAttribute::Handle_t, const uint8_t[], uint16_t, bool localOnly) {
-    // Empty by now
-    return BLE_ERROR_NONE;
+  /* avoid compiler warnings about unused variables */
+  (void)connectionHandle;
+  (void)localOnly;
+
+  return BLE_ERROR_NONE;
 }
     
 ble_error_t BlueNRGGattServer::write(GattAttribute::Handle_t charHandle, const uint8_t buffer[], uint16_t len, bool localOnly)
 {
-    tBleStatus ret;    
+    /* avoid compiler warnings about unused variables */
+    (void)localOnly;
+
+    tBleStatus ret;
     //uint8_t buff[2];
 
     PRINTF("updating bleCharacteristic charHandle =%u, corresponding serviceHanle= %u len=%d\n\r", charHandle, bleCharHanldeMap.find(charHandle)->second, len);