read-from-nag.c
来自「MANTIS是由科罗拉多大学开发的传感器网络嵌入式操作系统。 这是mantis」· C语言 代码 · 共 62 行
C
62 行
#include <errno.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/time.h>#include <unistd.h>#include <time.h>#include <fcntl.h>#include <sys/stat.h>#include <sys/types.h>#include <glib.h>#include "libbionet-internal.h"#include "bionet.h"// FIXME: should return errors to the callervoid bionet_read_from_nag(void) { if (bionet_connect_to_nag() < 0) { return; } do { xmlDoc *xml; int r; struct timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = 0; r = bionet_nxio_read(libbionet_nag_nxio, &timeout, &xml); switch (r) { case NXIO_CLOSE: { g_log(BIONET_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "error reading from NAG"); libbionet_kill_nag_connection(); return; } case NXIO_INVALID_XML: { g_log(BIONET_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "read invalid reply from NAG"); libbionet_kill_nag_connection(); return; } } if (xml == NULL) { // nothing from the NAG return; } libbionet_queued_messages_from_nag = g_slist_append(libbionet_queued_messages_from_nag, xml); bionet_handle_queued_nag_messages(); } while(1);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?