PREV TOC HOME INDEX NEXT


ms_SendData( )


Cautions | Errors | Example A - Synch Mode | Example B - Async Mode | See Also

Name: int ms_SendData(devh, dataInfo, mode)
Inputs:

int devh

  • station device handle

MS_DataInfo dataInfo

  • pointer to information structure

int mode

  • synchronous or asynchronous mode setting
Returns:

0 on success

-1 on failure

Includes:

srllib.h

dtilib.h

msilib.h

Category:

Station

Mode:

Asynchronous or synchronous

Platform:

DI, HDSI

Description

The ms_SendData( ) function sends data to a station while the station is already in conversation. For example, this function can be used to send call waiting caller ID information for a new call while a call is already in progress.

Parameter

Description

devHandle device handle of the station
dataInfo pointer to information structure; see MS_DataInfo for details.
Mode mode setting
  • synchronous
    EV_SYNC
  • asynchronous
    EV_ASYNC

Termination Events

The following events may be returned when this function is called in asynchronous mode:

MSEV_DATASENT
Indicates the data was sent successfully to the specified station.
MSEV_SENDDATAFAILED
Indicates the send data operation failed.

Cautions

Errors

If this function returns -1 to indicate failure, obtain the reason for the error by calling the SRL standard attribute function ATDV_LASTERR( ) or ATDV_ERRMSGP( ) to retrieve either the error code or a pointer to the error description, respectively.

Refer to the error type tables found in Chapter 5, "Error Codes". Error defines can be found in dtilib.h or msilib.h.

Possible errors for this function include:

EDT_BADDEV
Bad device handle
EDT_BADGLOB
Bad global parameter number
EDT_PARAMERR
Invalid command parameter
EDT_INVTS
Invalid device specified
E_MSINVDATATYPE
Invalid data type specified while sending data to the station
E_MSINVVERSION
Invalid version number specified
E_MSNOCNT
Station not connected

Example A - Synch Mode

#include <windows.h>    /* For Windows application only */
#include <stdio.h>
#include <errno.h>
#include "srllib.h"
#include "dtilib.h"
#include "msilib.h" 
int dev1;          /* Station Device Descriptor    */
int rc;            /* Return Code                  */ 
MS_DataInfo myDataInfo;
/*    DataString    Caller Name = John Doe
            Date Time = Jan 31, 9 30 am */
char DataString[128] = "T:01310930N:John Doe"; 
/* Open board 1, Station 1 device */
if ( (dev1 = ms_open("msiB1C1", 0)) == -1) 
{
    printf("Cannot open msiB1C1, Station 1, Channel 1: errno=%d\n",errno);
    exit(1);
} 
/*
*    Continue processing
*    make sure the station is already in a call
*/ 
/*    Send data to a station which is already in a call in SYNC mode    */
myDataInfo.version=0;
myDataInfo.dataType=eMSFSK;
myDataInfo.uInfo.dataString=DataString;
if((rc=ms_SendData(dev1,myDataInfo,EV_SYNC))==-1)    
{
    /* process error    */
} 
/*
*    Continue processing
*/ 
/* Done processing - close device */
if(ms_close(dev1)==-1)    
{
    printf("Cannot close device msiB1C1. errno=%d\n",errno);
    exit(1);
} 

Example B - Async Mode

#include <windows.h>    /* For Windows application only */
#include <stdio.h>
#include <errno.h>
#include "srllib.h"
#include "dtilib.h"
#include "msilib.h" 
int dev1;          /* Station Device Descriptor    */
int rc;            /* Return Code                  */ 
long EventHandler (unsigned long temp)
{
    
    int dev=sr_getevtdev();
    long event=sr_getevttype();
    void* datap = (void*) sr_getevtdatap();
    char *errorMsg;
    long errorCode = 0; 
    switch(event)    
    {
    case MSEV_DATASENT :
        printf("Received MSEV_DATASENT for device = %s... \n",ATDV_NAMEP(dev));
        /* Continue processing */
        break; 
    case MSEV_SENDDATAFAILED :
        ms_ResultValue(dev,event,datap,&errorCode);
        ms_ResultMsg(dev,errorCode,&errorMsg);
        printf("Received MSEV_SENDDATAFAILED for device = %s...ErrorCode =
                0X%X ErrorMessage = %s\n", ATDV_NAMEP(dev),errorCode,errorMsg);
        /* Continue processing */
        break; 
    default :
        printf("Unknown event received on %s...Event = 0x%x Device = %d\n",
                ATDV_NAMEP(dev),event,dev);
        /* Continue processing */
        break; 
    }   /* switch event ends */ 
    /* Continue processing */
    return 0;
}   /* EventHandler ends */ 
MS_DataInfo myDataInfo;
/*    DataString    Caller Name = John Doe
            Date Time = Jan 31, 9 30 am */
char DataString[128] = "T:01310930N:John Doe"; 
/* Open board 1, Station 1 device */
if ( (dev1 = ms_open("msiB1C1", 0)) == -1) 
{
    printf("Cannot open msiB1C1, Station 1, Channel 1: errno=%d\n",errno);
    exit(1);
} 
/* Set up handler function */
if (sr_enbhdlr(dev1, EV_ANYEVT, &EventHandler) == -1)
{
    /* process error */
} 
/*
*    Continue processing
*    make sure the station is already in a call
*/ 
/*    Send data to a station which is already in a call in ASYNC mode    */
myDataInfo.version=0;
myDataInfo.dataType=eMSFSK;
myDataInfo.uInfo.dataString=DataString; 
if((rc=ms_SendData(dev1,myDataInfo,EV_ASYNC))==-1)    
{
    /* process error    */
} 
/* Use sr_waitevt to wait for the completion of ms_SendData().
   On receiving the completion event, MSEV_DATASENT /  MSEV_SENDDATAFAILED
   control is transferred to the handler function (EventHandler)
   previously established using sr_enbhdlr().
*/ 
/*
*    Continue processing
*/ 
/* Done processing - close device */
if(ms_close(dev1)==-1)    
{
    printf("Cannot close device msiB1C1. errno=%d\n",errno);
    exit(1);
} 

See Also


PREV TOC HOME INDEX NEXT

Click here to contact Telecom Support Resources

Copyright 2003, Intel Corporation
All rights reserved
This page generated January, 2003