本文是上一篇的后续。
核心代码如下(部分省略):
//------------------------------------------------------------------------------
void main(void)
{
//.........................................
while(1)
{
msg_s.id = MSG_GET_READY;
Mailbox_pend(mbox_srcimg, &msg_s, BIOS_WAIT_FOREVER);
ImageProc(msg_s.img_hdr.data,msg_s.img_hdr.width,msg_s.img_hdr.height);
msg_s.id = MSG_IMGPROC_FINISHED;
Mailbox_post(mbox_result, &msg_s, BIOS_WAIT_FOREVER);
}
//.........................................
}
static void NetworkOpen()
{
DaemonNew(SOCK_DGRAM,0,PORT,Daemon_proc,...);
}
int Daemon_proc(SOCKET s, UINT32 unused)
{
//....................................
// Receive image data
msg_s.id = MSG_SRCIMG_RECEIVED;
Mailbox_post(mbox_srcimg