HW layer for the Nucleo board, it only work with old BLE_API

Dependents:   Hello_BLE F446RE-BLE

Fork of X_NUCLEO_IDB0XA1 by ST

Revision:
58:027c65a54097
Parent:
18:6d5f4c638f6a
Child:
60:b0b2d639c0f5
--- a/utils/inc/Payload.h	Wed Oct 01 11:47:54 2014 +0000
+++ b/utils/inc/Payload.h	Tue Oct 07 10:13:02 2014 +0000
@@ -1,19 +1,19 @@
 /* mbed Microcontroller Library
- * Copyright (c) 2006-2013 ARM Limited
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- 
+* Copyright (c) 2006-2013 ARM Limited
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
 #include "mbed.h"
 
 #ifndef __PAYLOAD_H__
@@ -21,14 +21,14 @@
 
 class UnitPayload
 {
-    public:
+public:
     uint8_t length;
     uint8_t id;    
     uint8_t *data;
     uint8_t *idptr;    
 
     
-       
+    
     void set_length(uint8_t l) {
         length=l;   
     }
@@ -64,10 +64,10 @@
     int payloadUnitCount;
     
 public:
-     Payload(const uint8_t *tokenString, uint8_t string_ength);
-     Payload::Payload();
-     uint8_t Payload::getPayloadUnitCount();
-      
+    Payload(const uint8_t *tokenString, uint8_t string_ength);
+    Payload::Payload();
+    uint8_t Payload::getPayloadUnitCount();
+    
     uint8_t Payload::getIDAtIndex(int index);  
     uint8_t Payload::getLengthAtIndex(int index);   
     uint8_t* Payload::getDataAtIndex(int index);    
@@ -78,68 +78,68 @@
 
 
 class PayloadUnit {
-   private:        
-        uint8_t* lenPtr;
-        uint8_t* adTypePtr;
-        uint8_t* dataPtr;
-        
-    public:
-        PayloadUnit() {
-            lenPtr = NULL;
-            adTypePtr = NULL;
-            dataPtr = NULL;
-            }
-            
-        PayloadUnit(uint8_t *len, uint8_t *adType, uint8_t* data) {
-            lenPtr = len;
-            adTypePtr = adType;
-            dataPtr = data;
-            }    
-             
-        void setLenPtr(uint8_t *len)   {
-            lenPtr = len;
-            } 
-            
-        void setAdTypePtr(uint8_t *adType)   {
-            adTypePtr = adType;
-            }  
-            
-        void setDataPtr(uint8_t *data)   {
-            dataPtr = data;
-            }      
-            
-        uint8_t* getLenPtr()   {
-            return lenPtr;
-            } 
-            
-        uint8_t* getAdTypePtr()   {
-            return adTypePtr;
-            }  
-            
-        uint8_t* getDataPtr()   {
-            return dataPtr;
-            }   
-            
-        void printDataAsHex()   {
-            int i = 0;
-            printf("AdData=");
-            for(i=0; i<*lenPtr-1; i++) {
-                printf("0x%x ", dataPtr[i]);
-            }
-            printf("\n");
-        }     
-        
-        void printDataAsString()   {
-            int i = 0;
-            printf("AdData=");
-            for(i=0; i<*lenPtr; i++) {
-                printf("%c", dataPtr[i]);
-            }
-            printf("\n");
-        }                                                   
-            
-    };
+private:        
+    uint8_t* lenPtr;
+    uint8_t* adTypePtr;
+    uint8_t* dataPtr;
+    
+public:
+    PayloadUnit() {
+        lenPtr = NULL;
+        adTypePtr = NULL;
+        dataPtr = NULL;
+    }
+    
+    PayloadUnit(uint8_t *len, uint8_t *adType, uint8_t* data) {
+        lenPtr = len;
+        adTypePtr = adType;
+        dataPtr = data;
+    }    
+    
+    void setLenPtr(uint8_t *len)   {
+        lenPtr = len;
+    } 
+    
+    void setAdTypePtr(uint8_t *adType)   {
+        adTypePtr = adType;
+    }  
+    
+    void setDataPtr(uint8_t *data)   {
+        dataPtr = data;
+    }      
     
+    uint8_t* getLenPtr()   {
+        return lenPtr;
+    } 
+    
+    uint8_t* getAdTypePtr()   {
+        return adTypePtr;
+    }  
+    
+    uint8_t* getDataPtr()   {
+        return dataPtr;
+    }   
+    
+    void printDataAsHex()   {
+        int i = 0;
+        printf("AdData=");
+        for(i=0; i<*lenPtr-1; i++) {
+            printf("0x%x ", dataPtr[i]);
+        }
+        printf("\n");
+    }     
+    
+    void printDataAsString()   {
+        int i = 0;
+        printf("AdData=");
+        for(i=0; i<*lenPtr; i++) {
+            printf("%c", dataPtr[i]);
+        }
+        printf("\n");
+    }                                                   
+    
+};
+
 class PayloadPtr {
 private:
     PayloadUnit *unit;
@@ -166,7 +166,7 @@
             unit[i].setLenPtr((uint8_t *)tokenString+nextUnitOffset);
             unit[i].setAdTypePtr((uint8_t *)tokenString+nextUnitOffset+1);
             unit[i].setDataPtr((uint8_t *)tokenString+nextUnitOffset+2);
-           
+            
             nextUnitOffset += *unit[i].getLenPtr()+1;
             i++;
 
@@ -175,10 +175,10 @@
     
     PayloadUnit getUnitAtIndex(int index) {
         return unit[index];
-        }
+    }
     
     int getPayloadUnitCount() { return payloadUnitCount; }
-        
+    
     
 };