10 enum tcore_at_command_type {
11 TCORE_AT_NO_RESULT, /* no intermediate response expected */
12 TCORE_AT_NUMERIC, /* a single intermediate response starting with a 0-9 */
13 TCORE_AT_SINGLELINE, /* a single intermediate response starting with a prefix */
14 TCORE_AT_MULTILINE, /* multiple line intermediate response starting with a prefix */
19 AT_ERROR_MOBILE_FAILRURE =0,
20 AT_ERROR_NOT_CONNECTED_TO_PHONE =1,
21 AT_ERROR_LINK_RESERVED =2,
22 AT_ERROR_OPER_NOT_ALLOWED =3,
23 AT_ERROR_OPER_NOT_SUPPORTED =4,
24 AT_ERROR_PH_SIM_PIN_REQUIRED =5,
25 AT_ERROR_PH_FSIM_PIN_REQUIRED =6,
26 AT_ERROR_PH_FSIM_PUK_REQUIRED =7,
28 AT_ERROR_SIM_NOT_INSERTED =10,
29 AT_ERROR_SIM_PIN_REQUIRED =11,
30 AT_ERROR_SIM_PUK_REQUIRED =12,
31 AT_ERROR_SIM_FAILURE =13,
32 AT_ERROR_SIM_BUSY =14,
33 AT_ERROR_SIM_WRONG =15,
34 AT_ERROR_INCORRECT_PWD =16,
35 AT_ERROR_SIM_PIN2_REQUIRED =17,
36 AT_ERROR_SIM_PUK2_REQUIRED =18,
38 AT_ERROR_MEMORY_FULL =20,
39 AT_ERROR_INVALID_INDEX =21,
40 AT_ERROR_NOT_FOUND =22,
41 AT_ERROR_MEMORY_FAILURE =23,
42 AT_ERROR_TEXT_TOO_LONG =24,
43 AT_ERROR_INVALID_CHAR_IN_STR =25,
44 AT_ERROR_DIAL_TOO_LONG =26,
45 AT_ERROR_INVALID_CHAR_IN_DIAL =27,
47 AT_ERROR_NO_NETWORK_SVC =30,
48 AT_ERROR_NETWORK_TIMEOUT =31,
49 AT_ERROR_EMERGENCY_CALL_ONLY =32,
51 AT_ERROR_NET_PERSONAL_PIN_REQ =40,
52 AT_ERROR_NET_PERSONAL_PUN_REQ =41,
53 AT_ERROR_NET_SUB_PERSONAL_PIN_REQ =42,
54 AT_ERROR_NET_SUB_PERSONAL_PUK_REQ =43,
55 AT_ERROR_PROVIDER_PERSONAL_PIN_REQ =44,
56 AT_ERROR_PROVIDER_PERSONAL_PUK_REQ =45,
57 AT_ERROR_CORP_PERSONAL_PIN_REQ =46,
58 AT_ERROR_CORP_PERSONAL_PUK_REQ =47,
59 AT_ERROR_HIDDEN_KEY_REQUIRED =48,
60 AT_ERROR_EAP_METHOD_NOT_SUPPORTED =49,
61 AT_ERROR_INCORRECT_PARAM =50,
67 struct tcore_at_request {
71 enum tcore_at_command_type type;
74 struct tcore_at_response {
75 int success; /* true if final response indicates success (eg "OK") */
76 char *final_response; /* eg OK, ERROR */
77 GSList *lines; /* any intermediate responses */
80 typedef gboolean (*TcoreATNotificationCallback)(TcoreAT *at, const GSList *lines,
83 typedef struct tcore_at_response TcoreATResponse;
84 typedef struct tcore_at_request TcoreATRequest;
86 TcoreAT* tcore_at_new(TcoreHal *hal);
87 void tcore_at_free(TcoreAT *at);
89 TReturn tcore_at_buf_write(TcoreAT *at, unsigned int data_len,
92 TReturn tcore_at_set_request(TcoreAT *at, TcoreATRequest *req, gboolean send);
93 TcoreATRequest* tcore_at_get_request(TcoreAT *at);
94 TcoreATResponse* tcore_at_get_response(TcoreAT *at);
96 TReturn tcore_at_add_notification(TcoreAT *at, const char *prefix,
97 gboolean pdu, TcoreATNotificationCallback callback,
99 TReturn tcore_at_remove_notification(TcoreAT *at, const char *prefix,
100 TcoreATNotificationCallback callback);
101 TReturn tcore_at_remove_notification_full(TcoreAT *at,
103 TcoreATNotificationCallback callback, void *user_data);
105 TcoreATRequest* tcore_at_request_new(const char *cmd, const char *prefix,
106 enum tcore_at_command_type type);
107 void tcore_at_request_free(TcoreATRequest *req);
109 gboolean tcore_at_process(TcoreAT *at, unsigned int data_len,
112 TcorePending* tcore_at_pending_new(CoreObject *co, const char *cmd,
113 const char *prefix, enum tcore_at_command_type type,
114 TcorePendingResponseCallback func, void *user_data);
116 GSList* tcore_at_tok_new(const char *line);
117 void tcore_at_tok_free(GSList *tokens);
118 char* tcore_at_tok_extract(const char *src);
119 char* tcore_at_tok_nth(GSList *tokens, unsigned int token_index);