BTstack for EA LPC4088 QSB example program

Dependencies:   LPC4088-USBHost mbed

Fork of KL46Z-BTstack_example by Norimasa Okamoto

The usage is the same as KL46Z-BTstack_example.
使い方はKL46Z-BTstack_exampleと同じです。
/media/uploads/va009039/lpc4088-btstack-480x360.jpg

Committer:
va009039
Date:
Tue Jun 26 14:27:45 2012 +0000
Revision:
0:1ed23ab1345f
fix overflow spp_service_buffer

Who changed what in which revision?

UserRevisionLine numberNew contents of line
va009039 0:1ed23ab1345f 1 #include "mbed.h"
va009039 0:1ed23ab1345f 2 #include "bd_addr.h"
va009039 0:1ed23ab1345f 3 bd_addr::bd_addr()
va009039 0:1ed23ab1345f 4 {
va009039 0:1ed23ab1345f 5
va009039 0:1ed23ab1345f 6 }
va009039 0:1ed23ab1345f 7
va009039 0:1ed23ab1345f 8 bd_addr::bd_addr(char* s)
va009039 0:1ed23ab1345f 9 {
va009039 0:1ed23ab1345f 10 for(int i = 0; i <= 5; i++) {
va009039 0:1ed23ab1345f 11 ad[i] = strtol(s+i*3, NULL, 16);
va009039 0:1ed23ab1345f 12 }
va009039 0:1ed23ab1345f 13 }
va009039 0:1ed23ab1345f 14
va009039 0:1ed23ab1345f 15 uint8_t* bd_addr::data(uint8_t* addr)
va009039 0:1ed23ab1345f 16 {
va009039 0:1ed23ab1345f 17 if (addr != NULL) {
va009039 0:1ed23ab1345f 18 ad[5] = addr[0];
va009039 0:1ed23ab1345f 19 ad[4] = addr[1];
va009039 0:1ed23ab1345f 20 ad[3] = addr[2];
va009039 0:1ed23ab1345f 21 ad[2] = addr[3];
va009039 0:1ed23ab1345f 22 ad[1] = addr[4];
va009039 0:1ed23ab1345f 23 ad[0] = addr[5];
va009039 0:1ed23ab1345f 24 }
va009039 0:1ed23ab1345f 25 return ad;
va009039 0:1ed23ab1345f 26 }
va009039 0:1ed23ab1345f 27
va009039 0:1ed23ab1345f 28 char* bd_addr::to_str()
va009039 0:1ed23ab1345f 29 {
va009039 0:1ed23ab1345f 30 snprintf(ad_str, sizeof(ad_str), "%02X:%02X:%02X:%02X:%02X:%02X",
va009039 0:1ed23ab1345f 31 ad[0], ad[1], ad[2], ad[3], ad[4], ad[5]);
va009039 0:1ed23ab1345f 32 return ad_str;
va009039 0:1ed23ab1345f 33 }