| | |
| | | #define _PACKET_H_ |
| | | |
| | | #include <stdint.h> |
| | | #include <time.h> |
| | | |
| | | #define DEVID_LEN 16 |
| | | #define TIME_LEN 32 |
| | | |
| | | typedef struct pack_info_s |
| | | { |
| | | char devid[DEVID_LEN]; /* device ID */ |
| | | char strtime[TIME_LEN]; /* sample time */ |
| | | uint16_t temper; /* sample temperature */ |
| | | char devid[DEVID_LEN]; /* device ID */ |
| | | struct tm sample_time; /* sample time */ |
| | | uint16_t temper; /* sample temperature */ |
| | | } pack_info_t; |
| | | |
| | | /* packet function pointer type */ |
| | |
| | | */ |
| | | extern int get_devid(char *devid, int size, int sn); |
| | | |
| | | /* description: get current system in format "YYYY-MM-DD HH:MM:SS" |
| | | /* description: get current system in struct tm |
| | | * input args: |
| | | * $strtime: time string output buf |
| | | * $size : time string output buffer size |
| | | * $sample_time: sample time in struct tm |
| | | * return value: <0: failure 0:ok |
| | | */ |
| | | extern int get_time(char *strtime, int size); |
| | | extern int get_time(struct tm *sample_time); |
| | | |
| | | /* description: package a string packet in format "devid|time|temper" |
| | | * input args: |