设备管理cgi程序通过网页表单中设定的灯光设备开关状态及感应设备绑定状态对硬件开关进行控制,这里程序了只写了光感设备的绑定代码。
dev_con.c如下:
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "html.h"
#include "config.h"
#include "ipc.h"
void light_tr(char *name,int join,int sw,char type)
{
char type_id[2]="0";
type_id[0]=type+'0';
printf("<tr><td>%s</td>",name);
if(join==1){
printf("<td>在线</td>");
}else{
printf("<td>下线</td>");
}
if(sw==1){
printf("</td><td class=\"center\"><input type=\"radio\" name=\"sw_sta%s\" value=\"1\" checked=\"checked\">开启<input type=\"radio\" name=\"sw_sta%s\" valu