| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- // +build ignore
- #include "mcu_ctrl_board.h"
- #include "../swapi/subjects/serial/serial.h"
- // 检查核心内存分配情况
- static char coreBuf[200*1024*1024] = { 0 };
- static void coreMemCheck(const char *filename, int line, const char *ptr, int size, void *lpParameter)
- {
- sw_log_info("filename:%s line:%d addr:%#p size:%dbytes", filename, line, ptr, size);
- }
- int RTU_IsInetAvailable()
- {
- return 0;
- }
- int RTU_IsSyncedNtpTime()
- {
- return 0;
- }
- int RTU_IsLoginMqServer()
- {
- return 0;
- }
- int RTU_SendGrpEnvData(SensorEnvData *pGroupData, int cnt)
- {
- return 0;
- }
- int RTU_SendOneEnvData(SensorEnvData *pOneData)
- {
- return 0;
- }
- int RTU_RequestTakePhoto()
- {
- return 0;
- }
- int RTU_LoadMCUParamsCfg()
- {
- return 0;
- }
- int RTU_NotifyPwrWillOff()
- {
- return 0;
- }
- // 主函数入口, 测试拍照
- int main(int argc,char *argv[])
- {
- if(!sw_heap_init(coreBuf, sizeof(coreBuf), 4)) goto end_p;
- int ret = MCBComInit();
- if(ret < 0)
- {
- sw_log_error("an error occurred while calling the MCBComInit() function(%d)!!", ret);
- goto end_p;
- }
- // 测试-查询状态位图
- uint8_t req1[] = { 0x7D, 0x01, 0x01, 0x01, 0xE0, 0x50, 0x7E };
- serial_write_recv_buffer(MCBGetSerialHandle(), req1, sizeof(req1));
- // 测试-发送环境数据
- uint8_t req2[] = { 0x7D, 0x01, 0x02, \
- 0x68, 0x78, 0x7B, 0x6D, 0x02, 0x0A, 0x01, 0x97, 0x00, 0x00, 0x00, 0x5A, 0x00, 0x27, \
- 0x68, 0x78, 0x7B, 0x77, 0x01, 0xC9, 0x00, 0xF0, 0x00, 0x00, 0x00, 0x30, 0x00, 0x27, \
- 0x68, 0x78, 0x7B, 0x81, 0x02, 0xC4, 0x01, 0x1B, 0x00, 0x00, 0x00, 0x3A, 0x00, 0x27, \
- 0x68, 0x78, 0x7B, 0x8B, 0x02, 0xDB, 0x00, 0xA0, 0x00, 0x00, 0x00, 0x1E, 0x00, 0x27, \
- 0x68, 0x78, 0x7B, 0x95, 0x01, 0x14, 0x02, 0xA6, 0x00, 0x00, 0x00, 0x03, 0x00, 0x22, \
- 0x68, 0x78, 0x7B, 0x9F, 0x01, 0x8C, 0x00, 0x1D, 0x00, 0x00, 0x00, 0x5A, 0x00, 0x22, \
- 0x68, 0x78, 0x7B, 0xA9, 0x00, 0xE5, 0x01, 0x3A, 0x00, 0x00, 0x00, 0x09, 0x00, 0x22, \
- 0x68, 0x78, 0x7B, 0xB3, 0x00, 0x88, 0x02, 0x9A, 0x00, 0x00, 0x00, 0x36, 0x00, 0x22, \
- 0x68, 0x78, 0x7B, 0xB6, 0x00, 0x88, 0x02, 0x9A, 0x00, 0x00, 0x00, 0x36, 0x00, 0x27, \
- 0x68, 0x78, 0x7C, 0x71, 0x00, 0x84, 0x01, 0xA6, 0x00, 0x00, 0x00, 0x01, 0x00, 0x27, \
- 0x68, 0x78, 0x7C, 0x7B, 0x01, 0x51, 0x01, 0xAB, 0x00, 0x00, 0x00, 0x11, 0x00, 0x22, \
- 0x68, 0x78, 0x7C, 0x80, 0x01, 0xC5, 0x01, 0x94, 0x00, 0x00, 0x00, 0x51, 0x00, 0x22, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x65, 0x1F, 0x7E };
- serial_write_recv_buffer(MCBGetSerialHandle(), req2, sizeof(req2));
- // 测试-查询主机对时
- uint8_t req3[] = { 0x7D, 0x01, 0x03, 0x68, 0x78, 0x7C, 0xA3, 0xB9, 0x0A, 0x7E };
- serial_write_recv_buffer(MCBGetSerialHandle(), req3, sizeof(req3));
- // 测试-同步运行参数
- uint8_t req4[] = { 0x7D, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x0A, 0x7E };
- serial_write_recv_buffer(MCBGetSerialHandle(), req4, sizeof(req4));
- getchar(); // 输入任意键退出
- end_p:
- MCBComExit();
- sw_log_info("Memory leak check:");
- sw_heap_check(coreMemCheck, NULL); // 内存泄露检查
- sw_heap_exit();
- return 0;
- }
|