ubuntu 在 R40e 上 還有 Debian 在 Sempron 2600 上

2012年1月11日 星期三

android code trace : at command engine

response 都是 char *
有可能是很多個 reponse ,所以用一個 ATLine 來包裝,
ATLine 是一個 char * 的 linking list: typedef struct ATLine { struct ATLine *p_next; char *line; } ATLine; reponse 是用addIntermediate(const char *line) 來填入資料: ATLine *p_new; p_new = (ATLine *) malloc(sizeof(ATLine)); p_new->line = strdup(line); /* note: this adds to the head of the list, so the list will be in reverse order of lines received. the order is flipped again before passing on to the command issuer */ p_new->p_next = sp_response->p_intermediates; sp_response->p_intermediates = p_new; 對於 singleline response 的處理: case SINGLELINE: if (sp_response->p_intermediates == NULL && strStartsWith (line, s_responsePrefix) ) { addIntermediate(line); } else { /* we already have an intermediate response */ handleUnsolicited(line); } break; 所以拿到的 reponse,其中的 ATLine->line 才是 char* 的內容。



reference-ril/at_tok.c 是 response 的字串處理 function。

at_tok_start(char*) : 找到 ':' 後面的位置,通常是回應的內容的開始。

所以要處理 available network 的 ( ),要增加 function..

沒有留言:

標籤

網誌存檔