带 Z1 Websense 的休息服务器

Rest Server with Z1 Websense

嗨,Stackover 的追随者:)。我是 Whosebug 的新手。让我提出一个关于 Instant Contiki 的问题。任何对Instant Contiki、zolertia motes、REST Server有想法的人,欢迎解决。

通过考虑“z1-websense.c”和“rest-server-[=29=,我可以成功地处理两个不同的微尘]'。

But I want to get the result of 'z1-websense.c' which is the temperature, by executing the 'rest-server-example.c'.

所以,关于这个,在'rest-server-example.c'代码中有一些事情要做,可能是通过调用function 对于 z1-websense.c,我无法破解它。

请帮帮我。提前致谢。

Contiki 上的 rest-engine 应用程序允许您为调用它们的方法设置资源和处理程序。

所以,如果我理解的话,你想调整 er-example-server 中的资源 GET 处理程序以将 taylor 放到 z1 mote 上,特别是电池传感器的资源和温度传感器的资源。

如果您看一下 z1-websense.c,将检索这些值并对其进行简单缩放(第 66-79 行)。

static int
get_battery(void)
{
  return battery_sensor.value(0);
}

static int
get_temp(void)
{
  return temperature_sensor.value(0);
}

static float get_mybatt(void){ return (float) ((get_battery()*2.500*2)/4096);}
static float get_mytemp(void){ return (float) (((get_temp()*2.500)/4096)-0.986)*282;}

获取该代码并将其注入您可以在此处找到的电池和温度资源enter link description here,您就完成了。

所以最后你会得到类似

的东西

文件res-battery.c,第60行 浮动电池 = ( battery_sensor.value(0) *2.500*2) /4096 ;

你应该对温度做类似的事情,你就完成了。

记得停用所有您不感兴趣的sensors/resources,因为它们会占用宝贵的内存。

我现在无法测试,但这应该可以。