云服务器内容精选

  • 示例 开发者需要实现Agent Lite提供的观察者接口。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 public class AgentLiteDataTrans implements MyObserver { public AgentLiteDataTrans (Observable dataTransService) { dataTransService. registerObserver (this); } @Override public void update(IotaMessage arg0) { // TODO Auto-generated method stub System.out.println("AgentLiteDataTrans收到通知:" + arg0); int mMsgType = arg0.getMsgType(); switch(mMsgType) { //数据上报应答 case IodevService.IODEV_MSG_DATA_REPORT_RSP: getDataReportAnswer(arg0); break; //被动接收命令 case IodevService.IODEV_MSG_RECEIVE_CMD: getCmdReceive(arg0); break; //MQTT消息推送 case IodevService.IODEV_MSG_MQTT_PUB_RSP: //logoutResultAction(iotaMsg); break; default: break; } }