BM innovations GmbH BM-USBRTX4 Manual De Usuario
3DJHRI
For receiving a transmitter on a channel it is recommended to first reset the channel, to set its ID to the transceiver ID to
be received if a specific transmitter has to be received and then to start the channel:
be received if a specific transmitter has to be received and then to start the channel:
// Channel to default settings
rtxRX_ChannelReset(Channel);
// Set transmitter ID to be received, not needed if any transmitter has to be received
rtxRX_ChannelSetID(Channel,
ID);
// Start channel
rtxRX_ChannelStart(Channel);
To stop receiving a transmitter on a channel the channel just has to be stopped:
// Stop channel
rtxRX_ChannelStop(Channel);
As soon as at least one channel has been started the state of the transceiver device should be checked periodically
WORD wState;
BYTE bChannel;
BYTE bType;
BYTE bSignalLevel;
BYTE bSequenceCounter;
BYTE bData[rtxMAX_MESSAGE_DATA_BYTES];
DWORD dwID;
// Getting state successful?
if
(rtxRX_GetState(wState))
{
// New data available?
if ((wState & rtxSTATE_RX_DATA) > 0)
{
// Process all new regular data or information
while (rtxRX_GetData(bChannel, bType, bSignalLevel, bSequenceCounter, bData))
{
// Next action dependent on received data/information type
switch
(bType)
{
//
Data
received
case
rtxCH_TYPE_DATA:
// First get current ID of channel if not already read
if
(...)
{
// Get ID of found device
if
(rtxRX_ChannelGetID(bChannel,
dwID))
{
//
Store
ID
...
}
}
//
Process
received
data
...
break;
break;
//
Data
packet
lost
case
rtxCH_TYPE_DATA_LOST:
// Process packet lost information
...
break;
break;
//
Transmitter
lost
case
rtxCH_TYPE_TX_LOST:
// Does not happen when automatic search is set
break;
// Automatic search started again
case
rtxCH_TYPE_TX_SEARCH:
// Process search start information
...
}
}
}
}
else
}
else
// Access to port failed
{
// Hardware error handling
...
}
}
When ending the application the opened port has to be closed and the rtxBlueRobin DLL has to be released:
// DLL already initialized?
if
(rtxDll_IsInitialized())
{
// Device already opened?
if
(rtxDevice_IsOpen())
{
// Stop all channels
rtxRX_ChannelStop(rtxALL_CHANNELS);
// Close COM port
rtxDevice_Close();
}
}
// Unload DLL
rtxDll_DeInitialize();
}
}