
Description | Example | Errors | See Also
Name: |
int dt_castencode (msgp, encmsgbufp) | |
Inputs: |
void *msgp |
|
void *encmsgbufp |
| |
Returns: |
0 on success | |
Includes: |
dtilib.h | |
Category: |
CAS DTI Convenience | |
Mode: |
synchronous | |
The dt_castencode( ) function is called internally by dt_castmgmt( ). For every CAS DTI command message block passed to dt_castmgmt( ), the dt_castencode( ) function is called to validate and encode the message before it is written to the firmware. This function is offered to localize the tasks of host system issues (i.e. byte swapping) and message formation regarding messages that are passed across the host system bus.
The dt_castencode( ) function takes as its first parameter a command message block. It will use the encmsgbufp parameter to return the validated/encoded message block. Direct modification of the encoded message block is not allowed. The operation of this function does not prevent msgp and encmsgbufp from being the same buffer.
#include "dtilib.h"
...
/*
* This is a code fragment demonstrating
* the use of the _dt_castencode() function.
*/
...
/*
* Define a pulse using the pulse template message block.
*/
cpmsg.msg_code = DTCAS_CREATE_PULSE;
cpmsg.flags = 0;
cpmsg.template_id = 1;
cpmsg.OffPulseCode = (DTB_AON|DTB_BOFF);
cpmsg.OnPulseCode = (DTB_AOFF|DTB_BON);
cpmsg.PrePulseInterval = 0;
cpmsg.PrePulseIntervalNom = 0;
cpmsg.PulseIntervalMin = 120;
cpmsg.PulseIntervalNom = 150;
cpmsg.PulseIntervalMax = 170;
cpmsg.PostPulseInterval = 0;
cpmsg.PostPulseIntervalNom = 0;
/*
* Encode the create pulse template message block
* before sending to the driver.
*
* Note: The create pulse template message should
* not be manipulated after this point unless it
* is decoded.
*/
if ((n = _dt_castencode(&cpmsg, &cpmsg)) == -1) {
ndt_set_lasterr(devh, EDT_BADCMDERR);
return -1;
}
/*
* Write to driver.
*/
...
This function returns -1 if it does not recognize the msg_code field in the command message block.
Click here to contact Dialogic Customer Engineering
Copyright 2001, Dialogic Corporation