http://www.arthurtoday.com/2014/12/raspberry-pi-install-bluez-5-with-ble-support.html
sudo apt-get install libusb-dev
sudo apt-get install libdbus-1-dev
sudo apt-get install libglib2.0-dev --fix-missing
sudo apt-get install libudev-dev
sudo apt-get install libical-dev
sudo apt-get install libreadline-dev
wget https://www.kernel.org/pub/linux/bluetooth/bluez-5.18.tar.xz
(建議使用5.18版)
sudo tar xvf bluez-5.18.tar
cd bluez-5.18
sudo ./configure --disable-systemd
sudo make (下完這個指令後,就可以先去做別的事了,因為,要跑一段時間哩 ! )
sudo make install
sudo reboot
sudo hciconfig hci0 up
sudo hcitool lescan
sudo hcitool lecc 99:99:99:99:99:99(在openwrt底下不需要這段)
cp attrib/gatttool /usr/local/bin/
gatttool -b 12:34:56:78:15:21 -I
char-read-hnd 0x001c
char-write-req 0x001c 01
0x001C: PIO
0x0020:battery level
gatttool -b 12:34:56:78:15:21 --char-read -a 0x001c
gatttool -b 12:34:56:78:15:21 --char-write-req -a 0x001c -n 00
3 pio: gatttool -b 12:34:56:78:15:21 --char-read -a 0x001c
pio 1: gatttool -b 12:34:56:78:15:21 --char-read -a 0x001f
pio 2: gatttool -b 12:34:56:78:15:21 --char-read -a 0x0022
pio 3: gatttool -b 12:34:56:78:15:21 --char-read -a 0x0025
battery: gatttool -b 12:34:56:78:15:21 --char-read -a 0x0029
ble on QT
http://doc.qt.io/qt-5/qtbluetooth-le-overview.html
iptables -F
iptables -A INPUT -i eth0 -p tcp --dport 5000 -j ACCEPT
2015年10月6日 星期二
BLE on raspberry pi整理
C 面試題目
String copy
char* gstrcpy(char* dstr, char* sstr){
if (dstr == NULL) return NULL;
if (sstr == NULL) return NULL;
char* temp = dstr;
while(*dstr++ = *sstr++);
return temp;
}
String cat
char* gstrcat(char* dstr, char* sstr){
if (dstr == NULL) return NULL;
if (sstr == NULL) return NULL;
char* temp = dstr;
dstr = dstr+sizeof(dstr);
while(*dstr++ = *sstr++);
return temp;
}
訂閱:
文章 (Atom)
