1 diff -rupN RBL_nRF8001_old/RBL_nRF8001.cpp RBL_nRF8001/RBL_nRF8001.cpp
2 --- RBL_nRF8001_old/RBL_nRF8001.cpp 2015-01-13 12:25:32.000000000 +0530
3 +++ RBL_nRF8001/RBL_nRF8001.cpp 2015-01-13 12:40:41.740244741 +0530
4 @@ -22,7 +22,7 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOU
7 /* Store the setup for the nRF8001 in the flash of the AVR to save on RAM */
8 -static hal_aci_data_t setup_msgs[NB_SETUP_MESSAGES] PROGMEM = SETUP_MESSAGES_CONTENT;
9 +static const hal_aci_data_t setup_msgs[NB_SETUP_MESSAGES] PROGMEM = SETUP_MESSAGES_CONTENT;
11 #if defined(BLEND_MICRO)
12 static char device_name[11] = "BlendMicro";
13 @@ -31,7 +31,10 @@ static char device_name[11] = "Blend
15 static char device_name[11] = "BLE Shield";
19 +#define BLE_ADDRESS_SIZE 18
20 +static unsigned char *gLeAddress = NULL;
22 static uint16_t Adv_Timeout = 0; // Advertising all the time
23 static uint16_t Adv_Interval = 0x0050; /* advertising interval 50ms
25 @@ -117,7 +120,7 @@ void ble_begin()
26 aci_state.aci_setup_info.services_pipe_type_mapping = NULL;
28 aci_state.aci_setup_info.number_of_pipes = NUMBER_OF_PIPES;
29 - aci_state.aci_setup_info.setup_msgs = setup_msgs;
30 + aci_state.aci_setup_info.setup_msgs = (hal_aci_data_t*)setup_msgs;
31 aci_state.aci_setup_info.num_setup_msgs = NB_SETUP_MESSAGES;
34 @@ -159,7 +162,7 @@ void ble_begin()
35 static volatile byte ack = 0;
37 void ble_write(unsigned char data)
40 if(tx_buffer_len == MAX_TX_BUFF)
43 @@ -199,13 +202,13 @@ unsigned char ble_connected()
46 void ble_set_name(char *name)
55 - Serial.print("the new name is too long");
56 + Serial.print("the new name is too long");
60 @@ -236,6 +239,10 @@ void ble_reset(uint8_t reset_pin)
61 void ble_disconnect(void)
63 lib_aci_disconnect(&aci_state, ACI_REASON_TERMINATE);
64 + if (NULL != gLeAddress)
70 static void process_events()
71 @@ -271,6 +278,7 @@ static void process_events()
72 lib_aci_set_local_data(&aci_state, PIPE_GAP_DEVICE_NAME_SET , (uint8_t *)&device_name , strlen(device_name));
73 lib_aci_connect(Adv_Timeout/* in seconds */, Adv_Interval /* advertising interval 50ms*/);
74 Serial.println(F("Advertising started"));
75 + lib_aci_get_address();
79 @@ -294,6 +302,32 @@ static void process_events()
80 lib_aci_set_local_data(&aci_state, PIPE_DEVICE_INFORMATION_HARDWARE_REVISION_STRING_SET,
81 (uint8_t *)&(aci_evt->params.cmd_rsp.params.get_device_version), sizeof(aci_evt_cmd_rsp_params_get_device_version_t));
84 + if (ACI_CMD_GET_DEVICE_ADDRESS == aci_evt->params.cmd_rsp.cmd_opcode)
86 + if (NULL != gLeAddress)
90 + gLeAddress = (unsigned char *) malloc (BLE_ADDRESS_SIZE);
91 + if (NULL == gLeAddress)
93 + Serial.println("error");
96 + char *tempAddr = (char *) gLeAddress;
98 + for (iter = BTLE_DEVICE_ADDRESS_SIZE - 1; iter >= 0; iter--)
100 + sprintf(tempAddr, "%02x%c",
101 + (uint8_t)aci_evt->params.cmd_rsp.params.get_device_address.bd_addr_own[iter], 58);
104 + gLeAddress[BLE_ADDRESS_SIZE - 1] = '\0';
105 + Serial.println("LEAddress :");
106 + Serial.println((char *)gLeAddress);
111 case ACI_EVT_CONNECTED:
112 @@ -471,3 +505,12 @@ void ble_do_events()
116 +unsigned char* ble_getAddress()
121 +void ble_radio_reset()
123 + lib_aci_radio_reset();
125 diff -rupN RBL_nRF8001_old/RBL_nRF8001.h RBL_nRF8001/RBL_nRF8001.h
126 --- RBL_nRF8001_old/RBL_nRF8001.h 2015-01-13 12:25:32.000000000 +0530
127 +++ RBL_nRF8001/RBL_nRF8001.h 2015-01-13 12:40:41.740244741 +0530
128 @@ -48,6 +48,8 @@ void ble_set_pins(uint8_t reqn, uint8_t
129 unsigned char ble_busy();
130 void ble_reset(uint8_t reset_pin);
131 void ble_disconnect(void);
132 +unsigned char* ble_getAddress();
133 +void ble_radio_reset();
137 diff -rupN RBL_nRF8001_old/RBL_nRF8001.xml RBL_nRF8001/RBL_nRF8001.xml
138 --- RBL_nRF8001_old/RBL_nRF8001.xml 2015-01-14 01:52:26.000000000 +0530
139 +++ RBL_nRF8001/RBL_nRF8001.xml 2015-07-21 14:27:18.000000000 +0530
141 <Device>nRF8001_Dx</Device>
142 <Service Type="local" PrimaryService="true">
143 <Name>UART over BTLE</Name>
144 - <Uuid BaseUUID="713D0000503E4C75BA943148F18D941E" BaseUUIDName="Custom UART">0000</Uuid>
145 + <Uuid BaseUUID="ADE30000C7844F63A987EB69F70EE816" BaseUUIDName="Custom UART">D529</Uuid>
148 - <Uuid BaseUUID="713D0000503E4C75BA943148F18D941E" BaseUUIDName="Custom UART">0003</Uuid>
149 + <Uuid BaseUUID="AD7B000046374B8690B69D787F03D218" BaseUUIDName="Custom UART2">334f</Uuid>
150 <DefaultValue></DefaultValue>
151 <UsePresentationFormat>0</UsePresentationFormat>
152 <MaxDataLength>20</MaxDataLength>
157 - <Uuid BaseUUID="713D0000503E4C75BA943148F18D941E" BaseUUIDName="Custom UART">0002</Uuid>
158 + <Uuid BaseUUID="E9240000458042C4883195048216B256" BaseUUIDName="Custom UART3">1982</Uuid>
159 <DefaultValue></DefaultValue>
160 <UsePresentationFormat>0</UsePresentationFormat>
161 <MaxDataLength>20</MaxDataLength>
163 <AddServiceUpdateCharacteristicPipe>true</AddServiceUpdateCharacteristicPipe>
164 <TimingChangeDelay>5</TimingChangeDelay>
166 - <Uuid BaseUUID="713D0000503E4C75BA943148F18D941E" BaseUUIDName="Custom UART">0000</Uuid>
167 + <Uuid BaseUUID="ADE30000C7844F63A987EB69F70EE816" BaseUUIDName="Custom UART">D529</Uuid>
168 </ServiceToAdvertise>
171 diff -rupN RBL_nRF8001_old/RBL_services.h RBL_nRF8001/RBL_services.h
172 --- RBL_nRF8001_old/RBL_services.h 2015-01-14 01:52:26.000000000 +0530
173 +++ RBL_nRF8001/RBL_services.h 2015-07-17 15:22:22.000000000 +0530
175 #define GAP_PPCP_SLAVE_LATENCY 0
176 #define GAP_PPCP_CONN_TIMEOUT 0xa /** Connection Supervision timeout multiplier as a multiple of 10msec, 0xFFFF means no specific value requested */
178 -#define NB_SETUP_MESSAGES 23
179 +#define NB_SETUP_MESSAGES 24
180 #define SETUP_MESSAGES_CONTENT {\
186 0x1f,0x06,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,0x00,0x05,0x01,0x01,0x00,0x00,0x06,0x00,0x00,\
187 - 0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
188 + 0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xd5,\
193 - 0x1f,0x06,0x10,0x1c,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
194 - 0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x03,0x90,0x01,0xff,\
195 + 0x1f,0x06,0x10,0x1c,0x29,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
196 + 0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10,0x03,0x90,0x03,0xff,\
200 @@ -112,30 +112,30 @@
203 0x1f,0x06,0x20,0x8c,0x03,0x02,0x00,0x0b,0x29,0x02,0x01,0x00,0x00,0x04,0x04,0x10,0x10,0x00,0x0c,0x28,\
204 - 0x00,0x01,0x1e,0x94,0x8d,0xf1,0x48,0x31,0x94,0xba,0x75,0x4c,\
205 + 0x00,0x01,0x16,0xe8,0x0e,0xf7,0x69,0xeb,0x87,0xa9,0x63,0x4f,\
210 - 0x1f,0x06,0x20,0xa8,0x3e,0x50,0x00,0x00,0x3d,0x71,0x04,0x04,0x13,0x13,0x00,0x0d,0x28,0x03,0x01,0x04,\
211 - 0x0e,0x00,0x1e,0x94,0x8d,0xf1,0x48,0x31,0x94,0xba,0x75,0x4c,\
212 + 0x1f,0x06,0x20,0xa8,0x84,0xc7,0x29,0xd5,0xe3,0xad,0x04,0x04,0x13,0x13,0x00,0x0d,0x28,0x03,0x01,0x04,\
213 + 0x0e,0x00,0x18,0xd2,0x03,0x7f,0x78,0x9d,0xb6,0x90,0x86,0x4b,\
218 - 0x1f,0x06,0x20,0xc4,0x3e,0x50,0x03,0x00,0x3d,0x71,0x44,0x10,0x14,0x00,0x00,0x0e,0x00,0x03,0x02,0x00,\
219 + 0x1f,0x06,0x20,0xc4,0x37,0x46,0x4f,0x33,0x7b,0xad,0x44,0x10,0x14,0x00,0x00,0x0e,0x33,0x4f,0x03,0x00,\
220 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
225 0x1f,0x06,0x20,0xe0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x04,0x13,0x13,0x00,0x0f,0x28,0x03,0x01,\
226 - 0x10,0x10,0x00,0x1e,0x94,0x8d,0xf1,0x48,0x31,0x94,0xba,0x75,\
227 + 0x10,0x10,0x00,0x56,0xb2,0x16,0x82,0x04,0x95,0x31,0x88,0xc4,\
232 - 0x1f,0x06,0x20,0xfc,0x4c,0x3e,0x50,0x02,0x00,0x3d,0x71,0x14,0x00,0x14,0x00,0x00,0x10,0x00,0x02,0x02,\
233 + 0x1f,0x06,0x20,0xfc,0x42,0x80,0x45,0x82,0x19,0x24,0xe9,0x14,0x00,0x14,0x00,0x00,0x10,0x19,0x82,0x04,\
234 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,\
237 @@ -159,18 +159,25 @@
240 0x1f,0x06,0x40,0x00,0x2a,0x00,0x01,0x00,0x80,0x04,0x00,0x03,0x00,0x00,0x2a,0x05,0x01,0x00,0x04,0x04,\
241 - 0x00,0x0a,0x00,0x0b,0x00,0x03,0x02,0x00,0x08,0x04,0x00,0x0e,\
242 + 0x00,0x0a,0x00,0x0b,0x33,0x4f,0x03,0x00,0x08,0x04,0x00,0x0e,\
247 - 0x19,0x06,0x40,0x1c,0x00,0x00,0x00,0x02,0x02,0x00,0x02,0x04,0x00,0x10,0x00,0x11,0x2a,0x27,0x01,0x00,\
248 + 0x19,0x06,0x40,0x1c,0x00,0x00,0x19,0x82,0x04,0x00,0x02,0x04,0x00,0x10,0x00,0x11,0x2a,0x27,0x01,0x00,\
249 0x80,0x04,0x00,0x14,0x00,0x00,\
254 - 0x13,0x06,0x50,0x00,0x1e,0x94,0x8d,0xf1,0x48,0x31,0x94,0xba,0x75,0x4c,0x3e,0x50,0x00,0x00,0x3d,0x71,\
255 + 0x1f,0x06,0x50,0x00,0x16,0xe8,0x0e,0xf7,0x69,0xeb,0x87,0xa9,0x63,0x4f,0x84,0xc7,0x00,0x00,0xe3,0xad,\
256 + 0x18,0xd2,0x03,0x7f,0x78,0x9d,0xb6,0x90,0x86,0x4b,0x37,0x46,\
261 + 0x17,0x06,0x50,0x1c,0x00,0x00,0x7b,0xad,0x56,0xb2,0x16,0x82,0x04,0x95,0x31,0x88,0xc4,0x42,0x80,0x45,\
262 + 0x00,0x00,0x24,0xe9,\
270 - 0x06,0x06,0xf0,0x00,0x03,0x3d,0x6c,\
271 + 0x06,0x06,0xf0,0x00,0x03,0x2b,0x7e,\