static void send_binary(esp_mqtt_client_handle_t client) { spi_flash_mmap_handle_t out_handle; const void *binary_address; const esp_partition_t *partition = esp_ota_get_running_partition(); esp_partition_mmap(partition, 0, partition->size, SPI_FLASH_MMAP_DATA, &binary_address, &out_handle); // sending only the configured portion of the partition (if it's less than the partition size) int binary_size = MIN(CONFIG_BROKER_BIN_SIZE_TO_SEND,partition->size); int msg_id = esp_mqtt_client_publish(client, "/topic/binary", binary_address, binary_size, 0, 0); ESP_LOGI(TAG, "binary sent with msg_id=%d", msg_id); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter