PREV TOC HOME INDEX NEXT


ms_ResultMsg( )


Cautions | Errors | Example | See Also

Name: int ms_ResultMsg(devh, result_code, msg)
Inputs:

int devh

  • station device handle

long result_code

  • error code

char **msg

  • pointer to address of error code description
Returns:

0 on success

-1 on failure

Includes:

srllib.h

dtilib.h

msilib.h

Category:

Configuration

Mode:

Synchronous

Platform:

DI, HDSI

Description

The ms_ResultMsg( ) function returns an ASCII string which describes a result code.

Parameter

Description

devh device handle for station
result_code error code. This parameter can be an error code returned by ms_ResultValue( )
msg pointer to address where the description of the result_code message is stored.

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.

Example

#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