PREV TOC HOME INDEX NEXT


ms_ResultValue( )


Cautions | Errors | Example | See Also

Name: int ms_ResultValue(devh, event, eventInfo, resultValue)
Inputs:

int devh

  • station device handle

long event

  • event identifier

void *eventInfo

  • pointer to eventInfo block

long *resultValue

  • address of error code value
Returns:

0 on success

-1 on failure

Includes:

srllib.h

dtilib.h

msilib.h

Category:

Configuration

Mode:

Synchronous

Platform:

DI, HDSI

Description

The ms_ResultValue( ) function is used to retrieve the cause of an event.

Parameter

Description

devh

device handle for station

event

event identifier

eventInfo

pointer to eventInfo block. Retrieve the pointer by calling the Standard Runtime Library function sr_getevtdatap( ). See the Standard Runtime Library API Library Reference for details.

resultValue

address where the MSI result value 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