Beispiel #1
0
static void antfs_event_download_data_handle(const antfs_event_return_t * p_event)
{
    if (m_current_file_index == p_event->file_index)
    {
        // Only send data for a file index matching the download request.
        uint8_t * p_buffer;
        // Burst data block size * 8 bytes per burst packet.
        // Offset specified by client.
        const uint32_t offset     = 0;
        // Size of requested block of data.
        uint32_t data_bytes;

        if (m_current_file_index == 0)
        {
            UNUSED_VARIABLE(antfs_input_data_download(m_current_file_index, offset, sizeof(m_directory), (uint8_t*)&m_directory));
        }
        else if (m_current_file_index == ANTFS_FILE_INDEX_OTA_UPDATE_INFO)
        {
            antfs_ota_update_information_file_get(&data_bytes, &p_buffer);

            // @note: Suppress return value as no use case for handling it exists.
            UNUSED_VARIABLE(antfs_input_data_download(m_current_file_index, offset, data_bytes, p_buffer));
        }
    }
}
Beispiel #2
0
/**@brief Function for processing ANTFS download data event.
 * 
 * @param[in] p_event The event extracted from the queue to be processed.
 */
static void event_download_data_handle(const antfs_event_return_t * p_event)
{
    // This example does not interact with a file system, and it does not account for latency for 
    // reading or writing a file from EEPROM/flash. Prefetching the file might be useful to feed the 
    // data to download in order to maintain the burst timing.           
    if (m_file_index == p_event->file_index)     
    {
        // Only send data for a file index matching the download request.

        // Burst data block size * 8 bytes per burst packet.
        uint8_t buffer[ANTFS_BURST_BLOCK_SIZE * 8]; 
        // Offset specified by client.        
        const uint32_t offset     = p_event->offset;    
        // Size of requested block of data.        
        const uint32_t data_bytes = p_event->bytes; 

        // Read block of data from memory.
        mem_file_read(m_file_index, offset, buffer, data_bytes);    
                
        // @note: Suppress return value as no use case for handling it exists.
        UNUSED_VARIABLE(antfs_input_data_download(m_file_index, offset, data_bytes, buffer));
    }
}