bogdanoniga / ble_gateway

Bluetooth Low Energy (BLE) Gateway which supports bi-directional data transfer with MQTT Broker
MIT License
9 stars 6 forks source link

Error in Cloning ble_gateway software step #1

Open taha633 opened 4 years ago

taha633 commented 4 years ago

Hi, bogdanoniga Thank you for your nice work. But, I try to install it again and again without any successful on Rpi. I face with a lot of errors in Cloning ble_gateway software step. Can you help me?

bogdanoniga commented 4 years ago

Hi. Lately, I didn't update the installation steps. I help you, we can figure it out together. Please contact me directly on my email address.

taha633 commented 4 years ago

Hi Again! and thank you for your kindly response I face a lot of error in cloning ble_gateway step in your setup.sh for rpi raspbian stretch

for example, one and maybe last error relative to os, in output print like this: no compatible with your operating system and in parentheses print (os=darwin ...)

can you send me complete steps or setup for install on raspbian stretch?

thanks in advanced.

On Tue, Jan 28, 2020 at 7:25 PM Bogdan Oniga notifications@github.com wrote:

Hi. Lately, I didn't update the installation steps. I help you, we can figure it out together. Please contact me directly on my email address.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bogdanoniga/ble_gateway/issues/1?email_source=notifications&email_token=ADHNA7UC6KHR4B3ADOSNIF3RABIO3A5CNFSM4KMUWEHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKD22JA#issuecomment-579317028, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADHNA7QEUX57DXWQ5F2V45LRABIO3ANCNFSM4KMUWEHA .

-- Best Regards,

Zoheir Morshedi.

taha633 commented 4 years ago

hi, the output of npm install command is:

usb@1.6.2 install /usr/share/ble_gateway/node_modules/usb prebuild-install --verbose || node-gyp rebuild

prebuild-install info begin Prebuild-install version 5.3.3 prebuild-install info looking for cached prebuild @ /home/pi/.npm/_prebuilds/4e449c-usb-v1.6.2-node-v79-linux-arm.tar.gz prebuild-install http request GET https://github.com/tessel/node-usb/releases/download/v1.6.2/usb-v1.6.2-node-v79-linux-arm.tar.gz prebuild-install http 404 https://github.com/tessel/node-usb/releases/download/v1.6.2/usb-v1.6.2-node-v79-linux-arm.tar.gz prebuild-install WARN install No prebuilt binaries found (target=13.7.0 runtime=node arch=arm libc= platform=linux) make: Entering directory '/usr/share/ble_gateway/node_modules/usb/build' CC(target) Release/obj.target/libusb/libusb/libusb/core.o CC(target) Release/obj.target/libusb/libusb/libusb/descriptor.o CC(target) Release/obj.target/libusb/libusb/libusb/hotplug.o CC(target) Release/obj.target/libusb/libusb/libusb/io.o CC(target) Release/obj.target/libusb/libusb/libusb/strerror.o CC(target) Release/obj.target/libusb/libusb/libusb/sync.o CC(target) Release/obj.target/libusb/libusb/libusb/os/poll_posix.o CC(target) Release/obj.target/libusb/libusb/libusb/os/threads_posix.o CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_usbfs.o CC(target) Release/obj.target/libusb/libusb/libusb/os/linux_udev.o AR(target) Release/obj.target/usb.a COPY Release/usb.a CXX(target) Release/obj.target/usb_bindings/src/node_usb.o ../src/node_usb.cc: In function 'void handleHotplug(std::pair<libusb_device, libusb_hotplug_event>)': ../src/node_usb.cc:151:58: warning: 'v8::Local Nan::MakeCallback(v8::Local, const char, int, v8::Local)' is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(Nan::New(hotplugThis), "emit", 2, argv); ^ In file included from ../src/helpers.h:3:0, from ../src/node_usb.h:21, from ../src/node_usb.cc:1: ../node_modules/nan/nan.h:1001:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~ CXX(target) Release/obj.target/usb_bindings/src/device.o ../src/device.cc: In static member function 'static void Req::default_after(uv_work_t)': ../src/device.cc:237:64: warning: 'v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local)' is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(device, Nan::New(baton->callback), 1, argv); ^ In file included from ../src/helpers.h:3:0, from ../src/node_usb.h:21, from ../src/device.cc:1: ../node_modules/nan/nan.h:959:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~ CXX(target) Release/obj.target/usb_bindings/src/transfer.o ../src/transfer.cc: In function 'void handleCompletion(Transfer)': ../src/transfer.cc:126:72: warning: 'v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local*)' is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(self->handle(), Nan::New(self->v8callback), 3, argv); ^ In file included from ../src/helpers.h:3:0, from ../src/node_usb.h:21, from ../src/transfer.cc:1: ../node_modules/nan/nan.h:959:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~ SOLINK_MODULE(target) Release/obj.target/usb_bindings.node COPY Release/usb_bindings.node make: Leaving directory '/usr/share/ble_gateway/node_modules/usb/build'

bluetooth-hci-socket@0.5.1 install /usr/share/ble_gateway/node_modules/bluetooth-hci-socket node-gyp rebuild

make: Entering directory '/usr/share/ble_gateway/node_modules/bluetooth-hci-socket/build' CXX(target) Release/obj.target/binding/src/BluetoothHciSocket.o ../src/BluetoothHciSocket.cpp: In static member function 'static void BluetoothHciSocket::Init(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)': ../src/BluetoothHciSocket.cpp:128:82: error: no matching function for call to 'v8::FunctionTemplate::GetFunction()' target->Set(Nan::New("BluetoothHciSocket").ToLocalChecked(), tmpl->GetFunction());

  ^

In file included from /home/pi/.cache/node-gyp/13.7.0/include/node/node.h:63:0, from /home/pi/.cache/node-gyp/13.7.0/include/node/node_buffer.h:25, from ../src/BluetoothHciSocket.cpp:7: /home/pi/.cache/node-gyp/13.7.0/include/node/v8.h:6283:46: note: candidate: v8::MaybeLocal v8::FunctionTemplate::GetFunction(v8::Local) V8_WARN_UNUSED_RESULT MaybeLocal GetFunction( ^~~ /home/pi/.cache/node-gyp/13.7.0/include/node/v8.h:6283:46: note: candidate expects 1 argument, 0 provided ../src/BluetoothHciSocket.cpp: In member function 'void BluetoothHciSocket::poll()': ../src/BluetoothHciSocket.cpp:251:95: warning: 'v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local*)' is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(Nan::New(this->This), Nan::New("emit").ToLocalChecked(), 2, argv);

               ^

In file included from ../src/BluetoothHciSocket.cpp:8:0: ../../nan/nan.h:1045:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~ ../src/BluetoothHciSocket.cpp: In member function 'void BluetoothHciSocket::emitErrnoError()': ../src/BluetoothHciSocket.cpp:269:109: error: no matching function for call to 'v8::Object::Get(v8::Local)' Local errorConstructor = Local::Cast(globalObj->Get(Nan::New("Error").ToLocalChecked()));

                             ^

In file included from /home/pi/.cache/node-gyp/13.7.0/include/node/node.h:63:0, from /home/pi/.cache/node-gyp/13.7.0/include/node/node_buffer.h:25, from ../src/BluetoothHciSocket.cpp:7: /home/pi/.cache/node-gyp/13.7.0/include/node/v8.h:3594:43: note: candidate: v8::MaybeLocal v8::Object::Get(v8::Local, v8::Local) V8_WARN_UNUSED_RESULT MaybeLocal Get(Local context, ^~~ /home/pi/.cache/node-gyp/13.7.0/include/node/v8.h:3594:43: note: candidate expects 2 arguments, 1 provided /home/pi/.cache/node-gyp/13.7.0/include/node/v8.h:3597:43: note: candidate: v8::MaybeLocal v8::Object::Get(v8::Local, uint32_t) V8_WARN_UNUSED_RESULT MaybeLocal Get(Local context, ^~~ /home/pi/.cache/node-gyp/13.7.0/include/node/v8.h:3597:43: note: candidate expects 2 arguments, 1 provided ../src/BluetoothHciSocket.cpp:275:72: error: no matching function for call to 'v8::Function::NewInstance(int, v8::Local [1])' Local error = errorConstructor->NewInstance(1, constructorArgs); ^ In file included from /home/pi/.cache/node-gyp/13.7.0/include/node/node.h:63:0, from /home/pi/.cache/node-gyp/13.7.0/include/node/node_buffer.h:25, from ../src/BluetoothHciSocket.cpp:7: /home/pi/.cache/node-gyp/13.7.0/include/node/v8.h:4318:44: note: candidate: v8::MaybeLocal v8::Function::NewInstance(v8::Local, int, v8::Local) const V8_WARN_UNUSED_RESULT MaybeLocal NewInstance( ^~~ /home/pi/.cache/node-gyp/13.7.0/include/node/v8.h:4318:44: note: candidate expects 3 arguments, 2 provided /home/pi/.cache/node-gyp/13.7.0/include/node/v8.h:4321:44: note: candidate: v8::MaybeLocal v8::Function::NewInstance(v8::Local) const V8_WARN_UNUSED_RESULT MaybeLocal NewInstance( ^~~ /home/pi/.cache/node-gyp/13.7.0/include/node/v8.h:4321:44: note: candidate expects 1 argument, 2 provided ../src/BluetoothHciSocket.cpp:282:93: warning: 'v8::Local Nan::MakeCallback(v8::Local, v8::Local, int, v8::Local)' is deprecated [-Wdeprecated-declarations] Nan::MakeCallback(Nan::New(this->This), Nan::New("emit").ToLocalChecked(), 2, argv);

             ^

In file included from ../src/BluetoothHciSocket.cpp:8:0: ../../nan/nan.h:1045:46: note: declared here NAN_DEPRECATED inline v8::Local MakeCallback( ^~~~ ../src/BluetoothHciSocket.cpp: In static member function 'static Nan::NAN_METHOD_RETURN_TYPE BluetoothHciSocket::BindRaw(Nan::NAN_METHOD_ARGS_TYPE)': ../src/BluetoothHciSocket.cpp:395:34: error: no matching function for call to 'v8::Value::IntegerValue()' devId = arg0->IntegerValue(); ^ In file included from /home/pi/.cache/node-gyp/13.7.0/include/node/node.h:63:0, from /home/pi/.cache/node-gyp/13.7.0/include/node/node_buffer.h:25, from ../src/BluetoothHciSocket.cpp:7: /home/pi/.cache/node-gyp/13.7.0/include/node/v8.h:2774:40: note: candidate: v8::Maybe v8::Value::IntegerValue(v8::Local) const V8_WARN_UNUSED_RESULT Maybe IntegerValue( ^~~~ /home/pi/.cache/node-gyp/13.7.0/include/node/v8.h:2774:40: note: candidate expects 1 argument, 0 provided ../src/BluetoothHciSocket.cpp: In static member function 'static Nan::NAN_METHOD_RETURN_TYPE BluetoothHciSocket::BindUser(Nan::NAN_METHOD_ARGS_TYPE)': ../src/BluetoothHciSocket.cpp:417:34: error: no matching function for call to 'v8::Value::IntegerValue()' devId = arg0->IntegerValue(); ^ In file included from /home/pi/.cache/node-gyp/13.7.0/include/node/node.h:63:0, from /home/pi/.cache/node-gyp/13.7.0/include/node/node_buffer.h:25, from ../src/BluetoothHciSocket.cpp:7: /home/pi/.cache/node-gyp/13.7.0/include/node/v8.h:2774:40: note: candidate: v8::Maybe v8::Value::IntegerValue(v8::Local) const V8_WARN_UNUSED_RESULT Maybe IntegerValue( ^~~~ /home/pi/.cache/node-gyp/13.7.0/include/node/v8.h:2774:40: note: candidate expects 1 argument, 0 provided binding.target.mk:109: recipe for target 'Release/obj.target/binding/src/BluetoothHciSocket.o' failed make: *** [Release/obj.target/binding/src/BluetoothHciSocket.o] Error 1 make: Leaving directory '/usr/share/ble_gateway/node_modules/bluetooth-hci-socket/build' gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/opt/nodejs/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23) gyp ERR! stack at ChildProcess.emit (events.js:321:20) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) gyp ERR! System Linux 4.19.66-v7+ gyp ERR! command "/opt/nodejs/bin/node" "/opt/nodejs/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /usr/share/ble_gateway/node_modules/bluetooth-hci-socket gyp ERR! node -v v13.7.0 gyp ERR! node-gyp -v v5.0.5 gyp ERR! not ok

sqlite3@4.1.1 install /usr/share/ble_gateway/node_modules/sqlite3 node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.1.1/node-v79-linux-arm.tar.gz node-pre-gyp WARN Pre-built binaries not found for sqlite3@4.1.1 and node@13.7.0 (node-v79 ABI, glibc) (falling back to source compile with node-gyp) make: Entering directory '/usr/share/ble_gateway/node_modules/sqlite3/build' ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3300100/sqlite3.c TOUCH Release/obj.target/deps/action_before_build.stamp CC(target) Release/obj.target/sqlite3/gen/sqlite-autoconf-3300100/sqlite3.o ^Cdeps/sqlite3.target.mk:139: recipe for target 'Release/obj.target/sqlite3/gen/sqlite-autoconf-3300100/sqlite3.o' failed make: *** [Release/obj.target/sqlite3/gen/sqlite-autoconf-3300100/sqlite3.o] Interrupt

On Sat, Feb 1, 2020 at 9:52 AM zey zo z.morshedi@gmail.com wrote:

Hi Again! and thank you for your kindly response I face a lot of error in cloning ble_gateway step in your setup.sh for rpi raspbian stretch

for example, one and maybe last error relative to os, in output print like this: no compatible with your operating system and in parentheses print (os=darwin ...)

can you send me complete steps or setup for install on raspbian stretch?

thanks in advanced.

On Tue, Jan 28, 2020 at 7:25 PM Bogdan Oniga notifications@github.com wrote:

Hi. Lately, I didn't update the installation steps. I help you, we can figure it out together. Please contact me directly on my email address.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bogdanoniga/ble_gateway/issues/1?email_source=notifications&email_token=ADHNA7UC6KHR4B3ADOSNIF3RABIO3A5CNFSM4KMUWEHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKD22JA#issuecomment-579317028, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADHNA7QEUX57DXWQ5F2V45LRABIO3ANCNFSM4KMUWEHA .

-- Best Regards,

Zoheir Morshedi.

-- Best Regards,

Zoheir Morshedi.

bogdanoniga commented 4 years ago

hi, make sure you are using node.js 8.

bogdanoniga commented 4 years ago

I will try to debug the commands from setup.sh and let you know my results.

taha633 commented 4 years ago

Thank you Bagdan

On Sat, Feb 1, 2020 at 10:58 AM Bogdan Oniga notifications@github.com wrote:

I will try to debug the commands from setup.sh and let you know my results.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bogdanoniga/ble_gateway/issues/1?email_source=notifications&email_token=ADHNA7RSKRYDXS7WRDHPHO3RAUQAHA5CNFSM4KMUWEHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKQWTLQ#issuecomment-581003694, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADHNA7U3D3W7DXPLD5IXHKDRAUQAHANCNFSM4KMUWEHA .

-- Best Regards,

Zoheir Morshedi.

bogdanoniga commented 4 years ago

Unfortunately, the code wasn't maintained to run on newer versions of Node.js, so we have to run it on the deprecated v8.x.

bogdanoniga commented 4 years ago

I updated the package.json, make sure you have the new version.

taha633 commented 4 years ago

Hi again finally I can install it with deprecated v8.x, but when I publish a message to ble gateway for one connected device, ble_gateway Service crashed in rpi

I used mosquitto broker on rpi and publish with this command : #mosquitto_pub -t gateway/b827ebfffeb46407/tx -m '{"device":"UUID","payload":"hello"}' -h 127.0.0.1 -p 1883

if you think I should used this new version for resolve this issue please let me know.

Thanks in advanced.

On Sat, Feb 1, 2020 at 11:32 AM Bogdan Oniga notifications@github.com wrote:

I updated the package.json, make sure you have the new version.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bogdanoniga/ble_gateway/issues/1?email_source=notifications&email_token=ADHNA7VZJHWFQVC24SMBN2TRAUUDHA5CNFSM4KMUWEHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKQXF2Y#issuecomment-581006059, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADHNA7TQ4ZHUMZS3J7TH5NLRAUUDHANCNFSM4KMUWEHA .

-- Best Regards,

Zoheir Morshedi.

taha633 commented 4 years ago

Hi Bogdan, Please help me, Your given link not working. Also, when I published to mosquitto broker, ble_gateway service crashed! I used command below:

#mosquitto_pub -t gateway/b827ebfffeb46407/tx -m '{"uuid":"UUID","payload":"hello"}' -h 127.0.0.1 -p 1883 I have an Esp32 with ble server sketch and I connected it to ble gateway successfully but when I published a message for this esp32 with that command , ble gateway service crashed

On Sun, Feb 2, 2020 at 9:05 AM zey zo z.morshedi@gmail.com wrote:

unfortunately this link not working...

On Sat, Feb 1, 2020 at 7:54 PM Bogdan Oniga notifications@github.com wrote:

Before sending a message, the BLE device has to be connected with the BLE gateway. You can use this snippet to test the connection using an ESP32 https://github.com/bogdanoniga/IoT/blob/master/code_snippets/ble/esp32/BLE_write_read/BLE_write_read.ino .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bogdanoniga/ble_gateway/issues/1?email_source=notifications&email_token=ADHNA7XUKNTYQKA6XGV6U3TRAWO5PA5CNFSM4KMUWEHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKRA2LY#issuecomment-581045551, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADHNA7UU4N3DAM54VIQM35TRAWO5PANCNFSM4KMUWEHA .

-- Best Regards,

Zoheir Morshedi.

-- Best Regards,

Zoheir Morshedi.

bogdanoniga commented 4 years ago

Indeed, the link is not working. I've put it in another place :). https://gitlab.com/openiot/iot-nodes/blob/master/bluetooth/BLE_Server_Write_Notify.ino

bogdanoniga commented 4 years ago

Can you add the error logs?

bogdanoniga commented 4 years ago

Hi Bogdan, Please help me, Your given link not working. Also, when I published to mosquitto broker, ble_gateway service crashed! I used command below: #mosquitto_pub -t gateway/b827ebfffeb46407/tx -m '{"uuid":"UUID","payload":"hello"}' -h 127.0.0.1 -p 1883 I have an Esp32 with ble server sketch and I connected it to ble gateway successfully but when I published a message for this esp32 with that command , ble gateway service crashed On Sun, Feb 2, 2020 at 9:05 AM zey zo @.> wrote: unfortunately this link not working... On Sat, Feb 1, 2020 at 7:54 PM Bogdan Oniga @.> wrote: > Before sending a message, the BLE device has to be connected with the BLE > gateway. You can use this snippet to test the connection using an ESP32 > https://github.com/bogdanoniga/IoT/blob/master/code_snippets/ble/esp32/BLE_write_read/BLE_write_read.ino > . > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <#1?email_source=notifications&email_token=ADHNA7XUKNTYQKA6XGV6U3TRAWO5PA5CNFSM4KMUWEHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKRA2LY#issuecomment-581045551>, > or unsubscribe > https://github.com/notifications/unsubscribe-auth/ADHNA7UU4N3DAM54VIQM35TRAWO5PANCNFSM4KMUWEHA > . > -- Best Regards, Zoheir Morshedi. -- Best Regards, Zoheir Morshedi.

The message should be _'{"device":,"payload":"hello"}'_ (see #L331-L334)

taha633 commented 4 years ago

Hi, excuse me for late reply, I was sick. As I said, when I published a command to the broker for one connected device, ble_gateway service crashed. I captured screenshot from each steps, you can see all of them with meaningful file name in attachment.

On Sun, Feb 2, 2020 at 7:53 PM Bogdan Oniga notifications@github.com wrote:

Hi Bogdan, Please help me, Your given link not working. Also, when I published to mosquitto broker, ble_gateway service crashed! I used command below: #mosquitto_pub -t gateway/b827ebfffeb46407/tx -m '{"uuid":"UUID","payload":"hello"}' -h 127.0.0.1 -p 1883 I have an Esp32 with ble server sketch and I connected it to ble gateway successfully but when I published a message for this esp32 with that command , ble gateway service crashed … <#m-2993996605460698756> On Sun, Feb 2, 2020 at 9:05 AM zey zo @.> wrote: unfortunately this link not working... On Sat, Feb 1, 2020 at 7:54 PM Bogdan Oniga @.> wrote: > Before sending a message, the BLE device has to be connected with the BLE > gateway. You can use this snippet to test the connection using an ESP32 > https://github.com/bogdanoniga/IoT/blob/master/code_snippets/ble/esp32/BLE_write_read/BLE_write_read.ino

. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <#1 https://github.com/bogdanoniga/ble_gateway/issues/1?email_source=notifications&email_token=ADHNA7XUKNTYQKA6XGV6U3TRAWO5PA5CNFSM4KMUWEHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKRA2LY#issuecomment-581045551>, or unsubscribe > https://github.com/notifications/unsubscribe-auth/ADHNA7UU4N3DAM54VIQM35TRAWO5PANCNFSM4KMUWEHA . > -- Best Regards, Zoheir Morshedi. -- Best Regards, Zoheir Morshedi.

The message should be '{"device":,"payload":"hello"}' (see

L331-L334

https://github.com/bogdanoniga/ble_gateway/blob/master/routes/api.js#L331-L334 )

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bogdanoniga/ble_gateway/issues/1?email_source=notifications&email_token=ADHNA7WVUEWUBX2CRRW5N7TRA3XP5A5CNFSM4KMUWEHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKR2TRI#issuecomment-581151173, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADHNA7SP5HWFWWTU6F55DUDRA3XP5ANCNFSM4KMUWEHA .

-- Best Regards,

Zoheir Morshedi.

taha633 commented 4 years ago

Hi, I found reason of ble_gateway crashed. in below code(part of api.js) when send payload to sendMessage(uuid,payload) function buffer don't recognised type of payload . I changed it and send msg[payload] directly to sendMessage(uuid,payload) function like this sendMessage(msg[uuid],msg[payload]).

function receiveMQTTData() { mqtt_client.on('message', function(topic, message) { var msg = JSON.parse(message.toString('utf-8'));

if (end_to_end_encryption = true) {
  var payload = msg['phyPayload'];
  sendBroadcast(msg['phyPayload']);
}
else {
  var uuid = msg['device'];
  var payload = msg['payload'];

  sendMessage(msg['device'], msg['payload']);
}

}); }

but now it seems write function in sendMessage(uuid,payload) don't work properly because didn't send any payload to connected ble device: charac.write(new Buffer.from(payload), false, function(error) { if (!error) { console.log("Sent message: " + payload); message = "sent"; } else { console.log("Error sending message"); message = "error"; } }.bind(this));

can you help me for resolve it?

On Tue, Feb 4, 2020 at 11:59 AM zey zo z.morshedi@gmail.com wrote:

Hi, excuse me for late reply, I was sick. As I said, when I published a command to the broker for one connected device, ble_gateway service crashed. I captured screenshot from each steps, you can see all of them with meaningful file name in attachment.

On Sun, Feb 2, 2020 at 7:53 PM Bogdan Oniga notifications@github.com wrote:

Hi Bogdan, Please help me, Your given link not working. Also, when I published to mosquitto broker, ble_gateway service crashed! I used command below: #mosquitto_pub -t gateway/b827ebfffeb46407/tx -m '{"uuid":"UUID","payload":"hello"}' -h 127.0.0.1 -p 1883 I have an Esp32 with ble server sketch and I connected it to ble gateway successfully but when I published a message for this esp32 with that command , ble gateway service crashed … <#m_-2042112181690169875m-2993996605460698756_> On Sun, Feb 2, 2020 at 9:05 AM zey zo @.> wrote: unfortunately this link not working... On Sat, Feb 1, 2020 at 7:54 PM Bogdan Oniga @.> wrote: > Before sending a message, the BLE device has to be connected with the BLE > gateway. You can use this snippet to test the connection using an ESP32 > https://github.com/bogdanoniga/IoT/blob/master/code_snippets/ble/esp32/BLE_write_read/BLE_write_read.ino

. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <#1 https://github.com/bogdanoniga/ble_gateway/issues/1?email_source=notifications&email_token=ADHNA7XUKNTYQKA6XGV6U3TRAWO5PA5CNFSM4KMUWEHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKRA2LY#issuecomment-581045551>, or unsubscribe > https://github.com/notifications/unsubscribe-auth/ADHNA7UU4N3DAM54VIQM35TRAWO5PANCNFSM4KMUWEHA . > -- Best Regards, Zoheir Morshedi. -- Best Regards, Zoheir Morshedi.

The message should be '{"device":,"payload":"hello"}' (see #L331-L334 https://github.com/bogdanoniga/ble_gateway/blob/master/routes/api.js#L331-L334 )

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bogdanoniga/ble_gateway/issues/1?email_source=notifications&email_token=ADHNA7WVUEWUBX2CRRW5N7TRA3XP5A5CNFSM4KMUWEHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKR2TRI#issuecomment-581151173, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADHNA7SP5HWFWWTU6F55DUDRA3XP5ANCNFSM4KMUWEHA .

-- Best Regards,

Zoheir Morshedi.

-- Best Regards,

Zoheir Morshedi.