⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 read-from-nag.c

📁 MANTIS是由科罗拉多大学开发的传感器网络嵌入式操作系统。 这是mantis的0.9.5版本的源码。
💻 C
字号:
#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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -