提交一款正式版本
This commit is contained in:
parent
ab83a29699
commit
e11d8ec822
|
@ -30,12 +30,12 @@
|
||||||
|
|
||||||
|
|
||||||
// 正式平台链接
|
// 正式平台链接
|
||||||
// #define SYS_IOT_URL ("8.130.122.162")
|
#define SYS_IOT_URL ("8.130.122.162")
|
||||||
// #define SYS_IOT_PORT ("7153")
|
#define SYS_IOT_PORT ("7153")
|
||||||
|
|
||||||
//测试平台链接
|
//测试平台链接
|
||||||
#define SYS_IOT_URL ("8.130.105.38")
|
// #define SYS_IOT_URL ("8.130.105.38")
|
||||||
#define SYS_IOT_PORT ("7133")
|
// #define SYS_IOT_PORT ("7133")
|
||||||
|
|
||||||
|
|
||||||
#define K (8 * 1000)
|
#define K (8 * 1000)
|
||||||
|
|
|
@ -12,14 +12,12 @@
|
||||||
#include <at_device_ml307.h>
|
#include <at_device_ml307.h>
|
||||||
#include "drv_gpio.h"
|
#include "drv_gpio.h"
|
||||||
|
|
||||||
|
|
||||||
#define MAX_VALVE_NUM 8
|
#define MAX_VALVE_NUM 8
|
||||||
|
|
||||||
|
#define ML307_ENABLE_3_8_V GET_PIN(B, 3)
|
||||||
#define ML307_ENABLE_3_8_V GET_PIN (B, 3)
|
#define ML307_PWR_PIN GET_PIN(B, 4)
|
||||||
#define ML307_PWR_PIN GET_PIN (B, 4)
|
#define ML307_RST_PIN GET_PIN(B, 5)
|
||||||
#define ML307_RST_PIN GET_PIN (B, 5)
|
#define ML307_USIM_DECT_PIN GET_PIN(B, 6)
|
||||||
#define ML307_USIM_DECT_PIN GET_PIN (B, 6)
|
|
||||||
|
|
||||||
#define ML307_SAMPLE_DEIVCE_NAME "ml307"
|
#define ML307_SAMPLE_DEIVCE_NAME "ml307"
|
||||||
|
|
||||||
|
@ -34,7 +32,7 @@
|
||||||
#define CMD_TYPE_INSTRUCTION_REPLY 0x14 // 命令类型 - 指令下发回复 (设备->平台)
|
#define CMD_TYPE_INSTRUCTION_REPLY 0x14 // 命令类型 - 指令下发回复 (设备->平台)
|
||||||
#define CMD_TYPE_TIME_CALIBRATION 0x15 // 命令类型 - 时间校准 (设备->平台)
|
#define CMD_TYPE_TIME_CALIBRATION 0x15 // 命令类型 - 时间校准 (设备->平台)
|
||||||
|
|
||||||
#define PROTOCOL_VERSION 0x11 /*协议版本*/
|
#define PROTOCOL_VERSION 0x42 /*协议版本*/
|
||||||
/*数据序列号*/
|
/*数据序列号*/
|
||||||
#define DATA_SERIAL_NUM 0x0001 // 1
|
#define DATA_SERIAL_NUM 0x0001 // 1
|
||||||
|
|
||||||
|
@ -81,7 +79,6 @@
|
||||||
#define INSTRUCTION_DOWN_VALVE_REPLACE 0x62 // 更换阀门设备
|
#define INSTRUCTION_DOWN_VALVE_REPLACE 0x62 // 更换阀门设备
|
||||||
#define INSTRUCTION_DOWN_VALVE_REMOVE 0x63 // 移除阀门设备
|
#define INSTRUCTION_DOWN_VALVE_REMOVE 0x63 // 移除阀门设备
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************************************************/
|
/************************************************************************************************************/
|
||||||
#define RESPONSE_CODE_SUCCESS 0x00 // 响应码 - 操作成功
|
#define RESPONSE_CODE_SUCCESS 0x00 // 响应码 - 操作成功
|
||||||
#define RESPONSE_CODE_CRC_FAIL 0x01 // 响应码 - CRC 校验失败
|
#define RESPONSE_CODE_CRC_FAIL 0x01 // 响应码 - CRC 校验失败
|
||||||
|
@ -158,7 +155,7 @@ typedef struct
|
||||||
*/
|
*/
|
||||||
typedef struct valve_t valve_data;
|
typedef struct valve_t valve_data;
|
||||||
|
|
||||||
struct __attribute__ ((packed)) valve_t
|
struct __attribute__((packed)) valve_t
|
||||||
{
|
{
|
||||||
uint8_t valve_id;
|
uint8_t valve_id;
|
||||||
uint8_t valve_mac[6];
|
uint8_t valve_mac[6];
|
||||||
|
@ -168,10 +165,10 @@ struct __attribute__ ((packed)) valve_t
|
||||||
uint32_t valve_in_pressure;
|
uint32_t valve_in_pressure;
|
||||||
uint32_t valve_out_pressure;
|
uint32_t valve_out_pressure;
|
||||||
uint32_t valve_atm_pressure;
|
uint32_t valve_atm_pressure;
|
||||||
uint8_t valve_voltage;//阀门电池电压
|
uint8_t valve_voltage; // 阀门电池电压
|
||||||
};
|
};
|
||||||
|
|
||||||
struct __attribute__ ((packed)) DataBody
|
struct __attribute__((packed)) DataBody
|
||||||
{
|
{
|
||||||
uint8_t device_type; // 设备类型
|
uint8_t device_type; // 设备类型
|
||||||
uint8_t event_type; // 事件类型
|
uint8_t event_type; // 事件类型
|
||||||
|
@ -191,7 +188,7 @@ struct __attribute__ ((packed)) DataBody
|
||||||
};
|
};
|
||||||
|
|
||||||
// 定义数据帧结构体
|
// 定义数据帧结构体
|
||||||
struct __attribute__ ((packed)) Ml307DataFrame
|
struct __attribute__((packed)) Ml307DataFrame
|
||||||
{
|
{
|
||||||
uint8_t header[3]; // 帧头
|
uint8_t header[3]; // 帧头
|
||||||
uint8_t version; // 协议版本
|
uint8_t version; // 协议版本
|
||||||
|
@ -204,7 +201,7 @@ struct __attribute__ ((packed)) Ml307DataFrame
|
||||||
uint8_t tail[3]; // 帧尾
|
uint8_t tail[3]; // 帧尾
|
||||||
};
|
};
|
||||||
|
|
||||||
struct __attribute__ ((packed)) Ml307Data
|
struct __attribute__((packed)) Ml307Data
|
||||||
{
|
{
|
||||||
rt_uint8_t device_type; // 设备类型
|
rt_uint8_t device_type; // 设备类型
|
||||||
rt_uint8_t event_type; // 事件类型
|
rt_uint8_t event_type; // 事件类型
|
||||||
|
@ -212,7 +209,7 @@ struct __attribute__ ((packed)) Ml307Data
|
||||||
rt_uint8_t res_num;
|
rt_uint8_t res_num;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct __attribute__ ((packed)) Ml307RecvData
|
struct __attribute__((packed)) Ml307RecvData
|
||||||
{
|
{
|
||||||
rt_uint8_t header[3]; // 帧头
|
rt_uint8_t header[3]; // 帧头
|
||||||
rt_uint8_t version; // 协议版本
|
rt_uint8_t version; // 协议版本
|
||||||
|
@ -230,11 +227,11 @@ struct Ml307_Ops
|
||||||
struct DataBody *body;
|
struct DataBody *body;
|
||||||
struct Ml307DataFrame *frame;
|
struct Ml307DataFrame *frame;
|
||||||
struct Ml307RecvData *recv;
|
struct Ml307RecvData *recv;
|
||||||
int (*init) (struct Ml307_Ops *ops, rt_uint8_t version);
|
int (*init)(struct Ml307_Ops *ops, rt_uint8_t version);
|
||||||
int (*update_data) (struct Ml307_Ops *ops, rt_uint8_t device_type, rt_uint8_t cmd);
|
int (*update_data)(struct Ml307_Ops *ops, rt_uint8_t device_type, rt_uint8_t cmd);
|
||||||
int (*send) (struct Ml307_Ops *ops, rt_uint8_t data_num, rt_uint8_t cmd, rt_uint8_t device_type, rt_uint8_t event_type);
|
int (*send)(struct Ml307_Ops *ops, rt_uint8_t data_num, rt_uint8_t cmd, rt_uint8_t device_type, rt_uint8_t event_type);
|
||||||
int (*Resp) (struct Ml307_Ops *ops, rt_uint8_t data_num, rt_uint8_t cmd, rt_uint8_t device_type, rt_uint8_t event_type, char *data, rt_uint8_t res);
|
int (*Resp)(struct Ml307_Ops *ops, rt_uint8_t data_num, rt_uint8_t cmd, rt_uint8_t device_type, rt_uint8_t event_type, char *data, rt_uint8_t res);
|
||||||
int (*Recv) (struct Ml307_Ops *ops, char *data); // 解析数据
|
int (*Recv)(struct Ml307_Ops *ops, char *data); // 解析数据
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct Ml307_Ops ml307_ops;
|
extern struct Ml307_Ops ml307_ops;
|
||||||
|
@ -249,7 +246,6 @@ extern rt_uint8_t ml307_disconnect_pdp_flag;
|
||||||
extern rt_uint8_t power_on_send_flag;
|
extern rt_uint8_t power_on_send_flag;
|
||||||
extern rt_uint8_t ml307_power_down_flag;
|
extern rt_uint8_t ml307_power_down_flag;
|
||||||
|
|
||||||
|
void Ml307_Send_Event(Ml307Event event_type);
|
||||||
void Ml307_Send_Event (Ml307Event event_type);
|
int ml307_device_register(void);
|
||||||
int ml307_device_register (void);
|
int BSP_Ml307_Thread_Init(void);
|
||||||
int BSP_Ml307_Thread_Init (void);
|
|
||||||
|
|
Loading…
Reference in New Issue