API Reference | developer.brewmp.com API Reference | developer.brewmp.com

Developer

API Reference

ISUPPSTRANS

Brew Release
Brew MP 1.0.2
See Also
IPHONECTL_GetSuppsTrans()
Description

This interface provides services to send non-call related supplementary services.
List of Header files to be included:
AEETelephone.h
Usage

A new instance can be obtained from IPHONECTL_GetSuppsTrans().
A transaction Id AEET_SUPPSVC_TRANSID_NEW given to IPHONECTL_GetSuppsTrans() will create a new object for use of mobile initiated transactions.
Network initiated transactions can be known using any of these two methods : 1. Specify interest for AEET_NMASK_NEW_NI_SUPP_TRANS to AEECLSID_PHONENOTIFIER object. 2. Add listener to AEECLSID_TELEPHONE using IModel interface.
In both methods application will be given a network initiated transaction Id. This transaction Id can be used with IPHONECTL_GetSuppsTrans() to create the SuppsTrans Object. Life of the transaction Id is limited to the event notification call (for both EVT_NOTIFY and Listener callback).

Sending a mobile initiated request comprises of following steps :
1. Create a SuppsTrans object.
nErr = IPHONECTL_GetSuppsTrans(pme->pPhoneCtl, AEET_SUPPSVC_TRANSID_NEW, &piSupps);
2. Use it to parse a string in to a Message buffer of type AEETSuppsMessage. Optionally you could use the ISUPPSTRANS_ParseString() to determine how large a buffer is needed.
{ AEETSuppsMessage* pMsg = 0; uint32 uSize = 0;
nErr = ISUPPSTRANS_ParseString(piSupps, "*#21*11#", pMsg, &uSize); if (EBUFFERTOOSMALL != nErr) { goto bail; }
// Allocate message buffer nErr = ERR_MALLOC(uSize, &pMsg); if (AEE_SUCCESS != nErr) { goto bail; }
// parse and intialize the buffer nErr = ISUPPSTRANS_ParseString(piSupps, psz, pMsg, &uSize); if (AEE_SUCCESS != nErr) { goto bail; } }
3. Load the message to transaction object. nErr = ISUPPSTRANS_LoadMessage(piSupps, pMsg, uSize);
Load message copies the message in to the object. You can release the memory associated with pMsg after the ISUPPSTRANS_LoadMessage().
4. Run the transaction with a callback notification when done.
// Prepare the asynchronous callback CALLBACK_Cancel(&me->cbOneShot); CALLBACK_Init(&me->cbOneShot, (PFNNOTIFY)SendCB, me);
// Run the transaction ISUPPSTRANS_Run(piSupps, &me->cbOneShot);
Finding the current state of transaction object :
ISUPPSTRANS_GetState() returns AEETSuppsTransState. Object is in AEETSUPPS_STATE_NONE until a first ISUPPSTRANS_Run() is invoked. After ISUPPSTRANS_Run() is invoked object enters AEETSUPPS_STATE_RUNNING state and when done will be in either AEETSUPPS_STATE_NW_INDICATION or AEETSUPPS_STATE_DONE. Result of the transaction can be retrieved using ISUPPSTRANS_GetResult(). The result is not valid when object is in states AEETSUPPS_STATE_NONE or AEETSUPPS_STATE_RUNNING.
ISUPPSTRANS_Run() can be issued any time, even when the object is in the AEET_SUPPS_STATE_RUNNING. Callbacks will fire when transaction is halted.
Responding to a Network initiated transaction comprises of following steps
1. Retrieve the transaction Id in asynchronous notifications data AEETSuppsEventData, and create the SuppsTrans object with that transaction Id.
nErr = IPHONECTL_GetSuppsTrans(pme->pPhoneCtl, tid, &piSupps);
2. Retrieve the network indication. { AEETSuppsMessage theMsg; int nErr;
// compose a network indication request. theMsg.type = AEETSUPPS_MSG_REQUEST; theMsg.data.request.operation = AEETSUPPS_REQ_NETWORK_IND;
nErr = ISUPPSTRANS_LoadMessage(piSupps, &theMsg, sizeof(theMsg)); if (AEE_SUCCESS != nErr) { goto bail; }
CALLBACK_Init(&me->cbNi, GetPasswdIndCb, me); ISUPPSTRANS_Run(piSupps, &me->cbNi); }
3. After the network indication is retrieved compose and send the response.
static void GetPasswdIndCb(void* po) { AEETSuppsMessage theMsg; ...
theMsg.type = AEETSUPPS_MSG_RESPONSE; theMsg.data.response.response_type = AEETSUPPS_RES_PASSWD;
// szPasswd is string buffer containing password. theMsg.data.response.response_data.length = STRLEN(szPasswd); theMsg.data.response.response_data.data = szPasswd; ...
// Load the response message to object nErr = ISUPPSTRANS_LoadMessage(piSupps, &theMsg, sizeof(theMsg));
// prepare a callback ...
// run the transaction. ISUPPSTRANS_Run( ... ); }