123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- /*
- * Module_PhBackend.h
- *
- * Created on: 2020/6/11
- * Author: foluswen
- */
- #ifndef MODULE_PHBACKEND_H_
- #define MODULE_PHBACKEND_H_
- #include <sys/time.h>
- #include <sys/timeb.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <sys/types.h>
- #include <sys/ioctl.h>
- #include <sys/socket.h>
- #include <sys/ipc.h>
- #include <sys/shm.h>
- #include <sys/shm.h>
- #include <sys/mman.h>
- #include <linux/wireless.h>
- #include <arpa/inet.h>
- #include <netinet/in.h>
- #include <unistd.h>
- #include <stdarg.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <fcntl.h>
- #include <termios.h>
- #include <errno.h>
- #include <errno.h>
- #include <string.h>
- #include <time.h>
- #include <ctype.h>
- #include <ifaddrs.h>
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <netdb.h>
- #include <error.h>
- #include "define.h"
- #define DEBUG_INFO(format, args...) StoreLogMsg("[%s:%d][%s][Info] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
- #define DEBUG_WARN(format, args...) StoreLogMsg("[%s:%d][%s][Warn] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
- #define DEBUG_ERROR(format, args...) StoreLogMsg("[%s:%d][%s][Error] "format, __FILE__, __LINE__, __FUNCTION__, ##args)
- #define ARRAY_SIZE(A) (sizeof(A) / sizeof(A[0]))
- #define PASS 1
- #define FAIL -1
- #define ON 1
- #define OFF 0
- #define true 1
- #define false 0
- #define PROTOCOL_VER 0x00
- struct Message
- {
- int size;
- uint8_t buffer[2048];
- };
- struct PH_Backend_Info
- {
- uint32_t st_hearbeat;
- uint32_t st_status[3];
- uint32_t interval_heartbeat;
- uint32_t interval_status;
- uint8_t retry_heartbeat;
- uint16_t sn_heartbeat;
- uint8_t counter_heartbeat_retry;
- uint8_t isSignin:1;
- }backend_info;
- struct SysConfigAndInfo *ShmSysConfigAndInfo;
- struct StatusCodeData *ShmStatusCodeData;
- uint16_t message_header = 0xffff;
- uint8_t server_addr[512];
- uint16_t server_port;
- uint16_t server_cmd_sn = 0x0000;;
- uint16_t server_user_id = 0xffff;
- extern void handle_cmd_1001(struct Message *in, struct Message *out);
- extern void handle_cmd_1003(struct Message *in, struct Message *out);
- extern void handle_cmd_1005(struct Message *in, struct Message *out);
- extern void handle_cmd_1101(struct Message *in);
- extern void handle_cmd_1103(struct Message *in);
- extern void handle_cmd_1105(struct Message *in);
- extern void handle_cmd_2303(struct Message *in, struct Message *out);
- extern void handle_cmd_2305(struct Message *in, struct Message *out);
- extern void create_Cmd_1002(struct Message *out, uint8_t cmd_type, uint32_t address, uint32_t count);
- extern void create_Cmd_1004(struct Message *out, uint8_t cmd_type, uint32_t address, uint8_t *data, uint8_t data_len);
- extern void create_Cmd_1006(struct Message *out, uint8_t gun_index, uint32_t address, uint8_t count, uint8_t isExecuted);
- extern void create_Cmd_1102(struct Message *out);
- extern void create_Cmd_1104(struct Message *out, uint8_t gun_index);
- extern void create_Cmd_1106(struct Message *out);
- extern void create_Cmd_2304(struct Message *out);
- extern void create_Cmd_2306(struct Message *out);
- #endif /* MODULE_PHBACKEND_H_ */
|