DeanCording / owonb35

Bluetooth Client for Owon B35 Multimeter
MIT License
31 stars 5 forks source link

Compilation error #2

Closed 53845714nF closed 9 months ago

53845714nF commented 5 years ago

Hello DeanCording, I don't have that much experience compiling programs. When I call "make" I get this error message.

cc -Wall -O2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include  owonb35.c  -o owonb35 -lgattlib -lglib-2.0 -lm
owonb35.c: In function ‘connect_device’:
owonb35.c:575:71: error: ‘BT_SEC_LOW’ undeclared (first use in this function); did you mean ‘BT_SECURITY’?
         connection = gattlib_connect(NULL, address, BDADDR_LE_PUBLIC, BT_SEC_LOW, 0, 0);
                                                                       ^~~~~~~~~~
                                                                       BT_SECURITY
owonb35.c:575:71: note: each undeclared identifier is reported only once for each function it appears in
owonb35.c:575:22: error: too many arguments to function ‘gattlib_connect’
         connection = gattlib_connect(NULL, address, BDADDR_LE_PUBLIC, BT_SEC_LOW, 0, 0);
                      ^~~~~~~~~~~~~~~
In file included from owonb35.c:38:0:
/usr/include/gattlib.h:276:20: note: declared here
 gatt_connection_t *gattlib_connect(const char *src, const char *dst, unsigned long options);
                    ^~~~~~~~~~~~~~~
owonb35.c: In function ‘main’:
owonb35.c:764:56: warning: passing argument 2 of ‘gattlib_adapter_scan_enable’ from incompatible pointer type [-Wincompatible-pointer-types]
             ret = gattlib_adapter_scan_enable(adapter, ble_discovered_device, BLE_SCAN_TIMEOUT);
                                                        ^~~~~~~~~~~~~~~~~~~~~
In file included from owonb35.c:38:0:
/usr/include/gattlib.h:214:5: note: expected ‘gattlib_discovered_device_t {aka void (*)(void *, const char *, const char *, void *)}’ but argument is of type ‘void (*)(const char *, const char *)’
 int gattlib_adapter_scan_enable(void* adapter, gattlib_discovered_device_t discovered_device_cb, int timeout, void *user_data);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
owonb35.c:764:19: error: too few arguments to function ‘gattlib_adapter_scan_enable’
             ret = gattlib_adapter_scan_enable(adapter, ble_discovered_device, BLE_SCAN_TIMEOUT);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from owonb35.c:38:0:
/usr/include/gattlib.h:214:5: note: declared here
 int gattlib_adapter_scan_enable(void* adapter, gattlib_discovered_device_t discovered_device_cb, int timeout, void *user_data);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
owonb35.c:859:74: warning: passing argument 3 of ‘gattlib_read_char_by_uuid’ from incompatible pointer type [-Wincompatible-pointer-types]
             ret = gattlib_read_char_by_uuid(connection, &g_command_uuid, buffer, &len);
                                                                          ^~~~~~
In file included from owonb35.c:38:0:
/usr/include/gattlib.h:418:5: note: expected ‘void **’ but argument is of type ‘uint8_t * {aka unsigned char *}’
 int gattlib_read_char_by_uuid(gatt_connection_t* connection, uuid_t* uuid, void** buffer, size_t* buffer_len);
     ^~~~~~~~~~~~~~~~~~~~~~~~~
Makefile:16: recipe for target 'owonb35' failed
make: *** [owonb35] Error 1

Even if I use the pre-compiled version I get an error message.

error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory

I use Linux Mint 19 Tara and my last Python Version is 3.6.8 . I hope you can help me.

With best regards Sebastian

DeanCording commented 5 years ago

Hi Sebastian,

Have you tried using the pre-compiled version available from here https://github.com/ DeanCording/owonb35/releases/download/v1.4.0/owonb35

You will also need to install the gatlib library from here https://github.com/labapart/ gattlib/releases/download/dev/gattlib_0.2-dev_x86_64.deb

Cheers,

Dean

On Monday, 28 October 2019 17:58:25 AEST 53845714nF wrote:

Hello DeanCording,I don't have that much experience compiling programs. When I call "make" I get this error message. cc -Wall -O2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include owonb35.c
-o owonb35 -lgattlib -lglib-2.0 -lm owonb35.c: In function ‘connect_device’: owonb35.c:575:71: error: ‘BT_SEC_LOW’ undeclared (first use in this function); did you mean ‘BT_SECURITY’? connection = gattlib_connect(NULL, address, BDADDR_LE_PUBLIC, BT_SEC_LOW, 0, 0); ^~~~~~ BT_SECURITY owonb35.c:575:71: note: each undeclared identifier is reported only once for each function it appears in owonb35.c:575:22: error: too many arguments to function ‘gattlib_connect’ connection = gattlib_connect(NULL, address, BDADDR_LE_PUBLIC, BT_SEC_LOW, 0, 0); ^~~~~~~ In file included from owonb35.c:38:0: /usr/include/gattlib.h:276:20: note: declared here gatt_connection_t gattlib_connect(const char src, const char dst, unsigned long options); ^~~~~~~ owonb35.c: In function ‘main’: owonb35.c:764:56: warning: passing argument 2 of ‘gattlib_adapter_scan_enable’ from incompatible pointer type [-Wincompatible-pointer-types] ret = gattlib_adapter_scan_enable(adapter, ble_discovered_device, BLE_SCAN_TIMEOUT); ^~~~~ In file included from owonb35.c:38:0: /usr/include/gattlib.h:214:5: note: expected ‘gattlib_discovered_device_t {aka void ()(void , const char , const char , void )}’ but argument is of type ‘void ()(const char , const char )’ int gattlib_adapter_scan_enable(void adapter, gattlib_discovered_device_t discovered_device_cb, int timeout, void user_data); ^~~~~~~ owonb35.c:764:19: error: too few arguments to function ‘gattlib_adapter_scan_enable’ ret = gattlib_adapter_scan_enable(adapter, ble_discovered_device, BLE_SCAN_TIMEOUT); ^~~~~~~ In file included from owonb35.c:38:0: /usr/include/gattlib.h:214:5: note: declared here int gattlib_adapter_scan_enable(void adapter, gattlib_discovered_device_t discovered_device_cb, int timeout, void *user_data); ^~~~~~~ owonb35.c:859:74: warning: passing argument 3 of ‘gattlib_read_char_by_uuid’ from incompatible pointer type [-Wincompatible-pointer-types] ret = gattlib_read_char_by_uuid(connection, &g_command_uuid, buffer, &len); ^~ In file included from owonb35.c:38:0: /usr/include/gattlib.h:418:5: note: expected ‘void ’ but argument is of type ‘uint8_t {aka unsigned char }’ int gattlib_read_char_by_uuid(gatt_connection_t connection, uuid_t uuid, void buffer, size_t* buffer_len); ^~~~~~~~~ Makefile:16: recipe for target 'owonb35' failed make: *** [owonb35] Error 1

Even if I use the pre-compiled version I get an error message. error while loading shared libraries: libpython3.5m.so.1.0: cannot open shared object file: No such file or directory

I use Linux Mint 19 Tara and my last Python Version is 3.6.8 .I hope you can help me. With best regardsSebastian —You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub[1], or unsubscribe[2].[3]


[1] https://github.com/DeanCording/owonb35/issues/2? email_source=notifications&email_token=AAB5KIUEOY5GP3WU6ZUDX43QQ2LSDA5CNFS M4JFWV2V2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HUWBRVA [2] https://github.com/notifications/unsubscribe-auth/ AAB5KIQGEU4P5O7U7EV6HO3QQ2LSDANCNFSM4JFWV2VQ [3] https://github.com/notifications/beacon/ AAB5KIWQZ67DHNC4H5GCLVLQQ2LSDA5CNFSM4JFWV2V2YY3PNVWWK3TUL52HS4DFUVE XG43VMWVGG33NNVSW45C7NFSM4HUWBRVA.gif

53845714nF commented 5 years ago

Hello Dean, Thank you for the quick reply. I downloaded the GattLib with Bluez Legacy Support and your pre-compiled owonb35. The program starts but I don't get a connection to my Multimeter (OWON B35T+). If i run without the Mac Address, I get this:

sudo ./owonb35                                                  
Scanning...
Multimeter device not found.
Scanning...
Multimeter device not found.
Scanning...
Multimeter device not found.
Scanning...
Multimeter device not found.

If i run with the Mac Address, i get this:

sudo ./owonb35 34:15:13:D1:00:80 
Connecting...
Error: gattlib_connect - initialization
Fail to connect to the multimeter bluetooth device.
Connecting...
Error: gattlib_connect - initialization
Fail to connect to the multimeter bluetooth device.
Connecting...
Error: gattlib_connect - initialization
Fail to connect to the multimeter bluetooth device.

Furthermore, I still can't complicate the program myself. I still get the same error, also on other distributions.

Best regards Sebastian

DeanCording commented 5 years ago

Is your multimeter new or old?  Owon changed the multimeter chipset before I wrote this code.  The old chipset uses a different protocol.  There is a client for the old chipset available which I think I link to on my GitHub page.DeanOn Nov 3, 2019 00:12, 53845714nF notifications@github.com wrote:Hello Dean, Thank you for the quick reply. I downloaded the GattLib with Bluez Legacy Support and your pre-compiled owonb35. The program starts but I don't get a connection to my Multimeter (OWON B35T+). If i run without the Mac Address, I get this: ''' sudo ./owonb35 Scanning... Multimeter device not found. Scanning... Multimeter device not found. Scanning... Multimeter device not found. Scanning... Multimeter device not found. ''' If i run with the Mac Address, i get this: ''' sudo ./owonb35 34:15:13:D1:00:80 Connecting... Error: gattlib_connect - initialization Fail to connect to the multimeter bluetooth device. Connecting... Error: gattlib_connect - initialization Fail to connect to the multimeter bluetooth device. Connecting... Error: gattlib_connect - initialization Fail to connect to the multimeter bluetooth device. ''' Furthermore, I still can't complicate the program myself. I still get the same error, also on other distributions. Best regards Sebastian

—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.

53845714nF commented 5 years ago

Hello, If i use the gatttool -ICommand and I get 6 Byte from my Multimeter:

gatttool -I
[                 ][LE]> connect 34:15:13:D1:00:80
Attempting to connect to 34:15:13:D1:00:80
Connection successful
Notification handle = 0x002e value: 19 f0 04 00 34 0e
Notification handle = 0x002e value: 19 f0 04 00 34 0e
Notification handle = 0x002e value: 19 f0 04 00 34 0e
Notification handle = 0x002e value: 19 f0 04 00 34 0e
Notification handle = 0x002e value: 19 f0 04 00 34 0e
Notification handle = 0x002e value: 19 f0 04 00 34 0e
Notification handle = 0x002e value: 19 f0 04 00 34 0e
Notification handle = 0x002e value: 19 f0 04 00 34 0e
Notification handle = 0x002e value: 19 f0 04 00 34 0e
Notification handle = 0x002e value: 19 f0 04 00 34 0e
Notification handle = 0x002e value: 19 f0 04 00 34 0e
Notification handle = 0x002e value: 19 f0 04 00 34 0e
Notification handle = 0x002e value: 19 f0 04 00 34 0e
Notification handle = 0x002e value: 19 f0 04 00 34 0e
Notification handle = 0x002e value: 19 f0 04 00 34 0e
Notification handle = 0x002e value: 19 f0 04 00 34 0e
Notification handle = 0x002e value: 19 f0 04 00 34 0e
Notification handle = 0x002e value: 19 f0 04 00 34 0e
Notification handle = 0x002e value: 19 f0 04 00 34 0e
Notification handle = 0x002e value: 19 f0 04 00 33 0e
Notification handle = 0x002e value: 19 f0 04 00 33 0e
Notification handle = 0x002e value: 19 f0 04 00 33 0e

And on the backside of my Multimeter are this number: B35T+17480312 BLE4.0

Thank you for your help. With best regards Sebastian

DeanCording commented 5 years ago

The data you are receiving is correct. It shows your meter is set to DCmV auto with a reading of 363.5.

It does seem strange that gattool connects but not owonb35.

53845714nF commented 4 years ago

Yeah, you're right. But i think the Problem is in the gattlib_connect function.

Best Sebastian