#ifndef  _ALIYUN_H
#define  _ALIYUN_H

#include "mqtt.h"


#define ALIYUN_DOMAIN     ".iot-as-mqtt.cn-shanghai.aliyuncs.com"      //阿里云域名固定后缀
#define ALIYUN_CLIENT_ID  "|securemode=3,signmethod=hmacsha1|"         //阿里云ClientID固定后缀
#define ALIYUN_CLIENT_ID2 "|securemode=3,signmethod=hmacsha1,timestamp=789|"

#define CLIENT_ID_KEY 		"clientId"
#define DEVICE_NAME_KEY 	"deviceName"
#define PRODUCTKEY_KEY 	  "productKey"

#define NET485_PRODUCTKEY    "a12hZXRHLLY"
#define NET485_DEVICE_NAME   "NET485_1"
#define NET485_DEVICE_SECRET "804be6c043218f8c6a70175278aeca78"

#define NET485_DEVICE2_NAME   "NET485_2"
#define NET485_DEVICE2_SECRET "590301f6291563957d96a329df8a6254"

#define NET485_PUBLISH    "/a12hZXRHLLY/NET485_1/user/post"
#define NET485_SUBLISH    "/a12hZXRHLLY/NET485_1/user/get"

#define NET485_PUBLISH2    "/a12hZXRHLLY/NET485_2/user/post"
#define NET485_SUBLISH2    "/a12hZXRHLLY/NET485_2/user/get"

#define FRG_PRODUCTKEY    "a1STn6qUB4r"
#define FRG_DEVICE_NAME   "34D0B8108D15"
#define FRG_DEVICE_SECRET "xlRTX2JSU10Bqp9ldgf4gP79euLGVDxT"

#define FRG_PUBLISH_ALIY    "user/update"
#define FRG_PUBLISH    "/a1STn6qUB4r/34D0B8108D15/user/update"
#define FRG_SUBLISH    "/a1STn6qUB4r/34D0B8108D15/user/get"


#define DEF_PRODUCTKEY    "a1STn6qUB4r"
#define DEF_ALIY_PUBLISH  "user/update"
#define DEF_ALIY_SUBLISH  "user/get"
#define DEF_ALIY_KEEPALIVE     120


#pragma pack(1)

typedef struct
{
	/*阿里云三要素*/
	UINT8 productKey[12];          //productKey
	UINT8 deviceName[65];         //设备名
	UINT8 deviceSecret[33];       //设备秘钥
	UINT8 publish[65];         		//阿里云发布地址（与MQTT发布订阅地址的区别在于，阿里云只需要传地址后缀（由程序拼接），mqtt需要完整的地址）
	UINT8 sublish[65];         		//阿里云订阅地址
	
	/*MQTT基本参数*/
	MQTT_DATA mqtt_data;
	
}ALIYUN_INFO;

#pragma pack()



UINT8 ALiYun_Machine_Init(MQTT_INFO* Mqtt_info, char* ProductKey, char* deviceName, char* DeviceSecret, char* sublish, int keepAliveInterval);
UINT8 ALIYUN_Flash_Parameter_Init(MQTT_INFO* Mqtt_info);






#endif






