vovagorodok / arduinobleota Goto Github PK
View Code? Open in Web Editor NEWUpload firmware over Bluetooth
License: MIT License
Upload firmware over Bluetooth
License: MIT License
Device Information Service 1.2: https://www.bluetooth.com/specifications/specs/device-information-service/
DIS used in: https://github.com/gb88/BLEOTA
DIS service doesn't contain HW/SW name characteristics. Will be nice to upload different SW (not only version) in same HW as implemented in current ble ota.
Perhaps contact with bluetooth.org is needed
using this platformio.ini
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
;
;
; arduino nano iot 33 , base
; uses ArduinoBLE lib
;
[env:nano_33_iot]
platform = atmelsam
board = nano_33_iot
framework = arduino
build_flags = -D __SAMD21__
lib_deps =
arduino-libraries/Arduino_JSON@^0.2.0
adafruit/Adafruit VL53L1X@^3.1.0
arduino-libraries/ArduinoBLE@^1.3.4
cmaglie/FlashStorage@^1.0.0
;
;
; arduino nano iot 33 , with OTA
; uses ArduinoBLE lib
;
[env:nano_33_iot-ota]
platform = atmelsam
board = nano_33_iot
framework = arduino
build_flags = -D __SAMD21__
-DUSE_OTA
lib_deps =
arduino-libraries/Arduino_JSON@^0.2.0
adafruit/Adafruit VL53L1X@^3.1.0
arduino-libraries/ArduinoBLE@^1.3.4
cmaglie/FlashStorage@^1.0.0
https://github.com/sdetweil/ArduinoBleOTA
jandrassy/ArduinoOTA@^1.0.9
bakercp/CRC32@^2.0.0
rlogiacco/CircularBuffer@^1.3.3
;
;
; DOIT esp32 devkit-v1 with and without OTA and Nimble
;
; base Arduino esp32 BLE
;
[env:esp32doit-devkit-v1]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
build_flags = -D ESP32
lib_deps =
arduino-libraries/Arduino_JSON@^0.2.0
adafruit/Adafruit VL53L1X@^3.1.0
;
; wth NimBLE lib
;
[env:esp32doit-devkit-v1-nimble]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
build_flags = -D ESP32 -D USE_NIMBLE
lib_deps =
arduino-libraries/Arduino_JSON@^0.2.0
adafruit/Adafruit VL53L1X@^3.1.0
h2zero/NimBLE-Arduino
;
; base with OTA
;
[env:esp32doit-devkit-v1-ota]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
build_flags = -DESP32
-DUSE_ESP32_BLE_LIB
-DUSE_OTA
lib_deps =
arduino-libraries/Arduino_JSON@^0.2.0
adafruit/Adafruit VL53L1X@^3.1.0
https://github.com/sdetweil/ArduinoBleOTA
jandrassy/ArduinoOTA@^1.0.9
bakercp/CRC32@^2.0.0
rlogiacco/CircularBuffer@^1.3.3
upload_port= //dev/cu.usbserial-0001
;
; OTA AND Nimble
;
[env:esp32doit-devkit-v1-ota-nimble]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
build_flags = -DESP32
-DUSE_NIM_BLE_ARDUINO_LIB
-DUSE_OTA
-DUSE_NIMBLE
lib_deps =
arduino-libraries/Arduino_JSON@^0.2.0
adafruit/Adafruit VL53L1X@^3.1.0
https://github.com/sdetweil/ArduinoBleOTA
jandrassy/ArduinoOTA@^1.0.9
bakercp/CRC32@^2.0.0
rlogiacco/CircularBuffer@^1.3.3
;
;
; different ESP32 board
;
;
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
build_flags = -D ESP32
lib_deps =
arduino-libraries/Arduino_JSON@^0.2.0
adafruit/Adafruit VL53L1X@^3.1.0
;
;
; devkit4 esp32
;
;
[env:esp32-devkit-v4]
platform = espressif32
board = az-delivery-devkit-v4
framework = arduino
build_flags = -DESP32
lib_deps =
arduino-libraries/Arduino_JSON@^0.2.0
adafruit/Adafruit VL53L1X@^3.1.0
upload_port= //dev/cu.usbserial-0001
;
; devkit-v4 with esp32 ble ota
;
[env:esp32-devkit-v4-ota]
platform = espressif32
board = az-delivery-devkit-v4
framework = arduino
build_flags = -DESP32
-DUSE_ESP32_BLE_LIB
-DUSE_OTA
lib_deps =
arduino-libraries/Arduino_JSON@^0.2.0
adafruit/Adafruit VL53L1X@^3.1.0
https://github.com/sdetweil/ArduinoBleOTA
jandrassy/ArduinoOTA@^1.0.9
bakercp/CRC32@^2.0.0
rlogiacco/CircularBuffer@^1.3.3
upload_port= //dev/cu.usbserial-0001
;
; devkit-v4 with esp32 ble ota
;
[env:esp32-devkit-v4-ota-nimble]
platform = espressif32
board = az-delivery-devkit-v4
framework = arduino
build_flags = -DESP32
-DUSE_NIM_BLE_ARDUINO_LIB
-DUSE_OTA
-DUSE_NIMBLE
lib_deps =
arduino-libraries/Arduino_JSON@^0.2.0
adafruit/Adafruit VL53L1X@^3.1.0
https://github.com/sdetweil/ArduinoBleOTA
jandrassy/ArduinoOTA@^1.0.9
bakercp/CRC32@^2.0.0
rlogiacco/CircularBuffer@^1.3.3
upload_port= //dev/cu.usbserial-0001
and the attached source file (which just has all my includes) and dummy setup and loop
init.txt
create a project
add the init.txt as init.cpp in the src folder
then pio run in the project... the nano-iot 33 -ota fails, trying to compile Nimble??? but its not used by any file that I can find
this uses my updated ArduinoBleOTA fork. once I get thru test I'll submit a PR.
adds a new otaClass
and adds a new method (in otaClass, otaClassNimble, and otaClassEsp32. I provide a server, and u give back the service object
only need to the 1st two environments, but I wanted to be complete..
I am porting your sender code to my app.. javascript(ionic/vue)
but when I try to send the begin sequence 0x10 plus data length
I get an error
⚡️ [log] - connecting for F2195DF1-3329-F489-6E77-E917B966BD9B
To Native Cordova -> BluetoothLePlugin ⚡️ [log] - post connect device info ={"name":"b0:a7:32:81:93:e6","address":"F2195DF1-3329-F489-6E77-E917B966BD9B","status":"connected"}
discover BluetoothLePlugin1117210597 ["options": [{
address = "F2195DF1-3329-F489-6E77-E917B966BD9B";
clearCache = 1;
}]]
⚡️ [log] - discover results={"status":"discovered","services":[{"characteristics":[{"descriptors":[],"properties":{"write":true},"uuid":"9A61"},{"descriptors":[],"properties":{"write":true},"uuid":"9A62"},{"descriptors":[],"properties":{"write":true,"read":true},"uuid":"9AFF"},{"descriptors":[{"uuid":"2902"}],"properties":{"notify":true,"read":true},"uuid":"2A05"},{"descriptors":[],"properties":{"read":true},"uuid":"9A63"},{"descriptors":[],"properties":{"write":true},"uuid":"9A64"}],"uuid":"00000001-27B9-42F0-82AA-2E951747BBF9"},{"characteristics":[{"descriptors":[],"properties":{"write":true},"uuid":"9A61"},{"descriptors":[],"properties":{"write":true},"uuid":"9A62"},{"descriptors":[],"properties":{"write":true,"read":true},"uuid":"9AFF"},{"descriptors":[{"uuid":"2902"}],"properties":{"notify":true,"read":true},"uuid":"2A05"},{"descriptors":[],"properties":{"read":true},"uuid":"9A63"},{"descriptors":[],"properties":{"write":true},"uuid":"9A64"}],"uuid":"00000011-27B9-42F0-82AA-2E951747BBF9"},
// the ota characteristics...
{"characteristics":[
{"descriptors":[],"properties":{"writeWithoutResponse":true},"uuid":"15C1564C-36C5-11ED-ADC1-A3D6CF5CC2A4"},
the device RX characteristic...
{"descriptors":[{"uuid":"2902"}],"properties":{"notify":true,"read":true},"uuid":"15C156E2-36C5-11ED-ADC2-7396D4FD413A"},{"descriptors":[],"properties":{"read":true},"uuid":"15C1576E-36C5-11ED-ADC3-8799895DE51E"},{"descriptors":[],"properties":{"read":true},"uuid":"15C15886-36C5-11ED-ADC5-1BC0D0A6069D"},{"descriptors":[],"properties":{"read":true},"uuid":"15C157FA-36C5-11ED-ADC4-579C60267B47"},{"descriptors":[],"properties":{"read":true},"uuid":"15C1591C-36C5-11ED-ADC6-DBE9603DBF19"}],"uuid":"15C155CA-36C5-11ED-ADC0-9741D6A72F04"}],"name":"b0:a7:32:81:93:e6","address":"F2195DF1-3329-F489-6E77-E917B966BD9B"}
⚡️ [log] - starting OTA Service
writing my characteristic to enable the OTA service (sets the enabled value)
To Native Cordova -> BluetoothLePlugin write BluetoothLePlugin1117210598 ["options": [{
address = "F2195DF1-3329-F489-6E77-E917B966BD9B";
characteristic = 9A64;
service = "00000001-27B9-42F0-82AA-2E951747BBF9";
value = "MQ==";
}]]
⚡️ [log] - write rc={"status":"written","characteristic":"9A64","name":"b0:a7:32:81:93:e6","service":"00000001-27B9-42F0-82AA-2E951747BBF9","address":"F2195DF1-3329-F489-6E77-E917B966BD9B"}
To Native Cordova -> BluetoothLePlugin close BluetoothLePlugin1117210599 ⚡️ [log] - start ota after write
["options": [{
address = "F2195DF1-3329-F489-6E77-E917B966BD9B";
}]]
To Native Cordova -> BluetoothLePlugin connect BluetoothLePlugin1117210600 ⚡️ [log] - close rc={"name":"b0:a7:32:81:93:e6","address":"F2195DF1-3329-F489-6E77-E917B966BD9B","status":"closed"}
["options": [{
address = "F2195DF1-3329-F489-6E77-E917B966BD9B";
}]]
device forces disconnect
⚡️ [log] - post connect device info ={"name":"b0:a7:32:81:93:e6","address":"F2195DF1-3329-F489-6E77-E917B966BD9B","status":"connected"}
To Native Cordova -> BluetoothLePlugin services BluetoothLePlugin1117210601 ["options": [{
address = "F2195DF1-3329-F489-6E77-E917B966BD9B";
services = (
"15c155ca-36c5-11ed-adc0-9741d6a72f04"
);
}]]
⚡️ [log] - startOTA after reconnect, services={"status":"services","services":["00000001-27B9-42F0-82AA-2E951747BBF9","00000011-27B9-42F0-82AA-2E951747BBF9","15C155CA-36C5-11ED-ADC0-9741D6A72F04"],"name":"b0:a7:32:81:93:e6","address":"F2195DF1-3329-F489-6E77-E917B966BD9B"}
// read the services.. OTA is there
⚡️ [log] - calling discover after OTA started
⚡️ [log] - subscribing to the TX characteristic
⚡️ [log] - subscribe rc={}
// now send the begin sequence
⚡️ [log] - starting transfer of 658448 bytes // firmware size
⚡️ [log] - build begin data
------edited, had data in big endian, now in little endian
------if I send this data to the device with NnrfConnect I get back an ok response, with the two buffer sizes
⚡️ [log] - begin data to be written=10100c0a00
To Native Cordova -> BluetoothLePlugin write BluetoothLePlugin761073956
⚡️ characteristic = "15c1564c-36c5-11ed-adc1-a3d6cf5cc2a4";
service = "15c155ca-36c5-11ed-adc0-9741d6a72f04";
value = "EBAMCgA=";
}]]
⚡️ [log] - len =5
⚡️ [log] - send data error ={"error":"write","message":"Error Domain=CBATTErrorDomain Code=3 \"Writing is not permitted.\" UserInfo={NSLocalizedDescription=Writing is not permitted.}","characteristic":"15C1564C-36C5-11ED-ADC1-A3D6CF5CC2A4","name":"b0:a7:32:81:93:e6","service":"15C155CA-36C5-11ED-ADC0-9741D6A72F04","address":"F2195DF1-3329-F489-6E77-E917B966BD9B"}
⚡️ [log] - post connect device info ={"name":"b0:a7:32:81:93:e6","address":"F2195DF1-3329-F489-6E77-E917B966BD9B","status":"disconnected"}
To Native Cordova -> BluetoothLePlugin services BluetoothLePlugin761073957 ["options": [{
address = "F2195DF1-3329-F489-6E77-E917B966BD9B";
services = (
"15c155ca-36c5-11ed-adc0-9741d6a72f04"
);
}]]
I assume u don't see this in your flutter app..
and
the python uploader works when in this state..
I write json data and text numbers without problem.. just no binary data
example does give clear guidance on how to add secondary service?
I have a project i am working on and want to add the ble ota method you have built but i dont see how to add the second service.
Would be nice to see some expanded examples in the "multi service" area.
Now ArduinoBLE supports esp32:
https://github.com/arduino-libraries/ArduinoBLE/releases/tag/1.3.2
Consider aligment
can u provide any text of what is being accomplished?
I have the service swapped in now and can see its characteristics...
the bash script is looking two dirs up from tools folder, but on my mac under platformio its 4 levels up
and its looking at some json objects..
how is the hw/sw info used in the ESP on begin() compared to what on the sender app side?
what is the HW 'name' and value supposed to represent?
when platformio uploads the new code it reports
ESP32-D0WD-V3 (revision v3.0)
I have to port all the uploader to my IOS config app.
get info on images from some server api. then get the selected one (how tbd) and then send to the connected device
I don't see an InternalStorageESP.h, just trying to build using examples/basic/main.ino
In file included from /Users/sam/Documents/Arduino/libraries/ArduinoBleOTA-main/src/ArduinoBleOtaClass.h:2,
from /Users/sam/Documents/Arduino/libraries/ArduinoBleOTA-main/src/ArduinoBleOTA.h:6,
from /Users/sam/Documents/Arduino/test_ota/test_ota.ino:1:
/Users/sam/Documents/Arduino/libraries/ArduinoBleOTA-main/src/BleOtaStorage.h:13:10: fatal error: InternalStorageESP.h: No such file or directory
#include "InternalStorageESP.h"
^~~~~~~~~~~~~~~~~~~~~~
Currently used bluezero
that support only linux.
Proposed to use cross platform bleak
library:
https://github.com/hbldh/bleak
I am looking for a working crc for nodejs app.
the one I have produces different results with running crc like python code and one time like flutter app.
and different than bleota code version
Error: Could not find the package with 'vovagorodok/ArduinoBleOTA' requirements for your system 'darwin_arm64'
my platform.ini def
[env:esp32doit-devkit-v1-ota]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
lib_deps =
arduino-libraries/Arduino_JSON@^0.2.0
adafruit/Adafruit VL53L1X@^3.1.0
vovagorodok/ArduinoBleOTA
other libs worked ok..
I'd like to see a call back function to know when the update is started and finished. The project i've been implementing this into has a serial based screen. id like to be able to call up the updating screen when the device is updating and call back to the normal screen when complete.
I have a crash when using Nimble instead of the normal ESP32 libs..
h2zero/NimBLE-Arduino#530
basically I need to change the UUID of my service.
with ArduinoBLE I had to destroy the whole setup and rebuild to do that
that works with ESP32 BLE.
doesn't work with NIMBLE
but I also need OTA on the ESP32-DevKitv1.
have u tried to build this with the base esp32 lib?
Upload to existing file esp32 completed successfully.
Added the led blinking program to the main file and then some errors in uploading the firmware.bin file to the esp32.
Incorrect firmware size error.
How to resolve this error
due to a bluetooth bug on IOS (not rescanning for changed services),
I have to implement your service at hardware startup.. BUT, I want it disabled until I explicitly enabled it
so the the receive and the hw/sw info characteristics check a flag and silently returns, with no activity if not enabled
so I think this needs a new begin parameter to use this feature.. default is false.
if we have to add a new parameter, can we make it a bit field, 0x80 is requires_enable
and use another to advise auto advertising or not? (default yes) I need it to be no..I'll handle that
that is to support #20 0x40 is no_auto_advertise
so 0x00 means default behavior, not requires_enable, auto_advertise
so I have swapped in your service, and I can scan and find it, and connect and I can use the hw/sw chars to read from the service
so it is active
disconnect and I still see it in multiple scanners with your service id
but the uploader cannot see it
I added a print after the scan
dbus.Array([dbus.String('21010001-27b9-42f0-82aa-2e951747bbf9')], signature=dbus.Signature('s'), variant_level=1) -- second device
dbus.Array([dbus.String('11050001-27b9-42f0-82aa-2e951747bbf9')], signature=dbus.Signature('s'), variant_level=1) -- original uuid
dbus.Array([dbus.String('0000fe50-0000-1000-8000-00805f9b34fb')], signature=dbus.Signature('s'), variant_level=1)
dbus.Array([], signature=dbus.Signature('s'), variant_level=1)
dbus.Array([dbus.String('0000fe9a-0000-1000-8000-00805f9b34fb')], signature=dbus.Signature('s'), variant_level=1)
dbus.Array([dbus.String('00000000-27b9-42f0-82aa-2e951747bbf9')], signature=dbus.Signature('s'), variant_level=1)--- this is the app
dbus.Array([], signature=dbus.Signature('s'), variant_level=1)
dbus.Array([], signature=dbus.Signature('s'), variant_level=1)
dbus.Array([dbus.String('0000fe50-0000-1000-8000-00805f9b34fb')], signature=dbus.Signature('s'), variant_level=1)
dbus.Array([dbus.String('2e938fd0-6a61-11ed-a1eb-0242ac120002')], signature=dbus.Signature('s'), variant_level=1)
dbus.Array([], signature=dbus.Signature('s'), variant_level=1)
dbus.Array([dbus.String('0000110a-0000-1000-8000-00805f9b34fb'), dbus.String('0000110c-0000-1000-8000-00805f9b34fb'), dbus.String('0000110e-0000-1000-8000-00805f9b34fb'), dbus.String('00001200-0000-1000-8000-00805f9b34fb')], signature=dbus.Signature('s'), variant_level=1)
dbus.Array([], signature=dbus.Signature('s'), variant_level=1)
Prepare more clear understanding and code for MTU/ATTR sizes.
Currently doesn't work for nano_33_iot.
so, I want to disable upload until a later time.
I call begin(.... enableUpload:false)
later I want to enable it
so I call
ArduinoBleOTA.enableUpload();
but my BEGIN transmission get a status 0x06 back,
#define UPLOAD_DISABLED 0x06
if I change the begin(.... enableUpload:true)
then my BEGIN transmission is accepted
am I using it the right way?
in my case I know when to advertise, , you should leave that up to the user.
this sort of goes with the MTU issue, #19
Topic: vovagorodok/ble_ota_app#16
i am working thru porting upload to my app
firmware image is 658448 bytes
sending 512 byte blocks, is 1287 sends
I added debugging on entrance/exit to onData and handleBegin and handlePackage
device begin to end.. 80 times receiving data, 7 times says sending ok from handlePackage, 10 512/blocks between OK's
recevied data length=5
data=16
sending begin response
Begin upload, size=658448
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
sending ok for package ------------------------
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
sending ok for package ----------------------
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
sending ok for package -------------------------------
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
sending ok for package --------------------------
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
sending ok for package -------------------------
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
sending ok for package --------------------------
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
sending ok for package ----------------------------
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
recevied data length=512
data=17
received package
length=511
exiting handlePackage
the app loop for send is quite higher priority than the subscribe notice, so the oks flood in at the end...
app
begin sequence
------
⚡️ [log] - starting transfer of 658448 bytes
⚡️ [log] - subscribe info={"status":"subscribed","characteristic":"15C156E2-36C5-11ED-ADC2-7396D4FD413A","name":"b0:a7:32:81:93:e6","service":"15C155CA-36C5-11ED-ADC0-9741D6A72F04","address":"F2195DF1-3329-F489-6E77-E917B966BD9B"}
⚡️ [log] - build begin data
⚡️ [log] - begin data to be written=10100c0a00
⚡️ [log] - number = 0x10
⚡️ [log] - y='�'
⚡️ [log] - len =1
⚡️ [log] - number = 0x10
⚡️ [log] - y='�'
⚡️ [log] - len =2
⚡️ [log] - number = 0x0c
⚡️ [log] - y=''
⚡️ [log] - len =3
To Native Cordova -> BluetoothLePlugin write ⚡️ [log] - number = 0x0a
BluetoothLePlugin620564788 ["options": [{
address = "F2195DF1-3329-F489-6E77-E917B966BD9B";
characteristic = "15c1564c-36c5-11ed-adc1-a3d6cf5cc2a4";
service = "15c155ca-36c5-11ed-adc0-9741d6a72f04";
type = noResponse;
value = "EBAMCgA=";
}]]
⚡️ [log] - y='
'
⚡️ [log] - len =4
⚡️ [log] - number = 0x00
⚡️ [log] - y='⚡️ [log] - send begin write rc={"status":"written","value":"EBAMCgA=","characteristic":"15C1564C-36C5-11ED-ADC1-A3D6CF5CC2A4","name":"b0:a7:32:81:93:e6","service":"15C155CA-36C5-11ED-ADC0-9741D6A72F04","address":"F2195DF1-3329-F489-6E77-E917B966BD9B"}
⚡️ [log] - sendbegin waiting
⚡️ [log] - subscribe info={"service":"15C155CA-36C5-11ED-ADC0-9741D6A72F04","address":"F2195DF1-3329-F489-6E77-E917B966BD9B","status":"subscribedResult","characteristicIndex":0,"serviceIndex":0,"value":"AAACAAD2EwAA","characteristic":"15C156E2-36C5-11ED-ADC2-7396D4FD413A","name":"b0:a7:32:81:93:e6"}
⚡️ [log] - in handle response
⚡️ [log] - resolving waitpromise
⚡️ [log] - data=[0,0,2,0,0,246,19,0,0]
⚡️ [log] - subscribe result data=0,0,2,0,0,246,19,0,0 array type=true
⚡️ [log] - in handleBegin
⚡️ [log] - getting sizes from device
⚡️ [log] - data length=9 offset=1
⚡️ [log] - data=0200
To Native Cordova -> BluetoothLePlugin mtu BluetoothLePlugin620564789 ⚡️ [log] - data length=9 offset=5
["options": [{
address = "F2195DF1-3329-F489-6E77-E917B966BD9B";
mtu = 516;
}]]
⚡️ [log] - data=2461900
⚡️ [log] - mtu size=516
⚡️ [log] - mtu rc={}
⚡️ [log] - entering sendPackages
⚡️ [log] - sending package, start=0 end=511
--- last 512 block
[log] - length of data =512
⚡️ [log] - sendData write rc=**{"status":"written","value"**:"EcAgAIgEiBjAIADgCADcaqgCSAqCJBFWGAGtAjgSSBMyIxW4NOADAC0KHfBIEr0DyITgCAAWGv4G+/8ANoEASBIMCyCiIEi04AQAVjoGrQJIEogUQiQVuAjgBABWKgW9ChzMS6FIAiVC9iwIkX2YNzkBHIiCQQfAIACCoNw5ITc5AoKg2EuxrQSCUQzAIACIBIgYwCAA4AgA3FqoAkgKgiQR3AitAjgSSBMyIxW4JOADAC0KHfBIEr0DwiQJ4AgAFgr+xvr/AAA2QQAwIPUyoO8wIsAMCDKhBSA4gy0DHfA2QQAiAhgciQwIJ7kCgqACDEIgKCAd8AAgSAMbIgACQDBJAzAgkQAzodbzCzAw9TAiICAwYCAzEDDzQAATQCAgkSBJEyBIAyLCHzAywDBIExAgACBJAxaiBwfiCBfiGSfiOgYjADLJ8EkDWRNpI3kzIGFBEIBABvf/Ms3wSQNZE2kjeTMyxfQ4AzLD4IkDmROpI7kzIKJBIIBABu7/EIBA0s3wCQ0ZHSktOT0ywfQ4A9LNEDLD0EkDWRNpI3kziUOZU6ljuXPwgEAg40EwgEDG4P8AABCAQCBIAwASQAwSACKhIEkTECAADAIN8AwSDfAAAPAiERsiMEgD9+IKCzPwIhH3YvcwMDQAE0AAMhEwIoEgIPQgSRMwAwMsAjAywDA=","characteristic":"15C1564C-36C5-11ED-ADC1-A3D6CF5CC2A4","name":"b0:a7:32:81:93:e6","service":"15C155CA-36C5-11ED-ADC0-9741D6A72F04","address":"F2195DF1-3329-F489-6E77-E917B966BD9B"}
⚡️ [log] - progress bar=0
---- last block , partial .. devices doesn't indicate received
⚡️ [log] - sending package, start=658168 end=658448
To Native Cordova -> BluetoothLePlugin write BluetoothLePlugin620566078 ⚡️ [log] - data length = 280 data is an array true typeof=object
["options": [{
address = "F2195DF1-3329-F489-6E77-E917B966BD9B";
characteristic = "15c1564c-36c5-11ed-adc1-a3d6cf5cc2a4";
service = "15c155ca-36c5-11ed-adc0-9741d6a72f04";
type = noResponse;
value = "EUgTECAADCIN8AAAADYhAGFPmlDmA00AYCUQOyIg5hMQIABF7f8NBFDmExAgAB3wADYhACDjEx3wOAIw5/M4EjAQEzgiMBETODIwBBM4QjAMEzhSMCATOGIwIRM4cjAiEziCMCMTOJIw6vM4ojDr8ziyMOzzDfAAAHA+4zkCMBADORIwEQM5IjAEAzkyMAwDOUIwIAM5UjAhAzliMCIDOXIwIwM5gqA+4zmSsD7jOaLAPuM5sg3wAAA2IQAMAzDkYRAgACAjICDkExAgAC0DHfA2IQAMBEDkYRAgACA0ICAzMDDkExAgAC0EHfAAAAAAAAAAAAAAAABMEhHsbNRLn+xwBMqzuTTfEUXO5T4t1M7JNuQaQsCpnng=";
}]]
⚡️ [log] - length of data =281
⚡️ [log] - sendData write rc={"status":"written","value":"EUgTECAADCIN8AAAADYhAGFPmlDmA00AYCUQOyIg5hMQIABF7f8NBFDmExAgAB3wADYhACDjEx3wOAIw5/M4EjAQEzgiMBETODIwBBM4QjAMEzhSMCATOGIwIRM4cjAiEziCMCMTOJIw6vM4ojDr8ziyMOzzDfAAAHA+4zkCMBADORIwEQM5IjAEAzkyMAwDOUIwIAM5UjAhAzliMCIDOXIwIwM5gqA+4zmSsD7jOaLAPuM5sg3wAAA2IQAMAzDkYRAgACAjICDkExAgAC0DHfA2IQAMBEDkYRAgACA0ICAzMDDkExAgAC0EHfAAAAAAAAAAAAAAAABMEhHsbNRLn+xwBMqzuTTfEUXO5T4t1M7JNuQaQsCpnng=","characteristic":"15C1564C-36C5-11ED-ADC1-A3D6CF5CC2A4","name":"b0:a7:32:81:93:e6","service":"15C155CA-36C5-11ED-ADC0-9741D6A72F04","address":"F2195DF1-3329-F489-6E77-E917B966BD9B"}
⚡️ [log] - progress bar=1
---- sendPackages loop ends
⚡️ [log] - exiting send packages loop
--- sending end (crc not calculated yet, trying to find matching lib for Vue
⚡️ [log] - sending end
To Native Cordova -> BluetoothLePlugin write BluetoothLePlugin620566079 ["options": [{
address = "F2195DF1-3329-F489-6E77-E917B966BD9B";
characteristic = "15c1564c-36c5-11ed-adc1-a3d6cf5cc2a4";
service = "15c155ca-36c5-11ed-adc0-9741d6a72f04";
type = noResponse;
value = "MTIxMDBjMGEwMA==";
}]]
⚡️ [log] - length of data =10
⚡️ [log] - sendData write rc={"status":"written","value":"MTIxMDBjMGEwMA==","characteristic":"15C1564C-36C5-11ED-ADC1-A3D6CF5CC2A4","name":"b0:a7:32:81:93:e6","service":"15C155CA-36C5-11ED-ADC0-9741D6A72F04","address":"F2195DF1-3329-F489-6E77-E917B966BD9B"}
⚡️ [log] - subscribe info={"service":"15C155CA-36C5-11ED-ADC0-9741D6A72F04","address":"F2195DF1-3329-F489-6E77-E917B966BD9B","status":"subscribedResult","characteristicIndex":0,"serviceIndex":0,"value":"AA==","characteristic":"15C156E2-36C5-11ED-ADC2-7396D4FD413A","name":"b0:a7:32:81:93:e6"}
---- done sending
⚡️ [log] - in handle response
⚡️ [log] - resolving waitpromise
⚡️ [log] - data=[0]
⚡️ [log] - subscribe result data=0 array type=true
⚡️ [log] - subscribe info={"service":"15C155CA-36C5-11ED-ADC0-9741D6A72F04","address":"F2195DF1-3329-F489-6E77-E917B966BD9B","status":"subscribedResult","characteristicIndex":0,"serviceIndex":0,"value":"AA==","characteristic":"15C156E2-36C5-11ED-ADC2-7396D4FD413A","name":"b0:a7:32:81:93:e6"}
⚡️ [log] - in handle response
⚡️ [log] - data=[0]
⚡️ [log] - subscribe result data=0 array type=true
⚡️ [log] - have received ok for complete
⚡️ [log] - subscribe info={"service":"15C155CA-36C5-11ED-ADC0-9741D6A72F04","address":"F2195DF1-3329-F489-6E77-E917B966BD9B","status":"subscribedResult","characteristicIndex":0,"serviceIndex":0,"value":"AA==","characteristic":"15C156E2-36C5-11ED-ADC2-7396D4FD413A","name":"b0:a7:32:81:93:e6"}
⚡️ [log] - in handle response
⚡️ [log] - data=[0]
⚡️ [log] - subscribe result data=0 array type=true
⚡️ [log] - have received ok for complete
⚡️ [log] - subscribe info={"service":"15C155CA-36C5-11ED-ADC0-9741D6A72F04","address":"F2195DF1-3329-F489-6E77-E917B966BD9B","status":"subscribedResult","characteristicIndex":0,"serviceIndex":0,"value":"AA==","characteristic":"15C156E2-36C5-11ED-ADC2-7396D4FD413A","name":"b0:a7:32:81:93:e6"}
⚡️ [log] - in handle response
⚡️ [log] - data=[0]
⚡️ [log] - subscribe result data=0 array type=true
⚡️ [log] - have received ok for complete
⚡️ [log] - subscribe info={"service":"15C155CA-36C5-11ED-ADC0-9741D6A72F04","address":"F2195DF1-3329-F489-6E77-E917B966BD9B","status":"subscribedResult","characteristicIndex":0,"serviceIndex":0,"value":"AA==","characteristic":"15C156E2-36C5-11ED-ADC2-7396D4FD413A","name":"b0:a7:32:81:93:e6"}
⚡️ [log] - in handle response
⚡️ [log] - data=[0]
⚡️ [log] - subscribe result data=0 array type=true
⚡️ [log] - have received ok for complete
same device code works ok w python uploader
the python uploader doesn't sleep in its send loop either
with open(path, 'rb') as f:
while True:
data = f.read(attr_size - HEAD_BYTES_NUM)
if not data:
break
rx_char.value = int_to_u8_bytes(PACKAGE) + list(data)
if current_buffer_len + len(data) > buffer_size:
if not handleResponse(tx_char.value):
return False
current_buffer_len = 0
current_buffer_len += len(data)
uploaded_len += len(data)
crc = zlib.crc32(data, crc)
print(f"Uploaded: {uploaded_len}/{firmware_len}")
what is security pin and how can we set our own i tried ota_pin as pin
and tried setpin function to set both didnot worked for me
Hi, I have little experience programming on Arduino.
I'm trying to implement firmware update via OTA on nRF52840 custom board (Arduino Nano 33 BLE).
The ArduinoBleOTA library seems very suitable to me.
But after importing it, I get a compilation error, namely:
fair mistake as InternalStorage is under #ifdef card type dependent.
I ask you where I can act to use and compile the library on this hardware, or if I have to implement
an InternalStoragexxxx.cpp and .h interface or what do I need to implement to achieve the goal.
Thanks for any help on how to proceed.
Paolo S.
More about BLE Security:
https://www.bluetooth.com/blog/bluetooth-pairing-part-1-pairing-feature-exchange/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.