// // Created by xemon on 10.05.23. // #include "AtGsmTelitLe910_DefinePdpContext.h" #include "AtCmdCommonProtected.h" #include "SystemDelayInterface.h" AtCommandResult AtGsmTelitLe910_DefinePdpContext( tAtCmd *env, uint8_t cid, eAtGsmTelitLe910_PdpType pdpType, const char *apn, uint8_t apnLen ) { AtCmdPrepare(env); if (cid > 15) { return AT_ERROR; } AtCmdTxClear(env); AtCmdTxAddStatic(env, "AT+CGDCONT="); AtCmdTxAddDecimalIntWithLimit(env, cid, 2); AtCmdTxAddChar(env, ','); AtCmdTxAddChar(env, '"'); switch (pdpType) { case AtGsmTelitLe910_PdpType_IP: AtCmdTxAddStatic(env, "IP"); break; case AtGsmTelitLe910_PdpType_IPV6: AtCmdTxAddStatic(env, "IPV6"); break; case AtGsmTelitLe910_PdpType_IPV4V6: AtCmdTxAddStatic(env, "IPV4V6"); break; default: return AT_ERROR; } AtCmdTxAddChar(env, '"'); AtCmdTxAddChar(env, ','); AtCmdTxAddChar(env, '"'); AtCmdTxAdd(env, apn, apnLen); AtCmdTxAddChar(env, '"'); AtCmdTxSendLn(env); return AtCmdOkErrAnswer(env, env->stdRxTimeout); } AtCommandResult AtGsmTelitLe910_PdpActivate(tAtCmd *env, uint8_t cid) { AtCmdPrepare(env); if (cid > 15) { return AT_ERROR; } AtCmdTxClear(env); AtCmdTxAddStatic(env, "AT#SGACT=1,"); AtCmdTxAddDecimalIntWithLimit(env, cid, 2); AtCmdTxSendLn(env); return AtCmdOkErrAnswer(env, env->stdRxTimeout*10); } AtCommandResult AtGsmTelitLe910_PdpDeactivate(tAtCmd *env, uint8_t cid) { AtCmdPrepare(env); if (cid > 15) { return AT_ERROR; } AtCmdTxClear(env); AtCmdTxAddStatic(env, "AT#SGACT=0,"); AtCmdTxAddDecimalIntWithLimit(env, cid, 2); AtCmdTxSendLn(env); return AtCmdOkErrAnswer(env, env->stdRxTimeout*10); } /* AtCommandResult AtGsmSimComA7600_DefinePdpContext( tAtCmd *env, uint8_t cid, eAtGsmSimComA7600_PdpType pdpType, const char *apn, uint8_t apnLen ) { AtCmdPrepare(env); if (cid > 15) { return AT_ERROR; } AtCmdTxClear(env); AtCmdTxAddStatic(env, "AT+CGDCONT="); AtCmdTxAddDecimalIntWithLimit(env, cid, 2); AtCmdTxAddChar(env, ','); AtCmdTxAddChar(env, '"'); switch (pdpType) { case AtGsmSimComA7600_PdpType_IP: AtCmdTxAddStatic(env, "IP"); break; case AtGsmSimComA7600_PdpType_IPV6: AtCmdTxAddStatic(env, "IPV6"); break; case AtGsmSimComA7600_PdpType_IPV4V6: AtCmdTxAddStatic(env, "IPV4V6"); break; default: return AT_ERROR; } AtCmdTxAddChar(env, '"'); AtCmdTxAddChar(env, ','); AtCmdTxAddChar(env, '"'); AtCmdTxAdd(env, apn, apnLen); AtCmdTxAddChar(env, '"'); AtCmdTxSendLn(env); return AtCmdOkErrAnswer(env, env->stdRxTimeout); } AtCommandResult AtGsmSimComA7600_PdpActivate(tAtCmd *env, uint8_t cid) { AtCmdPrepare(env); if (cid > 15) { return AT_ERROR; } AtCmdTxClear(env); AtCmdTxAddStatic(env, "AT+CGACT=1,"); AtCmdTxAddDecimalIntWithLimit(env, cid, 2); AtCmdTxSendLn(env); return AtCmdOkErrAnswer(env, env->stdRxTimeout*10); } AtCommandResult AtGsmSimComA7600_PdpDeactivate(tAtCmd *env, uint8_t cid) { AtCmdPrepare(env); if (cid > 15) { return AT_ERROR; } AtCmdTxClear(env); AtCmdTxAddStatic(env, "AT+CGACT=0,"); AtCmdTxAddDecimalIntWithLimit(env, cid, 2); AtCmdTxSendLn(env); return AtCmdOkErrAnswer(env, env->stdRxTimeout*10); } */