收藏官网首页
楼主: jipin

【Gokit】从0开始实现智能插座(PCB、源码等开源)

 

2

主题

16

帖子

690

积分

高级会员

Rank: 4

积分
690
29#
发表于 2016-8-6 11:15:01 | 只看该作者
免费使用STM32、APP自动代码生成工具
楼主辛苦了,写的很详细

20

主题

112

帖子

1626

积分

金牌会员

Rank: 6Rank: 6

积分
1626
27#
 楼主| 发表于 2016-8-5 22:29:53 | 只看该作者
登入后台,点硬件接入,然后新建一个设备,才有这个product_key

8

主题

42

帖子

1666

积分

金牌会员

Rank: 6Rank: 6

积分
1666
26#
发表于 2016-8-5 16:43:07 | 只看该作者
我想请问一下楼主三个信息里面窝只找到两个App ID 和App Secret 那个product_key没找到?请问这个是在哪里呢?

0

主题

4

帖子

93

积分

注册会员

Rank: 2

积分
93
25#
发表于 2016-8-5 15:11:03 | 只看该作者
教您5分钟接入机智云,实现傻瓜式开发
楼主我可以加你微信或QQ吗,我也在做智能插座

0

主题

4

帖子

93

积分

注册会员

Rank: 2

积分
93
24#
发表于 2016-8-5 15:10:26 | 只看该作者
电量是怎么实现的

20

主题

112

帖子

1626

积分

金牌会员

Rank: 6Rank: 6

积分
1626
23#
 楼主| 发表于 2016-8-5 08:28:34 | 只看该作者
飞翔中的语言 发表于 2016-8-4 21:01
楼主厉害,请问一下那个源码APP可不可以像您之前设想的那样在此APP里面增添一到两个插座可以定时控制,可以 ...

在APP 里可以增加几组定时,MCU程序里面也要相应处理

8

主题

42

帖子

1666

积分

金牌会员

Rank: 6Rank: 6

积分
1666
22#
发表于 2016-8-4 21:01:53 | 只看该作者
楼主厉害,请问一下那个源码APP可不可以像您之前设想的那样在此APP里面增添一到两个插座可以定时控制,可以连贯性控制对于顾客来说是一个非常愿意接受的产品,谢谢楼主好人,在此留下点建议,因为本人能力不怎么样,希望楼主更好的创新下去。

0

主题

2

帖子

5

积分

新手上路

Rank: 1

积分
5
21#
发表于 2016-8-4 18:30:42 | 只看该作者
多谢这么纤细的分享,辛苦了

20

主题

112

帖子

1626

积分

金牌会员

Rank: 6Rank: 6

积分
1626
20#
 楼主| 发表于 2016-8-2 20:52:40 | 只看该作者
汉枫LPB120模块
微信宠物屋 for GoKit 2 STM V03010100 增加了点中文注释,也不是很全。主要是机智云给出的注释太少了,机智云把代码都好了,居然还差一点注释。增加了理解代码的时间。
原代码下载http://site.gizwits.com/zh-cn/de ... hardware?type=GoKit
注释完整代码下载http://pan.baidu.com/s/1b779P8

点评

可以重发下网盘地址吗?失效了  详情 回复 发表于 2021-10-27 17:25

20

主题

112

帖子

1626

积分

金牌会员

Rank: 6Rank: 6

积分
1626
19#
 楼主| 发表于 2016-8-2 13:32:26 | 只看该作者
智能插座MCU
完整源代码 请在这里下载 http://pan.baidu.com/s/1c20sgRe

文件夹说明
GAgent ---- 最新版本的GAgent ESP8266里运行的程序,如果你们是拿到机智云的开发板,就不用更新
Gizwits-SmartSocket_Android  ---- 开源的公版智能云插座APP,修改里面三个参数就可以绑定自己的设备了
智能云插座基于公版stm32_V2.3.2 ---- 这个就是我修改的源码
GoKitV2.1硬件开发板  ------机智云开发板的原理图

20

主题

112

帖子

1626

积分

金牌会员

Rank: 6Rank: 6

积分
1626
18#
 楼主| 发表于 2016-8-1 17:44:45 | 只看该作者
我这个没有,插座也可以应用到很多地方,定时充电,虽然手机有保护功能,但也有意外,我在用小K智能插座定时关空调,但他的APP反应慢。

0

主题

4

帖子

62

积分

注册会员

Rank: 2

积分
62
17#
发表于 2016-8-1 16:28:57 | 只看该作者
看样子楼主已经做好了?,不过空调定时这个功能,空调自身就有吧?

20

主题

112

帖子

1626

积分

金牌会员

Rank: 6Rank: 6

积分
1626
16#
 楼主| 发表于 2016-7-29 17:55:24 | 只看该作者
第一部分:修改公版APP
第二部分:修改GOKIT MCU源码
第三部分:用GOKIT开发板验证功能
第四部分:用公模插座外壳做自己的智能插座
前面三个部分都有了。现在是要做最后的一个部分。根据公模外壳,画原理图,设计PCB,打样,焊接元器件,调试程序。出样品。这些过程。
前面几个步骤都做完了,但我自己还不能真正使用智能云插座去操作开与关。
前面都是过程。最后实物需要第四部分完成。
如果看到这里,你产生了和我一样的想法,制作出实物来。那么我们可以一起去做。
我们就可以共同拥有它了。

外壳选择










20

主题

112

帖子

1626

积分

金牌会员

Rank: 6Rank: 6

积分
1626
15#
 楼主| 发表于 2016-7-29 17:45:55 | 只看该作者
汉枫LPB120模块













开发板测试数据

20

主题

112

帖子

1626

积分

金牌会员

Rank: 6Rank: 6

积分
1626
14#
 楼主| 发表于 2016-7-29 17:38:21 | 只看该作者
PROTOCOL.h
#ifndef _PROTOCOL_H
#define _PROTOCOL_H

#include <stdio.h>
#include <stdbool.h>
#include <stm32f10x.h>


#define SoftAp_Mode    0x01
#define AirLink_Mode   0x02

#define MAX_P0_LEN                        128                                                                    //p0数据最大长度
#define MAX_PACKAGE_LEN                (MAX_P0_LEN*2)                   //数据缓冲区最大长度
#define MAX_RINGBUFFER_LEN        MAX_PACKAGE_LEN  //环形缓冲区最大长度
#define Max_UartBuf         MAX_PACKAGE_LEN  //串口数据缓冲区最大长度


#define PROTOCOL_DEBUG //调试通信数据信息宏开关
#define DEBUG          //系统运行调试信息

#define Send_MaxTime   300
#define Send_MaxNum    3

#define                PRO_VER                                                                                                                                "00000004"
#define                P0_VER                                                                                                                                "00000004"
#define                HARD_VER                                                                                                                        "02030100"
#define                SOFT_VER                                                                                                                        "02030003"
#define                PRODUCT_KEY                                                                                                                "8a2d232e861e4de1843b7b827debe57d"//宠物屋PRODUCT_KEY717c14293174447eb27c90e084e46344

__packed        typedef struct
{
    uint8_t                                     Message_Buf[Max_UartBuf]; //串口接收缓冲区
    uint8_t                                     Message_Len;                  //接受到的数据长度
} UART_HandleTypeDef;

/*命令码*/
typedef enum
{
    Pro_W2D_GetDeviceInfo_Cmd                                                 = 0x01,
    Pro_D2W__GetDeviceInfo_Ack_Cmd                                = 0x02,

    Pro_W2D_P0_Cmd                                                                         = 0x03,
    Pro_D2W_P0_Ack_Cmd                                                        = 0x04,

    Pro_D2W_P0_Cmd                                                                         = 0x05,
    Pro_W2D_P0_Ack_Cmd                                                        = 0x06,

    Pro_W2D_Heartbeat_Cmd                                                 = 0x07,
    Pro_D2W_heartbeatAck_Cmd                                        = 0x08,

    Pro_D2W_ControlWifi_Config_Cmd                                         = 0x09,
    Pro_W2D_ControlWifi_Config_Ack_Cmd                        = 0x0A,

    Pro_D2W_ResetWifi_Cmd                                                 = 0x0B,
    Pro_W2D_ResetWifi_Ack_Cmd                                        = 0x0C,

    Pro_W2D_ReportWifiStatus_Cmd                                         = 0x0D,
    Pro_D2W_ReportWifiStatus_Ack_Cmd                        = 0x0E,

    Pro_W2D_ReportMCUReset_Cmd                                                 = 0x0F,
    Pro_D2W_ReportMCUReset_Ack_Cmd                                = 0x10,

    Pro_W2D_ErrorPackage_Cmd                                                 = 0x11,
    Pro_D2W_ErrorPackage_Ack_Cmd                                = 0x12,

        /*7.28*/
                Pro_Get_Network_Time_Cmd                             =0x17,//获取网络时间
                Pro_Get_Network_Time_Ack_Cmd                         =0x18,//回复获取网络时间

} Pro_CmdTypeDef;


typedef enum
{
    SetLED_OnOff    = 0x01,
    SetLED_Color    = 0x02,
    SetLED_R               = 0x04,
    SetLED_G            = 0x08,
    SetLED_B                  = 0x10,
    SetMotor                = 0x20,

} Attr_FlagsTypeDef;

typedef enum
{
    LED_OnOff         = 0x00,
    LED_OnOn          = 0x01,
    Time_OnOff        = 0x00,
    Time_OnOn                      = 0x02,
    Week_OnOff            = 0x00,
    Week_OnOn                  = 0x04,

} LED_ColorTypeDef;


/************************************
* 重发机制结构体
**************************************/
__packed        typedef struct
{
    uint32_t        SendTime;//重发的系统时间
    uint8_t                                        SendNum;//重发次数
    uint8_t                                        Flag;//1,表示有需要等待的ACK;0,表示无需要等待的ACK
    uint16_t        ResendBufLen;
    uint8_t                                        Cmd_Buff[Max_UartBuf];//重发数据缓冲区
} Pro_Wait_AckTypeDef;


/************************************
* 协议标准头
**************************************/
__packed        typedef struct
{
    uint8_t                                                        Head[2];
    uint16_t                                                Len;
    uint8_t                                                        Cmd;
    uint8_t                                                        SN;
    uint8_t                                                        Flags[2];

} Pro_HeadPartTypeDef;

/************************************
* 4.1  WiFi模组请求设备信息
**************************************/
__packed        typedef struct
{
    Pro_HeadPartTypeDef                                          Pro_HeadPart;
    uint8_t                                                                                                Pro_ver[8];
    uint8_t                                                                                                P0_ver[8];
    uint8_t                                                                                                Hard_ver[8];
    uint8_t                                                                                                Soft_ver[8];
    uint8_t                                                                                                Product_Key[32];
    uint16_t                                                                                        Binable_Time;
    uint8_t                                                                                                Sum;

} Pro_M2W_ReturnInfoTypeDef;

/************************************
* 协议通用数据帧(4.2、4.4、4.6、4.9、4.10)
************************************/
__packed        typedef struct
{
    Pro_HeadPartTypeDef            Pro_HeadPart;
    uint8_t                                                                        Sum;
} Pro_CommonCmdTypeDef;


/************************************
* 4.3 设备MCU通知WiFi模组进入配置模式
**************************************/
__packed        typedef struct
{
    Pro_HeadPartTypeDef                          Pro_HeadPart;
    uint8_t                         Config_Method;
    uint8_t                                                                                Sum;
} Pro_D2W_ConfigWifiTypeDef;


/************************************
* WiFi模组工作状态
************************************/
#define                 Wifi_SoftAPMode                                       (uint8_t)(1<<0)    //SoftAP
#define                 Wifi_StationMode                          (uint8_t)(1<<1)    //Station
#define                 Wifi_ConfigMode                                 (uint8_t)(1<<2)    //
#define                 Wifi_BindingMode                                             (uint8_t)(1<<3)    //
#define     Wifi_ConnRouter                     (uint8_t)(1<<4)    //
#define     Wifi_ConnClouds                     (uint8_t)(1<<5)    //Connect OK
/************************************
* 4.5 WiFi模组向MCU通知WiFi模组工作状态的变化
************************************/
__packed        typedef struct
{
    Pro_HeadPartTypeDef            Pro_HeadPart;
    uint16_t                Wifi_Status;
    uint8_t                                                                        Sum;
} Pro_W2D_WifiStatusTypeDef;
/************************************
* 4.13获取网络时间
************************************/
__packed        typedef struct
{
    Pro_HeadPartTypeDef            Pro_HeadPart;
    uint16_t                year;
          uint8_t                 month;
          uint8_t                 day;
          uint8_t                 hour;
          uint8_t                 minute;
          uint8_t                 second;
          uint32_t                other;
    uint8_t                                                                        Sum;
} Pro_W2D_GetTimeTypeDef;
/************************************
* 非法报文类型
************************************/
typedef enum
{
    Error_AckSum = 0x01,      //校验错误
    Error_Cmd          = 0x02,          //命令码错误
    Error_Other  = 0x03,      //其他
} Error_PacketsTypeDef;


/************************************
* 4.7 非法消息通知
************************************/
__packed        typedef struct
{
    Pro_HeadPartTypeDef                  Pro_HeadPart;
    Error_PacketsTypeDef                Error_Packets;
    uint8_t                                                                        Sum;
} Pro_ErrorCmdTypeDef;


/************************************
* P0 command 命令码
************************************/
typedef enum
{
    P0_W2D_Control_Devce_Action                         = 0x01,
    P0_W2D_ReadDevStatus_Action                         = 0x02,
    P0_D2W_ReadDevStatus_Action_ACK         = 0x03,
    P0_D2W_ReportDevStatus_Action           = 0X04,

} P0_ActionTypeDef;


/************************************
* P0报文标准头
**************************************/
__packed        typedef struct
{
    Pro_HeadPartTypeDef                          Pro_HeadPart;
    P0_ActionTypeDef                Action;
} Pro_HeadPartP0CmdTypeDef;

short        exchangeBytes(short        value);
uint8_t CheckSum( uint8_t *buf, int packLen );
void GizWits_init(uint8_t P0_Len);
void GizWits_D2WResetCmd(void);
void GizWits_D2WGetCmd(void);//获取网络时间
void GizWits_D2WConfigCmd(uint8_t WiFi_Mode);
void GizWits_DevStatusUpgrade(uint8_t *P0_Buff, uint32_t Time, uint8_t flag);
void GizWits_WiFiStatueHandle(uint16_t wifiStatue);
u8 GizWits_MessageHandle(u8 * Message_Buf, u8 Length_buf);

#endif /*_PROTOCOL_H*/

20

主题

112

帖子

1626

积分

金牌会员

Rank: 6Rank: 6

积分
1626
13#
 楼主| 发表于 2016-7-29 17:37:35 | 只看该作者
    4.4 设备MCU重置WiFi模组
    MCU发:
    Header(2B)__LEN(2B)__CMD(1B)__sn(1B)__falg(2B)__CheckSum(1B)
    0xFFFF      0x0005   0x0B      0x##    0x0000   0x##
    WiFi回复:
    Header(2B)__LEN(2B)__CMD(1B)__sn(1B)__falg(2B)__CheckSum(1B)
    0xFFFF      0x0005   0x0C      0x##    0x0000    0x##

    Pro_CommonCmdTypeDef {
        Pro_HeadPartTypeDef {
            uint8_t                                                        Head[2];
            uint16_t                                                Len;
            uint8_t                                                        Cmd;
            uint8_t                                                        SN;
            uint8_t                                                        Flags[2];
        }
        uint8_t                                        Sum;
    }
*/
void GizWits_D2WResetCmd(void)
{
    Pro_CommonCmdTypeDef Pro_D2WReset;

    Pro_D2WReset.Pro_HeadPart.Head[0] = 0xFF;
    Pro_D2WReset.Pro_HeadPart.Head[1] = 0xFF;
    Pro_D2WReset.Pro_HeadPart.Len = exchangeBytes(sizeof(Pro_CommonCmdTypeDef) - 4);
    Pro_D2WReset.Pro_HeadPart.Cmd = Pro_D2W_ResetWifi_Cmd;//0x0B
    Pro_D2WReset.Pro_HeadPart.SN = SN++;
    Pro_D2WReset.Pro_HeadPart.Flags[0] = 0x00;
    Pro_D2WReset.Pro_HeadPart.Flags[1] = 0x00;
    Pro_D2WReset.Sum = CheckSum((uint8_t *)&Pro_D2WReset, sizeof(Pro_CommonCmdTypeDef));
    Pro_UART_SendBuf((uint8_t *)&Pro_D2WReset, sizeof(Pro_CommonCmdTypeDef), 1);//tag=1,需要等待WiFi应答的Ack

#ifdef PROTOCOL_DEBUG
    printf("[%d] MCU   : ", SystemTimeCount);
    for(uint16_t i=0; i<sizeof(Pro_CommonCmdTypeDef); i++)
    {
        printf("%2x ", *((uint8_t *)&Pro_D2WReset + i));
    }
    printf("\r\n");
#endif
}
/*
    4.3 设备MCU通知WiFi模组进入配置模式
    MCU发:
    Header(2B)__LEN(2B)__CMD(1B)__sn(1B)__falg(2B)__ConfigMethod(1B)__CheckSum(1B)
    0xFFFF      0x0006   0x09      0x##    0x0000    SoftAp/AirLink   0x##
    WiFi回复:
    Header(2B)__LEN(2B)__CMD(1B)__sn(1B)__falg(2B)__CheckSum(1B)
    0xFFFF      0x0005   0x0A      0x##    0x0000    0x##
   
    用到了
    Pro_D2W_ConfigWifiTypeDef{
        Pro_HeadPartTypeDef{
            uint8_t                                                        Head[2];
            uint16_t                                                Len;
            uint8_t                                                        Cmd;
            uint8_t                                                        SN;
            uint8_t                                                        Flags[2];
        }
        uint8_t                         Config_Method;
        uint8_t                                                Sum;
    }
*/
void GizWits_D2WConfigCmd(uint8_t WiFi_Mode)
{
    Pro_D2W_ConfigWifiTypeDef Pro_D2WConfigWiFiMode;

    Pro_D2WConfigWiFiMode.Pro_HeadPart.Head[0] = 0xFF;
    Pro_D2WConfigWiFiMode.Pro_HeadPart.Head[1] = 0xFF;
    Pro_D2WConfigWiFiMode.Pro_HeadPart.Len = exchangeBytes(sizeof(Pro_D2W_ConfigWifiTypeDef) - 4);
    Pro_D2WConfigWiFiMode.Pro_HeadPart.Cmd = Pro_D2W_ControlWifi_Config_Cmd;
    Pro_D2WConfigWiFiMode.Pro_HeadPart.SN = SN++;
    Pro_D2WConfigWiFiMode.Pro_HeadPart.Flags[0] = 0x00;
    Pro_D2WConfigWiFiMode.Pro_HeadPart.Flags[1] = 0x00;
    Pro_D2WConfigWiFiMode.Config_Method = WiFi_Mode;
    Pro_D2WConfigWiFiMode.Sum = CheckSum((uint8_t *)&Pro_D2WConfigWiFiMode, sizeof(Pro_D2W_ConfigWifiTypeDef));
    Pro_UART_SendBuf((uint8_t *)&Pro_D2WConfigWiFiMode, sizeof(Pro_D2W_ConfigWifiTypeDef), 1);

#ifdef PROTOCOL_DEBUG
    printf("[%d] MCU   : ", SystemTimeCount);
    for(uint16_t i=0; i<sizeof(Pro_D2W_ConfigWifiTypeDef); i++)
    {
        printf("%2x ", *((uint8_t *)&Pro_D2WConfigWiFiMode + i));
    }
    printf("\r\n");
#endif
}
/*
发获取网络时间 的命令 现在还没有得到 CMD 0X17 0X18
*/
void GizWits_D2WGetCmd(void)
{
    Pro_CommonCmdTypeDef Pro_D2WGet;

    Pro_D2WGet.Pro_HeadPart.Head[0] = 0xFF;
    Pro_D2WGet.Pro_HeadPart.Head[1] = 0xFF;
    Pro_D2WGet.Pro_HeadPart.Len = exchangeBytes(sizeof(Pro_CommonCmdTypeDef) - 4);
    Pro_D2WGet.Pro_HeadPart.Cmd = Pro_Get_Network_Time_Cmd;//0x17
    Pro_D2WGet.Pro_HeadPart.SN = SN++;
    Pro_D2WGet.Pro_HeadPart.Flags[0] = 0x00;
    Pro_D2WGet.Pro_HeadPart.Flags[1] = 0x00;
    Pro_D2WGet.Sum = CheckSum((uint8_t *)&Pro_D2WGet, sizeof(Pro_CommonCmdTypeDef));
    Pro_UART_SendBuf((uint8_t *)&Pro_D2WGet, sizeof(Pro_CommonCmdTypeDef), 1);//tag=1,需要等待WiFi应答的Ack

#ifdef PROTOCOL_DEBUG
    printf("[%d] MCU   : ", SystemTimeCount);
    for(uint16_t i=0; i<sizeof(Pro_CommonCmdTypeDef); i++)
    {
        printf("%2x ", *((uint8_t *)&Pro_D2WGet + i));
    }
    printf("\r\n");
#endif
}
/*
    4.9 MCU主动上报当前状态
    flag=1,立即上报
    MCU发:
    Header(2B)__LEN(2B)__CMD(1B)__sn(1B)__falg(2B)__ActionBit(1B)__DevStatus(11B)__CheckSum(1B)
    0xFFFF      0x0011   0x05      0x##    0x0000   0x04           Bablabla        0x##
    WiFi回复:
    Header(2B)__LEN(2B)__CMD(1B)__sn(1B)__falg(2B)__CheckSum(1B)
    0xFFFF      0x0005   0x06      0x##    0x0000   0x##

    g_DevStatus就是ReadType的拷贝
*/
//10分钟定期上报
//Wifi控制时,上报频率不受限制
//用户更改Status时,上报频率 小于 2秒一次
void GizWits_DevStatusUpgrade(uint8_t *P0_Buff, uint32_t Time, uint8_t flag)
{
    uint8_t Report_Flag = 0;
    Pro_HeadPartP0CmdTypeDef *Pro_HeadPartP0Cmd = (Pro_HeadPartP0CmdTypeDef *)g_DevStatus;
            //Wait_AckStruct.Flag这个标志位也限制MCU上报数据
    //只要此标志置位,暂停上报
    //复位标志,则重新允许上报
    if(Wait_AckStruct.Flag == 1)
    {
        return;
    }
    if(flag == 1)
    {
        Report_Flag = 1;
        goto Report;
    }
    if((2 * 1000) < (SystemTimeCount - Last_ReportTime))//SystemTimeCount TIM3毫秒级中断过去了(2 * 1000)进入到 这里
    {
                        // 比较要上报的信息P0_Buff=ReadTypeDef,与原设备信息g_DevStatus
        if(memcmp(g_DevStatus + sizeof(Pro_HeadPartP0CmdTypeDef), P0_Buff, g_P0DataLen) != 0)
        {
            Report_Flag = 1;
        }
    }
                // Bug: Last_Report_10_Time从来没初始化 ,从0时间开始
                //Time 当前输入的定时时间
    if(Time < (SystemTimeCount-Last_Report_10_Time))
    {
                                printf("Last_Report_10_Time");
        Report_Flag = 1;
        Last_Report_10_Time = SystemTimeCount;
    }

Report:
    if(Report_Flag == 1)
    {
                         //就是这一句,把ReadTypeDef的值给了g_DevStatus
        memcpy(g_DevStatus + sizeof(Pro_HeadPartP0CmdTypeDef), P0_Buff, g_P0DataLen);

        Pro_HeadPartP0Cmd->Pro_HeadPart.Len = exchangeBytes(sizeof(Pro_HeadPartP0CmdTypeDef) + 1 + g_P0DataLen - 4);
        Pro_HeadPartP0Cmd->Pro_HeadPart.Cmd = Pro_D2W_P0_Cmd;
        Pro_HeadPartP0Cmd->Pro_HeadPart.SN = SN++;
        Pro_HeadPartP0Cmd->Action = P0_D2W_ReportDevStatus_Action;
        g_DevStatus[sizeof(Pro_HeadPartP0CmdTypeDef) + g_P0DataLen] = CheckSum(g_DevStatus, sizeof(Pro_HeadPartP0CmdTypeDef) + g_P0DataLen + 1);

        Pro_UART_SendBuf((uint8_t *)Pro_HeadPartP0Cmd, sizeof(Pro_HeadPartP0CmdTypeDef) + g_P0DataLen + 1, 1);//

        Last_ReportTime = SystemTimeCount;
        
#ifdef DEBUG
        printf("Report Sensor Data \r\n");
#endif        

#ifdef PROTOCOL_DEBUG
        printf("[%d] MCU   : ", SystemTimeCount);
        for(uint16_t i = 0; i < (sizeof(Pro_HeadPartP0CmdTypeDef) + g_P0DataLen + 1); i++)
        {
            printf("%2x ", g_DevStatus[i]);
        }
        printf("\r\n");
#endif
    }
    return;
}

20

主题

112

帖子

1626

积分

金牌会员

Rank: 6Rank: 6

积分
1626
12#
 楼主| 发表于 2016-7-29 17:37:18 | 只看该作者
/*****************************************************
* Function Name  : Pro_Pro_W2D_Heartbeat
    MCU回复WiFi模组要用的 通用协议帧:
    4.2 WiFi模组与设备MCU的心跳
    4.5 WiFi模组向MCU汇报工作状态
    4.6 WiFi模组请求重启MCU
    4.7 WiFi模组通知MCU得到非法消息
    4.10 WiFi模组控制更改MCU状态
    都用此方法
    然而
    4.1 WiFi请求MCU系统信息,MCU要回复系统信息
    4.3 MCU通知WiFi进入配网,WiFi发Ack
    4.4 MCU通知WiFi重启,WiFi发Ack
    4.8 WiFi读取MCU状态,MCU回复中要有设备信息和ActionBit位
    4.9 MCU主动上报,WiFi发应答Ack
    不用此法

    WiFi发:
    Header(2B)__LEN(2B)__CMD(1B)__sn(1B)__falg(2B)__CheckSum(1B)
    0xFFFF      0x0005   Cmd      0x##    0x0000    0x##
    MCU 回复:
    0xFFFF      0x0005   Cmd+1    0x##    0x0000    0x##
*****************************************************/
static void Pro_W2D_CommonCmdHandle(void)
{
    memcpy(&Pro_CommonCmdStruct, UART_HandleStruct.Message_Buf, sizeof(Pro_CommonCmdStruct));
    Pro_CommonCmdStruct.Pro_HeadPart.Len = exchangeBytes(sizeof(Pro_CommonCmdTypeDef) - 4);
        // 注意协议里规定 回复方Cmd+1 == 发送发Cmd
    Pro_CommonCmdStruct.Pro_HeadPart.Cmd = Pro_CommonCmdStruct.Pro_HeadPart.Cmd + 1;
    Pro_CommonCmdStruct.Sum = CheckSum((uint8_t *)&Pro_CommonCmdStruct, sizeof(Pro_CommonCmdStruct));
    Pro_UART_SendBuf((uint8_t *)&Pro_CommonCmdStruct, sizeof(Pro_CommonCmdStruct), 0);

#ifdef PROTOCOL_DEBUG
    printf("[%d] MCU   : ", SystemTimeCount);//打印系统时间
    for(uint16_t i=0; i<sizeof(Pro_CommonCmdStruct); i++)
    {
        printf("%2x ", *((uint8_t *)&Pro_CommonCmdStruct + i));
    }
    printf("\r\n");
#endif

    memset(&Pro_CommonCmdStruct, 0, sizeof(Pro_CommonCmdStruct));
}

/*****************************************************
* Function Name  : Pro_W2D_WifiStatusHandle
* Description    : 将WiFi的状态保存到 Pro_W2D_WifiStatusStruct中。并回复ACK
    4.5 WiFi模组向设备MCU通知WiFi模组工作状态
    WiFi发:
    Header(2B)__LEN(2B)__CMD(1B)__sn(1B)__falg(2B)__WiFiStatus(2B)__CheckSum(1B)
    0xFFFF      0x0007   0x0D      0x##    0x0000   ...             0x##
    MCU 回复:
    Header(2B)__LEN(2B)__CMD(1B)__sn(1B)__falg(2B)__CheckSum(1B)
    0xFFFF      0x0005   0x0E      0x##    0x0000    0x##

    Pro_W2D_WifiStatusTypeDef Pro_W2D_WifiStatusStruct
    {
        Pro_HeadPartTypeDef            Pro_HeadPart;
        uint16_t                Wifi_Status;
        uint8_t                                        Sum;
    }
*****************************************************/
void (*callBackFunc)(uint16_t);//函数指针
static void Pro_W2D_WifiStatusHandle(void)
{
        //将WiFi的状态保存到 Pro_W2D_WifiStatusStruct中
    memcpy(&Pro_W2D_WifiStatusStruct, UART_HandleStruct.Message_Buf, sizeof(Pro_W2D_WifiStatusStruct));
  //回复通用协议帧  
        Pro_W2D_CommonCmdHandle();
    callBackFunc  = GizWits_WiFiStatueHandle;
    (*callBackFunc)(exchangeBytes(Pro_W2D_WifiStatusStruct.Wifi_Status));
        printf("W2D_WifiStatusStruct.Wifi_Status=%d",Pro_W2D_WifiStatusStruct.Wifi_Status);
        if((exchangeBytes(Pro_W2D_WifiStatusStruct.Wifi_Status) & (1<<4))==(1<<4))
        {
                GizWits_D2WGetCmd();
        }
}

/********************************************
4.13获取网络时间解码,现在能得到当前时间信息
********************************************/
static void Pro_W2D_GetTimeHandle(void)
{
        //把接收到WIFI的时间存在Pro_W2D_GetTimeStruct结构体中
        memcpy(&Pro_W2D_GetTimeStruct,UART_HandleStruct.Message_Buf,sizeof(Pro_W2D_GetTimeStruct));
       
        Pro_W2D_GetTimeStruct.year=exchangeBytes(Pro_W2D_GetTimeStruct.year);
        printf("[%d] year   : ", Pro_W2D_GetTimeStruct.year);
        printf("[%d] month   : ", Pro_W2D_GetTimeStruct.month);
        printf("[%d] day   : ", Pro_W2D_GetTimeStruct.day);
        printf("[%d] hour   : ", Pro_W2D_GetTimeStruct.hour);
        printf("[%d] minute   : ", Pro_W2D_GetTimeStruct.minute);
        printf("[%d] second   : ", Pro_W2D_GetTimeStruct.second);
        printf("\r\n");
       
        RTC_Set(Pro_W2D_GetTimeStruct.year,Pro_W2D_GetTimeStruct.month,Pro_W2D_GetTimeStruct.day,Pro_W2D_GetTimeStruct.hour,Pro_W2D_GetTimeStruct.minute,Pro_W2D_GetTimeStruct.second);

}
/*****************************************************
* Function Name  : Pr0_W2D_RequestResetDeviceHandle
* Description    : WiFi模组请求复位设备MCU,MCU回复ACK,并执行设备复位
    4.6 WiFi模组请求重启MCU
    WiFi发:
    Header(2B)__LEN(2B)__CMD(1B)__sn(1B)__falg(2B)__CheckSum(1B)
    0xFFFF      0x0007   0x0F      0x##    0x0000    0x##
    MCU 回复:
    Header(2B)__LEN(2B)__CMD(1B)__sn(1B)__falg(2B)__CheckSum(1B)
    0xFFFF      0x0005   0x10      0x##    0x0000    0x##
*****************************************************/
void Pr0_W2D_RequestResetDeviceHandle(void)
{
    Pro_W2D_CommonCmdHandle();//回复通用协议帧
        uint32_t timeDelay = SystemTimeCount;
        /*Wait 600ms*/
        while((SystemTimeCount - timeDelay) <= 600)  //Wait 600ms
    printf("W2D_RequestResetDevice...\r\n");
    printf("MCU Restart...\r\n");

    /*******************MCU RESTART*******************/
    __set_FAULTMASK(1);
    NVIC_SystemReset();
    /****************************************************/
}


/*****************************************************
* Function Name  : Pro_W2D_ErrorCmdHandle
* Description    : WiFi发送收到非法信息通知,设备MCU回复ACK,并执行相应的动作
    4.7 非法消息通知
    WiFi发:
    Header(2B)__LEN(2B)__CMD(1B)__sn(1B)__falg(2B)__ErrorCode(1B)__CheckSum(1B)
    0xFFFF      0x0007   0x0F      0x##    0x0000   错误码         0x##
    MCU 回复:
    Header(2B)__LEN(2B)__CMD(1B)__sn(1B)__falg(2B)__ErrorCode(1B)__CheckSum(1B)
    0xFFFF      0x0005   0x10      0x##    0x0000   错误码         0x##
    可见,通信协议中,对非法消息根本没做处理。。。原样返回而已

    Pro_ErrorCmdTypeDef{
        Pro_HeadPartTypeDef{
            uint8_t                                                        Head[2];
            uint16_t                                                Len;
            uint8_t                                                        Cmd;
            uint8_t                                                        SN;
            uint8_t                                                        Flags[2];
        }
        Error_PacketsTypeDef                Error_Packets;
        uint8_t                                                Sum;
    }
   
    Error_PacketsTypeDef{
        Error_AckSum = 0x01,      //校验错误
        Error_Cmd          = 0x02,          //命令码错
        Error_Other  = 0x03,      //其他
    }
*****************************************************/
static void Pro_W2D_ErrorCmdHandle(Error_PacketsTypeDef errorType)
{
    uint8_t i;
    Pro_ErrorCmdTypeDef                    Pro_ErrorCmdStruct;
    memcpy(&Pro_ErrorCmdStruct, UART_HandleStruct.Message_Buf, sizeof(Pro_ErrorCmdStruct));

    Pro_ErrorCmdStruct.Pro_HeadPart.Len = exchangeBytes(sizeof(Pro_ErrorCmdStruct) - 4);
    Pro_ErrorCmdStruct.Pro_HeadPart.Cmd = Pro_D2W_ErrorPackage_Ack_Cmd;
    Pro_ErrorCmdStruct.Error_Packets = errorType;
    Pro_ErrorCmdStruct.Sum = CheckSum((uint8_t *)&Pro_ErrorCmdStruct, sizeof(Pro_ErrorCmdStruct));
    Pro_UART_SendBuf((uint8_t *)&Pro_ErrorCmdStruct, sizeof(Pro_ErrorCmdStruct), 0);

#ifdef PROTOCOL_DEBUG
    printf(" MCU  : ");
    for(i = 0; i < sizeof(Pro_ErrorCmdStruct); i++)
    {
        printf("%2x ", *((uint8_t *)&Pro_ErrorCmdStruct + i));
    }
    printf("\r\n");
#endif

    /*****************Gagent to MCU ,Error********************/
    switch (Pro_ErrorCmdStruct.Error_Packets)
    {
                case Error_AckSum:
                        printf("W2D Error Command ->Error_AckSum\r\n");
                        break;
                case Error_Cmd:
                        printf("W2D Error Command ->Error_Cmd\r\n");
                        break;
                case Error_Other:
                        printf("W2D Error Command ->Error_Other\r\n");
                        break;
                default:
                        break;
    }
    /****************************************************/
}
/*
    4.8 WiFi模组读取设备当前状态
    WiFi发:
    Header(2B)__LEN(2B)__CMD(1B)__sn(1B)__falg(2B)__ActionBit(1B)__CheckSum(1B)
    0xFFFF      0x0006   0x03      0x##    0x0000   0x02         0x##
    MCU 回复:
    Header(2B)__LEN(2B)__CMD(1B)__sn(1B)__falg(2B)__ActionBit(1B)__DevStatus(11B)__CheckSum(1B)
    0xFFFF      0x0011   0x04      0x##    0x0000   0x03           Bablabla        0x##

    用到的数据g_DevStatus
    也就是ReadTypeDef
   
*/
static void Pro_D2W_ReportDevStatusHandle(void)
{
    Pro_HeadPartP0CmdTypeDef *Pro_HeadPartP0Cmd = (Pro_HeadPartP0CmdTypeDef *)g_DevStatus;
    memcpy(Pro_HeadPartP0Cmd, UART_HandleStruct.Message_Buf, sizeof(Pro_HeadPartTypeDef));
    Pro_HeadPartP0Cmd->Pro_HeadPart.Cmd = Pro_D2W_P0_Ack_Cmd;
    Pro_HeadPartP0Cmd->Pro_HeadPart.Len = exchangeBytes((sizeof(Pro_HeadPartP0CmdTypeDef)+g_P0DataLen+1) - 4);
    Pro_HeadPartP0Cmd->Action = P0_D2W_ReadDevStatus_Action_ACK;
  //加上校验和  
        g_DevStatus[sizeof(Pro_HeadPartP0CmdTypeDef)+g_P0DataLen] = CheckSum(g_DevStatus, sizeof(Pro_HeadPartP0CmdTypeDef)+g_P0DataLen+1);
    Pro_UART_SendBuf((uint8_t *)Pro_HeadPartP0Cmd, sizeof(Pro_HeadPartP0CmdTypeDef)+g_P0DataLen+1, 0);

#ifdef PROTOCOL_DEBUG
    printf("[%d] MCU   : ", SystemTimeCount);
    for(uint16_t i=0; i<(sizeof(Pro_HeadPartP0CmdTypeDef)+g_P0DataLen+1); i++)
    {
        printf("%2x ", *((uint8_t *)Pro_HeadPartP0Cmd + i));
    }
    printf("\r\n");
#endif

}
/*

20

主题

112

帖子

1626

积分

金牌会员

Rank: 6Rank: 6

积分
1626
11#
 楼主| 发表于 2016-7-29 17:35:43 | 只看该作者
/*****************************************************
* Function Name  : Pro_GetMcuInfo
* Description    : WiFi模组请求设备信息
    4.1 WiFi模组请求信息
    Header(2B)__LEN(2B)__CMD(1B)__sn(1B)__falg(2B)__CheckSum(1B)
    WiFi发:
    0xFFFF      0x0005   0x01     0x##    0x0000    0x##
    MCU 回复:
    0xFFFF      0x0047   0x02     0x##    0x0000            \
    ProtocolVer(8V)__p0Ver(8B)__HardVer(8B)__SoftVer(8B)_   \
    _ProductKey(32B)__BindableTimeOut(2B)_                  \
    _CheckSum(1B)

    用到的数据:Pro_M2W_ReturnInfoStruct
*****************************************************/
static void Pro_W2D_GetMcuInfo(void)
{
    memcpy(&Pro_CommonCmdStruct, UART_HandleStruct.Message_Buf, sizeof(Pro_CommonCmdStruct));

    Pro_M2W_ReturnInfoStruct.Pro_HeadPart.SN = Pro_CommonCmdStruct.Pro_HeadPart.SN;//SN
    Pro_M2W_ReturnInfoStruct.Sum = CheckSum((uint8_t *)&Pro_M2W_ReturnInfoStruct, sizeof(Pro_M2W_ReturnInfoStruct));
    Pro_UART_SendBuf((uint8_t *)&Pro_M2W_ReturnInfoStruct,sizeof(Pro_M2W_ReturnInfoStruct), 0);

#ifdef PROTOCOL_DEBUG
    printf("[%d] MCU   : ", SystemTimeCount);
    for(uint16_t i=0; i<sizeof(Pro_M2W_ReturnInfoStruct); i++)
    {
        printf("%2x ", *((uint8_t *)&Pro_M2W_ReturnInfoStruct + i));
    }
    printf("\r\n");
#endif
}

static void Pro_W2D_ReadDevStatusHandle(void)
{
    Pro_D2W_ReportDevStatusHandle();
}



20

主题

112

帖子

1626

积分

金牌会员

Rank: 6Rank: 6

积分
1626
10#
 楼主| 发表于 2016-7-29 17:34:29 | 只看该作者
校园创客福利
/*****************************************************
* Function Name  : CheckSum
* Description    : 校验和算法
* Input          : buf:数据起始地址; packLen:数据长度;
* Output         : None
* Return         : 校验码
* Attention                   : None
*****************************************************/
uint8_t CheckSum( uint8_t *buf, int packLen )
{
    int                                i;
    uint8_t                sum;

    if(buf == NULL || packLen <= 0) return 0;
    sum = 0;
    for(i=2; i<packLen-1; i++)
        sum += buf[i];

    return sum;
}

void GizWits_init(uint8_t P0_Len)
{
    Pro_HeadPartP0CmdTypeDef *Pro_HeadPartP0Cmd = (Pro_HeadPartP0CmdTypeDef *)g_DevStatus;

    if(P0_Len > MAX_P0_LEN)
    {
        printf("Warning P0_Len out of range\r\n");
        while(1);
    }
    rb_new(&u_ring_buff);//New Ring buff

    memset((uint8_t *)&g_DevStatus, 0, MAX_P0_LEN);
    memset(&Pro_M2W_ReturnInfoStruct, 0, sizeof(Pro_M2W_ReturnInfoStruct));

    Pro_M2W_ReturnInfoStruct.Pro_HeadPart.Head[0] = 0xFF;
    Pro_M2W_ReturnInfoStruct.Pro_HeadPart.Head[1] = 0xFF;
    Pro_M2W_ReturnInfoStruct.Pro_HeadPart.Len = exchangeBytes(sizeof(Pro_M2W_ReturnInfoStruct) - 4);
    Pro_M2W_ReturnInfoStruct.Pro_HeadPart.Cmd = Pro_D2W__GetDeviceInfo_Ack_Cmd;
    memcpy(Pro_M2W_ReturnInfoStruct.Pro_ver, PRO_VER, strlen(PRO_VER));
    memcpy(Pro_M2W_ReturnInfoStruct.P0_ver, P0_VER, strlen(P0_VER));
    memcpy(Pro_M2W_ReturnInfoStruct.Hard_ver, HARD_VER, strlen(HARD_VER));
    memcpy(Pro_M2W_ReturnInfoStruct.Soft_ver, SOFT_VER, strlen(SOFT_VER));
    memcpy(Pro_M2W_ReturnInfoStruct.Product_Key, PRODUCT_KEY, strlen(PRODUCT_KEY));
    Pro_M2W_ReturnInfoStruct.Binable_Time = exchangeBytes(0);


    g_P0DataLen = P0_Len;
    Pro_HeadPartP0Cmd->Pro_HeadPart.Head[0] = 0xFF;
    Pro_HeadPartP0Cmd->Pro_HeadPart.Head[1] = 0xFF;
    Pro_HeadPartP0Cmd->Pro_HeadPart.Len = exchangeBytes(sizeof(Pro_HeadPartP0CmdTypeDef) - 4);
    Pro_HeadPartP0Cmd->Pro_HeadPart.Cmd = 0x0;
    Pro_HeadPartP0Cmd->Pro_HeadPart.SN = 0;
    Pro_HeadPartP0Cmd->Pro_HeadPart.Flags[0] = 0x0;
    Pro_HeadPartP0Cmd->Pro_HeadPart.Flags[1] = 0x0;
}
/*****************************************************
* Function Name  : Pro_GetFrame
* Description    :抓取一个包
* Input          : None
* Output         : New package
* Return         : 0 : Find new package ; 1 : Error
* Attention                 : Data adhering
*****************************************************/
static uint8_t Pro_GetFrame()
{
    if(rb_can_read(&u_ring_buff) >= 1)
    {
        if(packageFlag ==0)
        {
            rb_read(&u_ring_buff, &curValue, 1);
            if((lastValue == 0xFF)&&(curValue == 0xFF))
            {
                tmp_buf[0] = 0xFF;
                tmp_buf[1] = 0xFF;
                count = 2;
                return 1;
            }
            if((lastValue == 0xFF)&&(curValue == 0x55))
            {
                lastValue = curValue;
                return 1;
            }
            tmp_buf[count] = curValue;
            count ++ ;
            lastValue = curValue;

            if(count ==4)
            {
                dataLen = tmp_buf[2]*256+  tmp_buf[3];
            }
            if(count ==  (dataLen + 4))
            {
                                                        //把rb的数据,拷贝到UART_HandleStruct
                memcpy(UART_HandleStruct.Message_Buf, tmp_buf, dataLen + 4);
                UART_HandleStruct.Message_Len = dataLen + 4;

#ifdef PROTOCOL_DEBUG
                printf("GAgentToMCU: ");
                for(uint8_t i=0; i<dataLen+4; i++)
                {
                    printf("%2x ", UART_HandleStruct.Message_Buf[i]);
                }
                printf("\r\n");
#endif
                                                                memset(tmp_buf, 0, (dataLen + 4));
                packageFlag = 1;
                lastValue = curValue =0;
                return 0;
            }
        }
    }
        return 1;
}

/*****************************************************
* Function Name  : MessageHandle
* Description    :
*                  信息处理机制
*                  如果收到的是WiFi控制MCU命令【4.10】,把数据存储到Message_Buf
用到
//__packed        typedef struct
//{
//    uint8_t                                                        Head[2];
//    uint16_t                                                Len;
//    uint8_t                                                        Cmd;
//    uint8_t                                                        SN;
//    uint8_t                                                        Flags[2];

//} Pro_HeadPartTypeDef;

*****************************************************/
u8 GizWits_MessageHandle(u8 * Message_Buf, u8 Length_buf)
{
    uint8_t ret = 0;
    Pro_HeadPartTypeDef *Recv_HeadPart = NULL;
    /*抓取一包*/
    Pro_GetFrame();//完成时:packageFlag = 1;  数据保存到 UART_HandleStruct
    memset(&Recv_HeadPart, 0, sizeof(Recv_HeadPart));
    //重发机制 这里有bug 应该是等待Ack失败后才重发
    //可以根据ret来判断。。。0_0
    //这里只要需要等待Ack就重发,错!
    GizWits_D2W_Resend_AckCmdHandle();//if(Wait_AckStruct.Flag == 1) 重发,bug
    if(packageFlag)
    {
        /*验证校验码*//*计算数据帧的校验码,并与数据帧中的校验码,进行比对*/
                if(CheckSum(UART_HandleStruct.Message_Buf, UART_HandleStruct.Message_Len) != UART_HandleStruct.Message_Buf[UART_HandleStruct.Message_Len - 1])
                {
                        Pro_W2D_ErrorCmdHandle(Error_AckSum);
                        packageFlag = 0;
                        return 1;               
                }
        /*判断ACK*///ret没用到
                ret = GizWits_W2D_AckCmdHandle(); //if(Wait_AckStruct.Flag == 1) 判断
#ifdef DEBUG
       if(ret == 0)
       {
            printf("ACK: SUCCESS! ...\r\n");
       }
#endif
                Recv_HeadPart = (Pro_HeadPartTypeDef *)UART_HandleStruct.Message_Buf;
                switch (Recv_HeadPart->Cmd)
                {
                                        //4.1 WiFi模组请求信息 Cmd=0x01
                  case Pro_W2D_GetDeviceInfo_Cmd:
                                Pro_W2D_GetMcuInfo();
                                break;
            //4.8  WiFi读取MCU. Cmd=0x03
            //4.10 WiFi控制MCU. Cmd=0x03
                        case Pro_W2D_P0_Cmd:
                        {
                                switch(UART_HandleStruct.Message_Buf[sizeof(Pro_HeadPartTypeDef)])//标准报头后紧跟一个action(1B)
                                {
                                        //4.10 WiFi控制MCU. Cmd=0x03 ActionBit=0x01
                                        case P0_W2D_Control_Devce_Action:
                                        {
                                                Pro_W2D_CommonCmdHandle();//回复通用协议帧
                                                //储存ActionBit之后的信息
                                                memcpy(Message_Buf, UART_HandleStruct.Message_Buf+sizeof(Pro_HeadPartP0CmdTypeDef), Length_buf);
                                                p0Flag = 1;//main()里,依靠此标志,和WriteTypeDef来控制更改设备状态
                                                break;
                                        }
                                        //4.8 WiFi读取MCU. Cmd=0x03 ActionBit=0x02
                                        case P0_W2D_ReadDevStatus_Action:
                                                Pro_W2D_ReadDevStatusHandle();
                                                break;
                                        default:
                                                break;
                                }
                        }
                        break;
                        case Pro_W2D_P0_Ack_Cmd:
                                break;
                        //4.2 WiFi模组与设备MCU的心跳 Cmd=0x07
                        case Pro_W2D_Heartbeat_Cmd:
                                Pro_W2D_CommonCmdHandle();
                                break;
                        //4.3  Cmd=0x09+1  设备MCU通知WiFi模组进入配置模式,WiFi的回复
                        case Pro_W2D_ControlWifi_Config_Ack_Cmd:
                                break;
                        case Pro_W2D_ResetWifi_Ack_Cmd:
                                break;
                        //4.5 WiFi模组向设备MCU通知WiFi模组工作状态 Cmd=0x0D
                        case Pro_W2D_ReportWifiStatus_Cmd:
                                Pro_W2D_WifiStatusHandle();
                                break;
                        //4.6 WiFi模组请求重启MCU Cmd=0x0F
                        case Pro_W2D_ReportMCUReset_Cmd:
                                Pr0_W2D_RequestResetDeviceHandle();
                                break;
                        case Pro_W2D_ErrorPackage_Cmd:
                                //Pro_W2D_ErrorCmdHandle(Error_AckSum);//bug
                                break;
                        case Pro_Get_Network_Time_Ack_Cmd://WIFI发来的获取网络时间
                                Pro_W2D_GetTimeHandle();
                       
                                break;
                        default://4.7 非法消息通知
                                Pro_W2D_ErrorCmdHandle(Error_Cmd);
                                break;
        }
                        memset(&UART_HandleStruct.Message_Buf, 0, UART_HandleStruct.Message_Len);
                        packageFlag = 0;
    }

    return 1;
}
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

加入Q群 返回顶部

版权与免责声明 © 2006-2024 Gizwits IoT Technology Co., Ltd. ( 粤ICP备11090211号 )

快速回复 返回顶部 返回列表