|
回調(diào)函數(shù)的出現(xiàn),實(shí)際上是使用協(xié)議棧直接接口實(shí)現(xiàn)web服務(wù)器的結(jié)果。
3步曲:
一:初始化函數(shù)
void httpd_init(void)-->
二:設(shè)置新的連接到達(dá)時(shí),調(diào)用函數(shù)http_accept
static err_t http_accept(void *arg, struct tcp_pcb *pcb, err_terr)-->
三:當(dāng)一個(gè)TCP段到達(dá)這個(gè)連接時(shí),調(diào)用函數(shù)My_http_recv
static err_t My_http_recv(void *arg, struct tcp_pcb *pcb, structpbuf *p, err_t err)
多類似,CC1100的驅(qū)動(dòng)代碼呀。
當(dāng)接收到數(shù)據(jù),跳轉(zhuǎn)到中斷服務(wù)程序去獲取CC1100接收到的數(shù)據(jù)。
回調(diào)函數(shù)類似中斷復(fù)位函數(shù)。
|
|