|
// android端发送报警命令
public static int sendEventSource(Context context, int eventType, int end, String dec) {
BVCU_Command command = new BVCU_Command();
command.iMethod = BVCU_Method.BVCU_METHOD_NOTIFY;
command.iSubMethod = BVCU_SubMethod.BVCU_SUBMETHOD_EVENT_NOTIFY;
command.szTargetID = mcu.getServerParam().szServerAddr; // 服务器ip 如:192.168.6.6
command.iTimeOut = 3000; // 超时时间 默认3000即可
command.stMsgContent = new BVCU_CmdMsgContent();
command.stMsgContent.iDataCount = 1;
BVCU_Event_Source event_Source = new BVCU_Event_Source();
event_Source.szID = "PU_666666"; // PU_ID
event_Source.iEventType = eventType; // 报警类型 参考 BVCU_EVENT_TYPE
event_Source.iSubDevIdx = 0;
event_Source.iValue = 0;
event_Source.bEnd = end;// 0:报警 1:解除报警
event_Source.szEventDesc = dec; // 报警描述 自定义字符串即可
event_Source.iLongitude = mcu.getMPUApplication().getGPSData().iLongitude; // 经纬度
event_Source.iLatitude = mcu.getMPUApplication().getGPSData().iLatitude;
Calendar calendar = Calendar.getInstance();
event_Source.stTime = new BVCU_WallTime();
event_Source.stTime.iYear = (short) calendar.get(Calendar.YEAR);
event_Source.stTime.iMonth = (char) (calendar.get(Calendar.MONTH) + 1);
event_Source.stTime.iDay = (char) calendar.get(Calendar.DAY_OF_MONTH);
event_Source.stTime.iHour = (char) calendar.get(Calendar.HOUR_OF_DAY);
event_Source.stTime.iMinute = (char) calendar.get(Calendar.MINUTE);
event_Source.stTime.iSecond = (char) calendar.get(Calendar.SECOND);
command.stMsgContent.pData = event_Source;
int token = BVCU.getSDK().sendCmd(command);
} |
|