Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Novice
1,277 Views

Edison gattlib ble

Jump to solution

Hi, i am a beginner to Intel Edison and i have some questions, i am using python scripts on Edison (pygattlib) and i need to communicate with Bluetooth module(Beacon HM-11) and i need help concerning some points:

-i just want to understand the methods used in (write.py) and (read.py)

-what are the handles passed by the method used for? write_by_handle(***?) , read_by_handle(***?)

-i just want to do a simple tic-toc communication with the beacon, just sending any data and receiving the response.

 

Thanks in advance.

 

 

 

 


Accepted Solutions
Highlighted
Community Manager
14 Views

Hello AhmedRashed93,

 

 

If you would like to check what write_by_handle and read_by_handle, then I'd suggest you to check the following links:

 

 

bindings.cpp

 

https://bitbucket.org/OscarAcena/pygattlib/src/a858e8626a93cb9b4ad56f3fb980a6517a0702c6/src/bindings... https://bitbucket.org/OscarAcena/pygattlib/src/a858e8626a93cb9b4ad56f3fb980a6517a0702c6/src/bindings...

 

 

gattlib.cpp

 

https://bitbucket.org/OscarAcena/pygattlib/src/a858e8626a93cb9b4ad56f3fb980a6517a0702c6/src/gattlib.... https://bitbucket.org/OscarAcena/pygattlib/src/a858e8626a93cb9b4ad56f3fb980a6517a0702c6/src/gattlib....

 

 

gatt.h

 

https://bitbucket.org/OscarAcena/pygattlib/src/a858e8626a93cb9b4ad56f3fb980a6517a0702c6/src/bluez/at... https://bitbucket.org/OscarAcena/pygattlib/src/a858e8626a93cb9b4ad56f3fb980a6517a0702c6/src/bluez/at...

 

 

gatt.c

 

https://bitbucket.org/OscarAcena/pygattlib/src/a858e8626a93cb9b4ad56f3fb980a6517a0702c6/src/bluez/at... https://bitbucket.org/OscarAcena/pygattlib/src/a858e8626a93cb9b4ad56f3fb980a6517a0702c6/src/bluez/at...

 

 

In bindings.cpp both write_by_handle and read_by_handle are defined under the "environment" of the Boost Python module. If you check gattlib.cpp, you will see that write_by_handle and read_by_handle end up using the gatt_write_char and gatt_read_char methods. These methods can be found in gatt.c.

 

 

If you read these files, you should be able to understand how these commands work and what they "handle". In case you need more help with this library I'd suggest you to contact the library's creator in https://bitbucket.org/OscarAcena/pygattlib/issues?status=new&status=open https://bitbucket.org/OscarAcena/pygattlib/issues?status=new&status=open since he'll be able to provide you more detailed information about how the library works.

 

 

Peter.

View solution in original post

0 Kudos
2 Replies
Highlighted
Community Manager
15 Views

Hello AhmedRashed93,

 

 

If you would like to check what write_by_handle and read_by_handle, then I'd suggest you to check the following links:

 

 

bindings.cpp

 

https://bitbucket.org/OscarAcena/pygattlib/src/a858e8626a93cb9b4ad56f3fb980a6517a0702c6/src/bindings... https://bitbucket.org/OscarAcena/pygattlib/src/a858e8626a93cb9b4ad56f3fb980a6517a0702c6/src/bindings...

 

 

gattlib.cpp

 

https://bitbucket.org/OscarAcena/pygattlib/src/a858e8626a93cb9b4ad56f3fb980a6517a0702c6/src/gattlib.... https://bitbucket.org/OscarAcena/pygattlib/src/a858e8626a93cb9b4ad56f3fb980a6517a0702c6/src/gattlib....

 

 

gatt.h

 

https://bitbucket.org/OscarAcena/pygattlib/src/a858e8626a93cb9b4ad56f3fb980a6517a0702c6/src/bluez/at... https://bitbucket.org/OscarAcena/pygattlib/src/a858e8626a93cb9b4ad56f3fb980a6517a0702c6/src/bluez/at...

 

 

gatt.c

 

https://bitbucket.org/OscarAcena/pygattlib/src/a858e8626a93cb9b4ad56f3fb980a6517a0702c6/src/bluez/at... https://bitbucket.org/OscarAcena/pygattlib/src/a858e8626a93cb9b4ad56f3fb980a6517a0702c6/src/bluez/at...

 

 

In bindings.cpp both write_by_handle and read_by_handle are defined under the "environment" of the Boost Python module. If you check gattlib.cpp, you will see that write_by_handle and read_by_handle end up using the gatt_write_char and gatt_read_char methods. These methods can be found in gatt.c.

 

 

If you read these files, you should be able to understand how these commands work and what they "handle". In case you need more help with this library I'd suggest you to contact the library's creator in https://bitbucket.org/OscarAcena/pygattlib/issues?status=new&status=open https://bitbucket.org/OscarAcena/pygattlib/issues?status=new&status=open since he'll be able to provide you more detailed information about how the library works.

 

 

Peter.

View solution in original post

0 Kudos
Highlighted
Community Manager
14 Views

In one sentence you can say that a handle is the "access adress" for an attribute, so you get the value from it

You can find more information here:

https://www.safaribooksonline.com/library/view/getting-started-with/9781491900550/ch04.html https://www.safaribooksonline.com/library/view/getting-started-with/9781491900550/ch04.html

http://mike.saunby.net/2013/04/raspberry-pi-and-ti-cc2541-sensortag.html Michael Saunby: Raspberry Pi and TI CC2541 SensorTag

Flo1991