www.beck-ipc.com

BtLib V2.02 - Extended Data Mode (EDM)


EDM

The bluetooth module supports the so called extended data mode (EDM), which allows to transmit AT commands and payload data over the serial line at the same time by using a special protocol.Also it allows to send payload data to a special peer device instead of just brodcasting it when connecting to more than one device.

  • btEdmInit
  • btEdmDeinit
  • btEdmSendData
  • btEdmRecvData
  • btEdmPeekData
  • btEdmPurgeInputData
  • btEdmFlushOutputData


  • int btEdmInit(int taskPrio, unsigned nConns, unsigned dataBufSize, BtEdmConnCb connCb)

    Initialises the extended data mode

    Parameters

    taskPrio

    Priority of reception task

    nConns

    Number of connections to be handled (max. 7)

    dataBufSize

    Size of data reception buffer per connection

    connCb

    Callback function that will be called when a connection has been opened or closed (see BtEdmConnCb)

    Return Value

    Returns one of the following

    BT_EXIT_SUCCESS
    On success

    BT_WRONG_PARAM_2_ERROR
    Number of connections too high

    BT_OUT_OF_MEMORY_ERROR
    Memory for reception buffers or task stack could not be allocated

    BT_RESOURCE_ERROR
    Event group, semaphore or task could not be created


    Top
    Index page


    void btEdmDeinit(void)

    De-initialises the extended data mode


    Top
    Index page



    unsigned btEdmSendData(unsigned connHandle, unsigned char const * data, unsigned len)

    Sends data via the extended data mode

    Parameters

    connHandle

    Handle of connection to send on

    data

    Data to be sent

    len

    Number of bytes to be sent

    Return Value

    Number of bytes actually sent


    Top
    Index page


    unsigned btEdmRecvData(unsigned connHandle, unsigned char * data, unsigned len)

    Receives data via the extended data mode

    Parameters

    connHandle

    Handle of connection to receive on

    data

    Buffer to store received data in

    len

    Number of bytes to be received

    Return Value

    Number of bytes actually received


    Top
    Index page


    int btEdmPeekData(unsigned connHandle)

    Returns the first byte from the receive queue - if any - without removing it from the queue

    Parameters

    connHandle

    Handle of connection to peek on

    Return Value

    Returns one of the following

    Received character
    On success

    -1
    If no data is available

    BT_WRONG_PARAM_1_ERROR
    If the connection handle is invalid


    Top
    Index page


    int btEdmPurgeInputData(unsigned connHandle, long timeout)

    Purges all data from the respective connection's receive queue

    Parameters

    connHandle

    Handle of connection to purge input data on

    timeout

    Time in ms to wait for semaphore

    Return Value

    Returns one of the following

    BT_EXIT_SUCCESS
    On success

    BT_WRONG_PARAM_1_ERROR
    If the connection handle is invalid

    BT_TIMEOUT_ERROR
    If the semaphore could not be reserved within the given time


    Top
    Index page


    int btEdmFlushOutputData(unsigned connHandle)

    Flushes output data from the respective connection's send queue

    Parameters

    connHandle

    Handle of connection to flush output data on

    Return Value

    Returns one of the following

    BT_EXIT_SUCCESS
    On success

    BT_WRONG_PARAM_1_ERROR
    If the connection handle is invalid


    Top
    Index page


    End of document