This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Why my gateway can only connect to the Xiaomi band 2,
#15
(11.04.2019, 06:11)admin Wrote: Notification is bit different. First you need to send a subscribe message and then read from device using sockreadnotify. Have a look at ti-sensortag and mio-alpha profiles:
https://forum.logicmachine.net/showthread.php?tid=1199


require('ble')
ble.up()
sock =ble.sock()               
ble.settimeout(sock, 10)   
res=ble.connect(sock,"00:81:F9:21:B7:AE")  
err = ble.sockwritereq(sock,39,0x0001)
x = ble.sockreadhnd(sock,39) or ''  
a = x:byte(1)
b = x:byte(2)
c = x:byte(3)
d = x:byte(4)
e = x:byte(5)
f = x:byte(6)
g = x:byte(7)
h = x:byte(8)
i = x:byte(9)
j = x:byte(10)
k = x:byte(11)
m = x:byte(12)
n = x:byte(13)
k = x:byte(14)
o = x:byte(15)
p = x:byte(16)
q = x:byte(17)
log(sock,err,x,a,b,c,d,e,f,g,h,i,j,k,m,n,o,p,q)
ble.close(sock)



I now know that to enable notifications, I can get data, such as err = ble. sockwritereq (sock, 39,0x0001). But now there's a question, why do I write and read functions at the same time, print out all the data is nil. I still have data when I only have a read function.
Reply


Messages In This Thread
RE: Why my gateway can only connect to the Xiaomi band 2, - by 1114752670@qq.com - 18.04.2019, 07:54

Forum Jump: