smart-green-house/project_ZigBee/Projects/zstack/Samples/SampleApp/Source/demoapp.h

105 lines
2.7 KiB
C
Raw Normal View History

2023-10-28 18:00:47 +08:00
#ifndef __DEMOAPP_H__
#define __DEMOAPP_H__
#include "stdio.h"
#include "AF.h"
struct adjust_info{
signed char temp_min;
signed char temp_max;
signed char humi_min;
signed char humi_max;
signed char temp_curr;
signed char humi_curr;
char temp_c_ops[30];
char humi_c_ops[30];
char temp_c_mode[10];
char humi_c_mode[10];
signed char temps_adjust_period;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>λ(<60),<2C><><EFBFBD>Dzɼ<C7B2><C9BC><EFBFBD><EFBFBD>ݵ<EFBFBD>Ƶ<EFBFBD><C6B5>
signed char humis_adjust_period;//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>λ(<60),<2C><><EFBFBD>Dzɼ<C7B2><C9BC><EFBFBD><EFBFBD>ݵ<EFBFBD>Ƶ<EFBFBD><C6B5>
//signed char temps_auto;
//signed char humis_auto;
};
#define TEMPS_ADJUST_MIN_DEF 24//Ĭ<><C4AC>ֵ
#define TEMPS_ADJUST_MAX_DEF 25//Ĭ<><C4AC>ֵ
#define HUMIS_ADJUST_MIN_DEF 40//Ĭ<><C4AC>ֵ
#define HUMIS_ADJUST_MAX_DEF 50//Ĭ<><C4AC>ֵ
#define SET_TEMP_ADJUST_OPEN "set_temp_adjust=open"
#define SET_TEMP_ADJUST_CLOSE "set_temp_adjust=close"
#define SET_HUMI_ADJUST_OPEN "set_humi_adjust=open"
#define SET_HUMI_ADJUST_CLOSE "set_humi_adjust=close"
#define AUTO_CTRL_MODE "auto"
#define MANUAL_CTRL_MODE "manual"
#define __DEBUG__
#ifdef __DEBUG__
#define debug(format,...) printf("L%04d:"format, __LINE__, ##__VA_ARGS__)
#define debug_raw(format,...) printf(format, ##__VA_ARGS__)
#else
#define debug(format,...)
#define debug_raw(format,...)
#endif
struct join_info{//<2F><><EFBFBD><EFBFBD><EFBFBD>ն<EFBFBD><D5B6><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD>ļ<EFBFBD>ֵ<EFBFBD><D6B5>
uint16 type;
uint16 addr;
};
#define CTRL_OR_GATHER 0 //0<><30>ʾ<EFBFBD><CABE>ʪ<EFBFBD>Ȳɼ<C8B2><C9BC>ڵ<EFBFBD>,1<><31>ʾ<EFBFBD><CABE><EFBFBD>ƽڵ<C6BD>
#define CLIENT_AFFIRM "affirm"
#define SAMPLEAPP_PROFID 0x0F08
#define SAMPLEAPP_DEVICEID 0x0001
#define SAMPLEAPP_DEVICE_VERSION 0
#define SAMPLEAPP_FLAGS 0
#define SAMPLEAPP_COORD_SEND 0
#define SAMPLEAPP_SENSOR_CLUSTERID 1
#define SAMPLEAPP_CTRL_CLUSTERID 2
#define SAMPLEAPP_MAX_CLUSTERS 2
#define SAMPLEAPP_SEND_PERIODIC_MSG_EVT 0x0001
#define SENSOR_PERIODIC_REPORTED 5000
#define UART_RECV_LEN 60
#define MY_ENDPOINT 20
#define SWITCH_LED_OPEN 1
#define SWITCH_LED_CLOSE 0
#define SWITCH_LED P1_3
#define LOCAL_LED1 P1_0
#define LOCAL_LED2 P1_1
#define DEMO_KEYBOARD_1 (1<<1)
#define DEMO_KEYBOARD_2 (1<<2)
#define DEMO_GET_TH (1<<3)
#define GET_DATA "get_data"
#define SET_DATA "set_data"
#define PERIODIC_REPORT_TH "periodic_th"
extern uint8 my_TaskID;
extern uint16 my_ProcessEvent( uint8 task_id, uint16 events );
extern void my_Init( uint8 task_id );
extern void my_MessageMSGCB( afIncomingMSGPacket_t *pkt );
extern void my_SendPointToPointMessage(uint8 obj,uint8 *str);
extern void send_coord_affirm(uint16 cid);
extern void send_to_gateway(char *str);
extern void serial_dispos(uint8 port,uint8 len,uint8 *str);
extern void coord_th_dispose(unsigned char *th);
extern void get_th_send_to_coord(char *head);
#endif //__DEMOAPP_H__