AP05/main.h

87 lines
3.0 KiB
C
Raw Normal View History

2025-04-06 06:41:47 +00:00
#ifndef _MAIN_H
#define _MAIN_H
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <sys/time.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <linux/input.h>
#include <sys/syscall.h>
#include <linux/watchdog.h>
#define init_module(mod, len, opts) syscall(__NR_init_module, mod, len, opts)
char buf;
int wdt_val;
#define FEED_WATCHDOG buf = '1'; write(fdw,&buf,1) //喂狗
#define CLOSE_WDT buf = 'V'; write(fdw,&buf,1);close(fdw) //关闭看门狗
#define REBOOTTIME 3 //看门狗超时时间默认为14秒可设为1秒3秒和14秒
#define SET_WDT_TIMEOUT wdt_val = REBOOTTIME; ioctl(fdw,WDIOC_SETTIMEOUT,&wdt_val) //设置看门狗超时时间
#include "command.h"
#include "queue.h"
#include "uart_can.h"
#include "mqtt_utils.h"
#include "http_utils.h"
#include "md5.h"
#include "main.h"
#include "ping.h"
#include "Hmacsha1.h"
2025-06-12 03:04:36 +00:00
#include "mqtt/Base64.h"
2025-04-06 06:41:47 +00:00
typedef struct
{
uint32_t name;
uint16_t battery;
2025-05-04 10:17:27 +00:00
uint32_t time;
2025-04-06 06:41:47 +00:00
}__attribute__((packed)) jt_only_tag_t;
void myrand(char *randnum,int len);
void removeValueFromMystr(char *oristr,char *val);
void addValueToMystr(char *oristr,char *val);
int sizeofMystr(char *oristr);
void getCabinetNameFromMystr(char *oristr,char *laststr);
void checkDevice(void);
void sendDataFromCellNames(char *cellNames,char *cmd);
void resetCellFromCellNames(char *cellNames);
void repairCellFromCellNames(char *cellNames);
void powerOnAllUsb(void);
void shutDownAllLed(void);
void openAllDoors(void);
long getCurrentTime(void);
void getTimeStr(char *buffer,int len);
void getFirstValueFromMystr(char *oristr,char *val);
void removeStrFromMystr(char *oristr,char *removestr);
void reportEventToWeb(void);
void reportDbFromCellNames(char *cellNames);
void reportReturndevEventFromCellNames(char *cellNames);
void reportBorrowdevEventFromCellNames(char *cellNames);
void reportLosedevEventFromCellNames(char *cellNames);
void reportManagerEvent(char *eventType,char *opType,char *result);
void cleanOptypeInDbFromCellNames(char *cellNames);
void cleanOptypeInDbByCellName(char *cellName);
void handleQrcode(char *str);
//int buffer_to_file(const char *pathname, const char *data, unsigned int size,const char *mod);
char *file_to_buffer(const char *pathname, unsigned int *size);
void modifyMystr(char *oristr,char *laststr);
int getInnerValueFromStr(char *oristr, char *laststr);
void playAudio(char *num);
int split(const char* str, int strLen, const char* splitChar, int index, char* result, int maxLen);
void getDevInfo(char *devcode);
bool hgz_judge_sn_exist_devin(char *devsn);
bool hgz_judge_sn_exist_devout(char *devsn,char *cellname);
bool hgz_judge_cell_can_borrow(char *cellname);
void getDevRegisterStatus(char *devsn);
void hgz_get_returninfo_by_cellname(char *cellname,int *userid,char *batchid,char *username,char *devsn);
void getDevInfo(char *parm);
void *actHandleQrcode(void *parm);
void updateStationInfo(char *msg_id);
#endif