Giter Site home page Giter Site logo

Comments (25)

sdetweil avatar sdetweil commented on July 30, 2024
drawing

from arduinobleota.

vovagorodok avatar vovagorodok commented on July 30, 2024

Not sure, but NimBle by default serve only one connected device at the same time. And if someone (some phone) is connected than no advertising at all. Try disconnect from all devices, maybe reboot device and try again. Remember that phone can try to reconnect automatically

from arduinobleota.

sdetweil avatar sdetweil commented on July 30, 2024

yes. once connected. cannot be seen by others.
I was just showing you the service description, which is good. and I can use the read only chars just fine.

so my server is advertising and the service is good

so must be Linux BLE scanner...

the screenshot is from an Android

from arduinobleota.

vovagorodok avatar vovagorodok commented on July 30, 2024

Try to scan bluetooth devices from your OS directly instead uploader.py

from arduinobleota.

sdetweil avatar sdetweil commented on July 30, 2024

i see the same problem on bluetoothctl..

maybe..
my app is connected, status=1
I write a characteristic value
set a future time for switch to upload service
(can't switch while IN the characteristic write callback)
after time switch to upload service

    BLEDevice::stopAdvertising();
    Sprintln("stopping scanner");
    pBLEScanner->stop();
    Sprintln("stopping service");
    activeService[status]->stop();
    Sprintln("deleting service");
    delete activeService[status];
    Sprintln("deleting server");
    delete pServer;
    // remove reference
    pServer = NULL;
    // create a new server object
    pServer = BLEDevice::createServer();
    Sprintln("ble server");
    pServer->setCallbacks(new MyServerCallbacks());

    BLEService *OTAService = ArduinoBleOTA.begin(pServer, InternalStorage, 
                 HW_NAME.c_str(), HW_VER, SW_NAME.c_str(), SW_VER);
    activeService[status] = OTAService;
    Sprintln("restart advertising after resetup");
    pAdvertising->addServiceUUID(OTAService->getUUID());
    pAdvertising->start();

the app did NOT disconnect til eons later
the ESP code did NOT get a disconnect notice
but the server was destroyed and recreated

from arduinobleota.

sdetweil avatar sdetweil commented on July 30, 2024

I used bleak to scan
and while the android scanner app sees your service and characteristics, the bleak scanner sees , the prior UUID service

c8:f0:9e:75:1a:26
C8:F0:9E:75:1A:26
{'path': '/org/bluez/hci0/dev_C8_F0_9E_75_1A_26', 'props': {'Address': 'C8:F0:9E:75:1A:26', 'AddressType': 'public', 'Name': 'c8:f0:9e:75:1a:26', 'Alias': 'c8:f0:9e:75:1a:26', 'Paired': False, 'Trusted': False, 'Blocked': False, 'LegacyPairing': False, 'RSSI': -47, 'Connected': False, 'UUIDs': ['11050001-27b9-42f0-82aa-2e951747bbf9'], 'Adapter': '/org/bluez/hci0', 'TxPower': 9, 'ServicesResolved': False}}
{'uuids': ['11050001-27b9-42f0-82aa-2e951747bbf9'], 'manufacturer_data': {}}
-46
ConfigApp

the app

import asyncio
from bleak import BleakScanner

async def main():
        devices = await BleakScanner.discover()
        for device in devices:
                print(device.name)
                print(device.address)
                print(device.details)
                print(device.metadata)
                print(device.rssi)

asyncio.run(main())

from arduinobleota.

vovagorodok avatar vovagorodok commented on July 30, 2024

Can you show advertising data (not visible services after connect) in android nRF Connect application?

from arduinobleota.

vovagorodok avatar vovagorodok commented on July 30, 2024

Here what I have:
drawing

from arduinobleota.

sdetweil avatar sdetweil commented on July 30, 2024
drawing

but connect and you see something different
drawing

from arduinobleota.

vovagorodok avatar vovagorodok commented on July 30, 2024

In BLE is difference what services device have and what services device advertise.
Device can have unlimited number of services.
But advertising block is limited and you should chose what to advertise:
#10 (comment)
If device doesn't advertise ota service than script will not find him.

You can remove this filter if you want:

if BLE_OTA_SERVICE_UUID.lower() in dev.uuids:

from arduinobleota.

sdetweil avatar sdetweil commented on July 30, 2024

thx, i thought I handled that on the change. I don't see explicit remove (using BLE, see it in Nimble path)

am away til monday

from arduinobleota.

sdetweil avatar sdetweil commented on July 30, 2024

actually, that distinction might make this whole thing easier. setup the three services, and just decide which one to advertise. my app discover handler just needs to know the found advertised service's characteristics to use.(which it currently 'assumes').

from arduinobleota.

vovagorodok avatar vovagorodok commented on July 30, 2024

But remember that it's not safety from security reason. Someone can connect and see that OTA services are available and flash other software.
You can additionally disable uploads and enable only when needed:
https://github.com/vovagorodok/ArduinoBleOTA/blob/main/doc/SECURITY.md#disable-uploads

from arduinobleota.

sdetweil avatar sdetweil commented on July 30, 2024

would only be available when my app says upload. not all the time.

then the box reboots and the service goes away til next time it's needed

I would probably change the UUIDs too

from arduinobleota.

sdetweil avatar sdetweil commented on July 30, 2024

so I couldn't wait til Sunday and had some time. bought another esp32, and redid the code.

works as you said. what's advertised vs services
drawing drawing

from arduinobleota.

sdetweil avatar sdetweil commented on July 30, 2024

successful connect and upload!!!

non-nimble!

from arduinobleota.

sdetweil avatar sdetweil commented on July 30, 2024

only 764b/s, 24 min 17 sec for 1113712 bytes

doesn't reboot?
I have to do that?

from arduinobleota.

sdetweil avatar sdetweil commented on July 30, 2024

so I think I should close this as it was my fault, and fixed. and move to another topic about the finish up. apply/reboot...

from arduinobleota.

vovagorodok avatar vovagorodok commented on July 30, 2024

so I think I should close this as it was my fault, and fixed. and move to another topic about the finish up. apply/reboot...

Perhaps you forgot ArduinoBleOTA.pull(); in loop()

ArduinoBleOTA.pull() is created in order to perform reboot only when nothing in loop and not incidentally reboot when esp32 do something

from arduinobleota.

sdetweil avatar sdetweil commented on July 30, 2024

well, now my system has cached (across boots) the device uuids and the upload service is not visible.
I redid the startup to only have ONE service, and the scan data still has both.

from arduinobleota.

sdetweil avatar sdetweil commented on July 30, 2024

ok, figured out how to clear the cache, now get an upload failure using NimBLE

connected  -- my app
lld_pdu_get_tx_flush_nb HCI packet count mismatch (0, 1)
on disconnect start advertising= 15c155ca-36c5-11ed-adc0-9741d6a72f04 -- my app
disconnected -- my app 

from arduinobleota.

sdetweil avatar sdetweil commented on July 30, 2024

using non-nimble ESP32 BLE.

Installing. Upload time: 0:05:07.499808
Success!
(base) sam@sams:~/ArduinoBleOTA/tools$ rexx rexxtry say "1138176/((5*60)+07)"
3707.41368

from arduinobleota.

sdetweil avatar sdetweil commented on July 30, 2024

to clear cache
stop bluetooth service
delete the cache files (on linux/var/lib/bluetooth) under local device entry/folder)
restart bluetooth service
then can scan
have to do this all the time.

will provide the script (bash) code for this.. (need to test on mac)

from arduinobleota.

sdetweil avatar sdetweil commented on July 30, 2024

got nimble working,
Uploaded: 1139200/1139200
Installing. Upload time: 0:01:23.745954

"(1139200/(1*60+23))"

13725/bytes sec

the Nimble author said not to server->addService()

from arduinobleota.

sdetweil avatar sdetweil commented on July 30, 2024

I think I can close this now

from arduinobleota.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.