📄 mfw_gprs.c
字号:
| STATE : code ROUTINE: gprs_setQOS |
+---------------------------------------------------------------------+
PURPOSE : Set the Quality of Service Profile for the context
specified by cid. The Quality of Service Profile is given
in the pointer parameter qos.
PARAMETERS :
cid : context ID
*inputQos : quality of service data
*/
T_MFW_RES gprs_setQOS(SHORT cid ,T_QOS *inputQos)
{
T_MFW_GPRS_CONTEXT *cntxt;
TRACE_FUNCTION ("gprs_setQOS()");
/*
* ACI call
*/
if(sAT_PlusCGQREQ(CMD_SRC_LCL, cid, inputQos) == AT_FAIL)
{
TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGQREQ failed");
return MFW_RES_ERR;
}
/*
* change qos data in MFW GPRS data
*/
cntxt = (T_MFW_GPRS_CONTEXT *) mfwAlloc(sizeof(T_MFW_GPRS_CONTEXT));
cntxt->id = cid;
memcpy (&(cntxt->data.qos), inputQos, sizeof (T_QOS));
gprs_signal(E_MFW_GPRS_S_QOS, cntxt);
return MFW_RES_OK;
}
/*
+---------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
| STATE : code ROUTINE: gprs_setQOSMin |
+---------------------------------------------------------------------+
PURPOSE : Set the minimum acceptable Quality of Service Profile for
the context specified by cid.
PARAMETERS :
cid : context ID
*inputQos : quality of service data
*/
T_MFW_RES gprs_setQOSMin(SHORT cid ,T_QOS *inputQos)
{
T_MFW_GPRS_CONTEXT *cntxt;
TRACE_FUNCTION ("gprs_setQOSMin()");
/*
* ACI call
*/
if (sAT_PlusCGQMIN(CMD_SRC_LCL, cid, inputQos) == AT_FAIL)
{
TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGQMIN failed");
return MFW_RES_ERR;
}
/*
* change mininum acceptable qos data in MFW GPRS data
*/
cntxt = (T_MFW_GPRS_CONTEXT *) mfwAlloc(sizeof(T_MFW_GPRS_CONTEXT));
cntxt->id = cid;
memcpy (&(cntxt->data.min_qos), inputQos, sizeof (T_QOS));
gprs_signal(E_MFW_GPRS_S_QOS_MIN, cntxt);
return MFW_RES_OK;
}
/*
+---------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
| STATE : code ROUTINE: gprs_attach |
+---------------------------------------------------------------------+
PURPOSE : Attach to or detach from the GPRS Service. The parameter
state indicates the state of GPRS attchement
PARAMETERS :
state : attachement state ( 0 - detached, 1 - attached)
*/
T_MFW_RES gprs_attach(T_CGATT_STATE state)
{
T_ACI_RETURN result;
TRACE_FUNCTION ("gprs_attach()");
/*
* ACI call
* SPR#1574 - SH - Don't return fail for AT_CMPL result
*/
result = sAT_PlusCGATT(CMD_SRC_LCL, state);
if ( result!= AT_EXCT && result!=AT_CMPL)
{
TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGATT failed");
return MFW_RES_ERR;
}
/*
* change attachement state in MFW GPRS data
*/
gprs_signal(E_MFW_GPRS_S_ATT, &state);
return MFW_RES_OK;
}
/*
+---------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
| STATE : code ROUTINE: gprs_attach_abort |
+---------------------------------------------------------------------+
PURPOSE : Cancel attachment to or detachment from GPRS service
SPR#1983 - SH - Added.
PARAMETERS : None.
*/
T_MFW_RES gprs_attach_abort(void)
{
T_ACI_RETURN result;
TRACE_EVENT("gprs_attach_abort()");
result = sAT_Abort(CMD_SRC_LCL, AT_CMD_CGATT);
if (result==AT_FAIL)
return MFW_RES_ERR;
return MFW_RES_OK;
}
/*
+----------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
| STATE : code ROUTINE: gprs_contextActivation|
+----------------------------------------------------------------------+
PURPOSE : Activate or Deactivate PDP contexts. The parameter state
indicates the state of GPRS activation.
The parameter cids points to a list of contexts definitions.
If the list is empty all contexts will be attached or
detached. If the mobile is not attached before, a GPRS
attach is first performed.
PARAMETERS :
state : activation state ( 0 - deactivated, 1 - activated)
cids : list of contexts
*/
T_MFW_RES gprs_contextActivation(T_CGACT_STATE state, SHORT *cids)
{
T_MFW_GPRS_CNTXT_ACT *cntxtAct;
TRACE_FUNCTION ("gprs_contextActivation()");
/*
* ACI call
*/
if (sAT_PlusCGACT(CMD_SRC_LCL, state, cids) == AT_FAIL)
{
TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGCACT failed");
return MFW_RES_ERR;
}
/*
* change context activation data in MFW GPRS data
*/
cntxtAct = (T_MFW_GPRS_CNTXT_ACT *) mfwAlloc(sizeof(T_MFW_GPRS_CNTXT_ACT));
memcpy (&(cntxtAct->ids), cids, sizeof (SHORT));
cntxtAct->state = state;
gprs_signal(E_MFW_GPRS_S_ACT, cntxtAct);
return MFW_RES_OK;
}
/*
+---------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
| STATE : code ROUTINE: gprs_setData |
+---------------------------------------------------------------------+
PURPOSE : Enter data state. Whatever actions are necessary to
establish communication between the TE and the network
will be performed (e.g. attach, context activate)
PARAMETERS :
L2P : Layer 2 protocoll
cids : list of contexts
*/
T_MFW_RES gprs_setData(char *L2P, SHORT *cids)
{
T_MFW_GPRS_CNTXT_L2P *cntxtL2P;
TRACE_FUNCTION ("gprs_setData()");
/*
* ACI call
*/
if (sAT_PlusCGDATA(CMD_SRC_LCL, L2P, cids) == AT_FAIL)
{
TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGDATA failed");
return MFW_RES_ERR;
}
/*
* change attachement, activation and L2P data in MFW GPRS data
*/
cntxtL2P = (T_MFW_GPRS_CNTXT_L2P *) mfwAlloc(sizeof(T_MFW_GPRS_CNTXT_L2P));
cntxtL2P->L2P = (char *) mfwAlloc(sizeof(char) * strlen(L2P));
cntxtL2P->ids = (USHORT *) mfwAlloc(sizeof(SHORT) * MAX_CID);
memcpy (cntxtL2P->L2P, L2P, sizeof (CHAR) * strlen(L2P));
memcpy (cntxtL2P->ids, cids, sizeof (SHORT));
gprs_signal(E_MFW_GPRS_S_DATA, cntxtL2P);
mfwFree( (void *) cntxtL2P->L2P, sizeof(char) * strlen(L2P));
mfwFree( (void *) cntxtL2P->ids, sizeof(SHORT) * MAX_CID);
return MFW_RES_OK;
}
/*
+-----------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
| STATE : code ROUTINE: gprs_showPDPAddress |
+-----------------------------------------------------------------------+
PURPOSE : Show PDP address. The Function sets the pointer pdp_adress
to a list of PDP addresses for the specified context
identifiers in the parameter cids.
PARAMETERS :
pdp_address: list of contexts
RETURNS:
MFW_RES_OK: On success
MFW_RES_ERR: On failure
*/
T_MFW_RES gprs_showPDPAddress(SHORT *cids, T_PDP_ADDRESS *pdp_address)
{
int i;
T_MFW_GPRS_CONTEXT *cntxt;
TRACE_FUNCTION ("gprs_showPDPAddress()");
/*
* ACI call, get PDP addresses
*/
if (sAT_PlusCGPADDR(CMD_SRC_LCL, cids, pdp_address) == AT_FAIL)
{
TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGPADDR failed");
return MFW_RES_ERR;
}
/*
* change PDP address data in MFW GPRS data
*/
cntxt = (T_MFW_GPRS_CONTEXT *) mfwAlloc(sizeof(T_MFW_GPRS_CONTEXT));
for (i=0; i < MAX_CID; i++)
{
cntxt->id = cids[i];
memcpy (&(cntxt->data.pdp_addr), pdp_address[i], sizeof (T_PDP_ADDRESS));
gprs_signal(E_MFW_GPRS_S_PDPADDR, cntxt);
}
return MFW_RES_OK;
}
/*
+----------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
| STATE : code ROUTINE: gprs_setAutoResponse |
+----------------------------------------------------------------------+
PURPOSE : Enable or Disable an automatic positive response to the
receipt of Context Activation Requests from the network.
The parameter mode indicates if the automatic response will
be enabled or disabled.
PARAMETERS :
mode : mode of auto response
*/
T_MFW_RES gprs_setAutoResponse(T_CGAUTO_N mode)
{
TRACE_FUNCTION ("gprs_setAutoResponse()");
/*
* ACI call
*/
if (sAT_PlusCGAUTO(CMD_SRC_LCL, mode) == AT_FAIL)
{
TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGAUTO failed");
return MFW_RES_ERR;
}
/*
* change auto response mode in MFW GPRS data
*/
gprs_signal(E_MFW_GPRS_S_AUTORESP, &mode);
return MFW_RES_OK;
}
/*
+----------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
| STATE : code ROUTINE: gprs_ManualResponse |
+----------------------------------------------------------------------+
PURPOSE : This Function is for a manual response to network request
for PDP context activation. The parameter response
indicates if the request will be accepted or rejected.
PARAMETERS :
response : ( 0 - rejected, 1 - accepted)
*/
T_MFW_RES gprs_ManualResponse(USHORT response, char *l2p, SHORT cid)
{
TRACE_FUNCTION ("gprs_ManualResponse()");
/*
* send signal to current MFW element
*/
gprs_signal(E_MFW_GPRS_S_ANS, &cid);
/*
* ACI call
*/
if (sAT_PlusCGANS(CMD_SRC_LCL, response, l2p, cid) == AT_FAIL)
{
TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGANS failed");
return MFW_RES_ERR;
}
return MFW_RES_OK;
}
/*
+----------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
| STATE : code ROUTINE: gprs_setClass |
+----------------------------------------------------------------------+
PURPOSE : Set the mobile to operate according to a GPRS mobile class.
PARAMETERS :
m_class : GPRS mobile class
*/
T_MFW_RES gprs_setClass(T_CGCLASS_CLASS new_cls)
{
T_CGATT_STATE state;
TRACE_FUNCTION ("gprs_setClass()");
/*
* ACI call
*/
if (sAT_PlusCGCLASS(CMD_SRC_LCL, new_cls) == AT_FAIL)
{
TRACE_EVENT("MFW_GPRS: Error. sAT_PlusCGCLASS failed");
return MFW_RES_ERR;
}
/*
* change class data in MFW GPRS data
*/
gprs_signal(E_MFW_GPRS_S_CLASS, &new_cls);
/*
* check if attachement mode has changed while class change
*/
if (qAT_PlusCGATT(CMD_SRC_LCL, &state) != AT_FAIL )
gprs_signal(E_MFW_GPRS_S_ATT, &state);
else
TRACE_EVENT("MFW_GPRS: Error. qAT_PlusCGATT failed");
return MFW_RES_OK;
}
/*
+----------------------------------------------------------------------+
| PROJECT: MMI-Framework (8417) MODULE: MFW_GPRS |
| STATE : code ROUTINE: gprs_setEventReporting|
+----------------------------------------------------------------------+
PURPOSE : Enables or Disables the sending of certain events
occuring in the GPRS ME or the network to the TE.
PARAMETERS :
mode : mode to specifies if the event reporting will be
enabled or disabled
bfr : controls the effect on buffered events.
*/
T_MFW_RES gprs_setEventReporting(T_CGEREP_MODE mode, T_CGEREP_BFR bfr)
{
T_MFW_GPRS_EVENTREP *eventRep;
TRACE_FUNCTION ("gprs_setEventReporting()");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -