Sends a LAPD frame to a specified HDLC channel.
NMS_GR303_RESULT_T NMS_GR303PhSendData ( NMS_GR303_INTERFACE_ID_T interfaceId, NMS_GR303_CHANNEL_LOCATION_T channel_loc, DWORD number_bytes, void *lapd_data)
|
Argument |
Description |
|
interfaceId |
Interface ID of a provisioned interface. |
|
channel_loc |
HDLC channel location to which the NMS GR303 library sends the data. typedef union _NMS_GR303_CHANNEL_LOCATION_T See the Details section for field descriptions. |
|
number_bytes |
Size of the LAPD frame in bytes. The maximum number of bytes is 260. |
|
lapd_data |
Pointer to an application buffer containing the LAPD frame to send. |
|
Return value |
Description |
|
NMSGR303_SUCCESS |
|
|
NMSGR303_INTERNAL_FAILURE |
Internal failure. Refer to the trace log for more information. |
|
NMSGR303_INVALID_CHANNEL |
Specified HDLC channel is not provisioned on this interface. |
|
NMSGR303_INVALID_INTERFACE_ID |
Specified interface is not provisioned. |
|
NMSGR303_INVALID_PARMS |
lapd_data buffer pointer is NULL. |
|
NMSGR303_INVALID_STATE |
Interface is not started. |
|
NMSGR303_NOT_INITIALIZED |
NMS GR303 library was not initialized with NMS_GR303Initialize. |
|
Event |
Description |
|
NMSGR303_EVENT_TX_ERROR |
Internal HDLC transmit error occurred. No buffer is attached to this error. |
|
NMSGR303_EVENT_TX_FIFO_UNDERRUN |
HDLC transmit FIFO underrun. No buffer is attached to this error. Not supported for CG 6100C or CG 6500C boards. |
|
NMSGR303_EVENT_TX_FIFO_OVERRUN |
HDLC transmit FIFO overrun. No buffer is attached to this error. |
|
NMSGR303_EVENT_TX_QUEUE_FULL |
The error indicates that the internal send queue is full and indicates an abnormal send rate. No buffer is attached to this error. Not supported for CG 6100C or CG 6500C boards. |
NMS_GR303PhSendData is asynchronous and returns without waiting for the board to report the send operation result. The specified interface must be started when the application calls NMS_GR303PhSendData.
The NMS_GR303_CHANNEL_LOCATION_T structure includes the following information:
|
Field |
Description |
|
boardNb |
Logical board number where an HDLC instance is located (as defined by NMS OAM). |
|
trunkNb |
Logical trunk number associated with the HDLC instance (as defined by NMS OAM). |
|
timeslotNb |
Physical timeslot number associated with the HDLC instance. |
The result of the send operation is reported later through the following application-defined callback structure:
typedef void(*NMS_GR303_CHANNEL_CALLBACK_T)
(NMS_GR303_INTERFACE_ID_T interfaceId,
NMS_GR303_CHANNEL_LOCATION_T channel_loc,
NMS_GR303_CHANNEL_EVENT_T channel_event,
void *databuffer,
DWORD datasize);
The NMS GR303 library invokes the callback with the channel_event parameter set to a transmission result value. The transmission result is passed to the application, but the result does not indicate the send request with which it is associated.
void SendData(BYTE *FrameBuffer, DWORD NumberBytes )
{
NMS_GR303_RESULT_T NmsResult;
DWORD InterfaceId;
NMS_GR303_CHANNEL_LOCATION_T ChannelLocation;
printf("SendData:\n");
/* Get parameters */
promptdw_nodft("Enter interfaceId", &InterfaceId);
printf("Enter channel location:\n");
GetChannelLocationNMS( &ChannelLocation );
NmsResult = NMS_GR303PhSendData( InterfaceId,
ChannelLocation,
NumberBytes,
FrameBuffer );
printf ("PhSendData: Result=%s\n",PRINT_RESULT(NmsResult));
}