Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

size about esp_blufi_send_custom_data (IDFGH-14269) #15062

Open
3 tasks done
nzomkxia opened this issue Dec 19, 2024 · 0 comments
Open
3 tasks done

size about esp_blufi_send_custom_data (IDFGH-14269) #15062

nzomkxia opened this issue Dec 19, 2024 · 0 comments
Assignees
Labels
Status: Opened Issue is new

Comments

@nzomkxia
Copy link

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

General issue report

I am currently using the BLUFI API from ESP-IDF to transfer file fragments from the device to the app. I’ve tried setting the fragment size to 100 bytes or 512 bytes, then read the file contents in a loop and send them using the esp_blufi_send_custom_data interface. However, once the loop count exceeds 100 iterations, the esp_blufi_send_custom_data call becomes stuck and the transmission cannot be completed. Do you have any suggested solutions?

int count = 0; 
 while ((n = fread(buf, 1, CHUNK_SIZE, fp)) > 0) {
        count ++;
        int is_last_chunk = (n < CHUNK_SIZE);

        unsigned char send_buf[CHUNK_SIZE + 1];
        send_buf[0] = is_last_chunk ? '2' : '1';
        memcpy(send_buf + 1, buf, n);

        BLUFI_INFO("sending before.....%d", count);   
        esp_err_t err = esp_blufi_send_custom_data(send_buf, n + 1);
        if (err !=  ESP_OK) {
            BLUFI_ERROR("send error, count is %d", count);
            fclose(fp);
            return -1;
        } else {
            BLUFI_INFO("sending.....%d", count);
        }

        if (is_last_chunk) {
            BLUFI_INFO("sending done");
            break;
        }
    }
@espressif-bot espressif-bot added the Status: Opened Issue is new label Dec 19, 2024
@github-actions github-actions bot changed the title size about esp_blufi_send_custom_data size about esp_blufi_send_custom_data (IDFGH-14269) Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Opened Issue is new
Projects
None yet
Development

No branches or pull requests

3 participants