Giter VIP home page Giter VIP logo

Comments (8)

xandros6 avatar xandros6 commented on May 28, 2024 3

Finally, I found a problem.
The problem is the MTU that for Android si as default to 23, so the maximum bytes arrived is 20.
This is the problem for the session creation (41 bytes are needed).
My workaround is to request a specific MTU (512), changing line 40 on transport_ble.dart:

await peripheral.connect(requestMtu: 512);

Now all works!

from esp_provisioning.

iotechbugs avatar iotechbugs commented on May 28, 2024 1

After selecting the following error is coming. Mobile I use is ONEPLUS 6 PLUS, VS code, OS is MAC

Which version of flutter you are using. I am able to scan BLE devices only once, If I select provisioning second time no device is visible.

Adding logs for your reference.

esp_prov.log

from esp_provisioning.

tuanpmt avatar tuanpmt commented on May 28, 2024

hi @iotechbugs

Please log at this line: https://github.com/sunshine-tech/esp_provisioning/blob/0cc3d09ec329a25732d95a113c0ef0a869c83bb0/example/lib/ble_screen/ble_bloc.dart#L25 to see what's happen

from esp_provisioning.

xandros6 avatar xandros6 commented on May 28, 2024

The same problem from me. I'm comparing your implementation with ESP-IDF Android one, seem sone problem on encoding securitySession request.

The ESP32 logs this:

LE connection complete. handle=0 role=1 paddrtype=1 addr=77.77.e1.cd.f1.89 local_rpa=0.0.0.0.0.0 peer_rpa=0.0.0.0.0.0 itvl=39 latency=0 spvn_tmo=2000 mca=5
D (207171) protocomm_nimble: Inside BLE connect w/ conn_id - 0
ble_hs_hci_cmd_send: ogf=0x08 ocf=0x0016 len=2
0x16 0x20 0x02 0x00 0x00 
Command Status: status=0 cmd_pkts=5 ocf=0x16 ogf=0x8
LE Remote Used Features. handle=0 feat=0f 00 00 00 00 00 00 00 
ble_hs_hci_evt_acl_process(): conn_handle=0 pb=2 len=27 data=0x17 0x00 0x04 0x00 0x52 0x06 0x00 0x10 0x01 0x5a 0x25 0xa2 0x01 0x22 0x0a 0x20 0x3e 0xbf 0x36 0x7d 0x1e 0x1a 0x84 0xce 0xb7 0x15 0x04 
rxed att command: write cmd; conn=0 handle=0x0006
D (210511) protocomm_nimble: Write attempt for uuid = 021aff51-0382-4aea-bff4-6b3f1c5adfb4, attr_handle = 6, data_len = 20
D (210531) protocomm_nimble: UUID did not match... 51
D (210531) protocomm_nimble: UUID (0x51) matched with proto-name = prov-session
E (210541) security1: Unable to unpack setup_req
D (210541) protocomm: SEC_EP Req handler returned 258

Checking ESP-IDF source code I think this is the point that goes to error:

static esp_err_t sec1_decrypt(uint32_t session_id,
                              const uint8_t *inbuf, ssize_t inlen,
                              uint8_t *outbuf, ssize_t *outlen)
{
    if (*outlen < inlen) {
        return ESP_ERR_INVALID_ARG;
    }

    if (!cur_session || cur_session->id != session_id) {
        return ESP_ERR_INVALID_STATE;
    }
    *outlen = inlen;
    int ret = mbedtls_aes_crypt_ctr(&cur_session->ctx_aes, inlen, &cur_session->nc_off,
                                    cur_session->rand, cur_session->stb, inbuf, outbuf);
    if (ret != 0) {
        ESP_LOGE(TAG, "Failed at mbedtls_aes_crypt_ctr with error code : %d", ret);
        return ESP_FAIL;
    }
    return ESP_OK;
}

ESP_ERR_INVALID_ARG = 0x102 = 258

I try also with the original ESP-IDF Android App and all is ok.

After selecting the following error is coming. Mobile I use is ONEPLUS 6 PLUS, VS code, OS is MAC

Which version of flutter you are using. I am able to scan BLE devices only once, If I select provisioning second time no device is visible.

Adding logs for your reference.

esp_prov.log

from esp_provisioning.

jerry2501 avatar jerry2501 commented on May 28, 2024

Hi,
This is brilliant library to use.

But I am facing same problem which @iotechbugs was facing earlier.

I also tried to run example app and Wifi screen is not appearing and getting same error as @iotechbugs got earlier.

from esp_provisioning.

jerry2501 avatar jerry2501 commented on May 28, 2024

Please help me out with it !!

from esp_provisioning.

sklimovski avatar sklimovski commented on May 28, 2024

Same issue @iotechbugs faced. Any update?

from esp_provisioning.

MurtuzaSrashtaSoft avatar MurtuzaSrashtaSoft commented on May 28, 2024

same issue

from esp_provisioning.

Related Issues (18)

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.