Sends a LAPV5 frame to a specified HDLC channel.
NMS_V5_RESULT_T NMS_V5PhSendData ( NMS_GR303_INTERFACE_ID_T interfaceId, NMS_V5_CHANNEL_LOCATION_T channel_loc, DWORD number_bytes, void *lapv_data)
|
Argument |
Description |
|
interfaceId |
Interface ID of a provisioned interface. |
|
channel_loc |
HDLC channel location to which to send data. typedef union _NMS_V5_CHANNEL_LOCATION_T |
|
number_bytes |
Size of LAPV frame in bytes. The maximum number of bytes is 260. |
|
lapv_data |
Pointer to an application buffer containing the LAPV frame to send. |
|
Return value |
Description |
|
NMSV5_SUCCESS |
|
|
NMSV5_INTERNAL_FAILURE |
Internal failure. Refer to the trace log for more information. |
|
NMSV5_INVALID_CHANNEL |
Specified HDLC channel is not provisioned on this channel. |
|
NMSV5_INVALID_INTERFACE_ID |
Specified interface is not provisioned. |
|
NMSV5_INVALID_PARMS |
Invalid function arguments. |
|
NMSV5_INVALID_STATE |
Specified interface is not started. |
|
NMSV5_NOT_INITIALIZED |
NMS V5 library was not initialized with NMS_V5Initialize. |
|
Event |
Description |
|
NMSV5_EVENT_TX_ERROR |
Internal HDLC transmit error occurred (no buffer is returned). Returned by a NMS_V5PhSendData call. |
|
NMSV5_EVENT_TX_FIFO_UNDERRUN |
HDLC transmit FIFO underrun. No buffer is returned. Not supported for CG 6100C or CG 6500C boards. |
|
NMSV5_EVENT_TX_FIFO_OVERRUN |
HDLC transmit FIFO overrun. No buffer is returned. Not supported for CG 6100C or CG 6500C boards. |
|
NMSV5_EVENT_TX_FIFO_QUEUE_FULL |
HDLC transmit send queue is full (no buffer is returned). This error should not occur under normal circumstances. |
NMS_V5PhSendData is asynchronous and returns without waiting for the board to report the result of the send operation. The application must start the interface before it calls NMS_V5PhSendData.
If an error occurs during the transmission, the error is reported to the application by the following application-defined callback:
typedef void( *NMS_V5_CHANNEL_CALLBACK_T )
( NMS_V5_INTERFACE_ID_T interfaceId,
NMS_V5_CHANNEL_LOCATION_T channel_loc,
NMS_V5_CHANNEL_EVENT_T channel_event,
void *databuffer,
DWORD datasize);
To return error information, the NMS V5 library invokes an application-defined callback (channel_callback) and specifies the type of transmit error in the channel_event field. When the NMS V5 library returns a transmission error, it does not indicate the send request with which the error is associated.
Note: Results of send operations are not reported on CG 6100C boards.
void SendData(BYTE *FrameBuffer, DWORD NumberBytes )
{
NMS_V5_RESULT_T NmsResult;
DWORD InterfaceId;
NMS_V5_CHANNEL_LOCATION_T ChannelLocation;
printf("SendData:\n");
/* Get parameters */
promptdw_nodft("Enter interfaceId", &InterfaceId);
printf("Enter channel location:\n");
GetChannelLocationNMS( &ChannelLocation );
NmsResult = NMS_V5PhSendData( InterfaceId,
ChannelLocation,
NumberBytes,
FrameBuffer );
printf ("PhSendData: Result=%s\n",PRINT_RESULT(NmsResult));
}