【已解决】mesh SDK各opcode涂鸦平台对应的参数在哪里获取

蓝牙 BLE设备、蓝牙 MESH设备、蓝牙 Beacon设备、Sub-G设备等


rockjablew
Posts: 46

请问一下,mesh SDK里面,各opcode涂鸦平台对应的参数说明文档在哪里可以获取?这些参数和mesh文档里的描述不一致。谢谢

比如我在接收mesh 命令的地方打印opcode和参数:
OPERATE_RET app_mesh_data_recv(TAL_MESH_ACCESS_MSG_T *msg_raw, TAL_MESH_NET_PARAM_T *net_param){
printf("msg_raw->opcode:0x%04x ,data: ",msg_raw->opcode);
printf(msg_raw->data, msg_raw->data_len);
}

-------------------分割线---------------------------------------------
开关命令时打印结果
msg_raw->opcode:0x8202 ,data: 00 a2 //开命令
msg_raw->opcode:0x8202 ,data: 01 a5 //关命令

mesh文档里描述的参数是下面这些
3.2.1.2 Generic OnOff Set
Field | Size(octets) | Notes
OnOff 1 The target value of the Generic OnOff state
TID 1 Transaction Identifier
Transition Time 1 Format as defined in Section 3.1.3. (Optional)
Delay 1 Message execution delay in 5 millisecond steps (C.1)

-------------------分割线---------------------------------------------
调整亮度时,APP显示58%,打印结果
msg_raw->opcode:0xc9d007 ,data: 01 6c 03 15 31 30 30 30 30 30 30 30 30 30 30 30 30 30 32 34 36 30 30 30 30
msg_raw->opcode:0x824c ,data: fe 94 ac

mesh文档里描述的参数是下面这些
6.3.1.2 Light Lightness Set
Field | Size(octets) | Notes
Lightness 2 The target value of the Light Lightness Actual state.
TID 1 Transaction Identifier
Transition Time 1 Format as defined in Section 3.1.3. (Optional)
Delay 1 Message execution delay in 5 millisecond steps. (C.1)

-------------------分割线---------------------------------------------
调整色温时,APP不显示百分比,点击界面大概在色温中间位置,打印结果
msg_raw->opcode:0xc9d007 ,data: 01 6c 03 15 31 30 30 30 30 30 30 30 30 30 30 30 30 30 32 34 36 30 31 65 35
msg_raw->opcode:0x8264 ,data: 80 27 00 00 b5 00 00

文档里描述的参数是下面这些
6.3.2.6 Light CTL Temperature Set
Field | Size(octets) | Notes
CTL Temperature 2 The target value of the Light CTL Temperature state.
CTL Delta UV 2 The target value of the Light CTL Delta UV state.
TID 1 Transaction Identifier
Transition Time 1 Format as defined in Section 3.1.3. (Optional)
Delay 1 Message execution delay in 5 millisecond steps. (C.1)

Attachments
3.png
2.png
1.png

Tags:
rockjablew
Posts: 46

Re: mesh SDK各opcode涂鸦平台对应的参数在哪里获取

附件

Attachments
5.png
4.png
User avatar
joey_nobug
Posts: 143

Re: 【求助】mesh SDK各opcode涂鸦平台对应的参数在哪里获取

参考 tal_bluetooth_mesh_def.h 中相关定义

op code 具体定义:

Code: Select all

/* Onoff Model Opcode [Tuya Use] */
#define TAL_MESH_OPCODE_ON_OFF_GET                      (0x8201)
#define TAL_MESH_OPCODE_ON_OFF_SET                      (0x8202)
#define TAL_MESH_OPCODE_ON_OFF_SET_UNACK                (0x8203)
#define TAL_MESH_OPCODE_ON_OFF_STAT                     (0x8204)

/* Lightness Model Opcode [Tuya Use] */
#define TAL_MESH_OPCODE_LIGHTNESS_GET                   (0x824B)
#define TAL_MESH_OPCODE_LIGHTNESS_SET                   (0x824C)
#define TAL_MESH_OPCODE_LIGHTNESS_SET_UNACK             (0x824D)
#define TAL_MESH_OPCODE_LIGHTNESS_STAT                  (0x824E)

/* Light CTL Model Opcode [Tuya Use] */
#define TAL_MESH_OPCODE_LIGHT_CTL_GET                   (0x825D)
#define TAL_MESH_OPCODE_LIGHT_CTL_SET                   (0x825E)
#define TAL_MESH_OPCODE_LIGHT_CTL_SET_UNACK             (0x825F)
#define TAL_MESH_OPCODE_LIGHT_CTL_STAT                  (0x8260)

/* Temperature Model Opcode [Tuya Use] */
#define TAL_MESH_OPCODE_LIGHT_CTL_TEMP_GET              (0x8261)
#define TAL_MESH_OPCODE_LIGHT_CTL_TEMP_SET              (0x8264)
#define TAL_MESH_OPCODE_LIGHT_CTL_TEMP_SET_UNACK        (0x8265)
#define TAL_MESH_OPCODE_LIGHT_CTL_TEMP_STAT             (0x8266)

/* HSL Model Opcode [Tuya Use] */
#define TAL_MESH_OPCODE_LIGHT_HSL_GET                   (0x826D)
#define TAL_MESH_OPCODE_LIGHT_HSL_SET                   (0x8276)
#define TAL_MESH_OPCODE_LIGHT_HSL_SET_UNACK             (0x8277)
#define TAL_MESH_OPCODE_LIGHT_HSL_STAT                  (0x8278)

/* Tuya Mesh Opcode For Fast Provision */
#define TAL_MESH_OPCODE_FP_GET_MAC                      (0xC0D007)
#define TAL_MESH_OPCODE_FP_GET_MAC_STATUS               (0xC1D007)
#define TAL_MESH_OPCODE_FP_SET_ADDR                     (0xC2D007)
#define TAL_MESH_OPCODE_FP_SET_ADDR_STATUS              (0xC3D007)
#define TAL_MESH_OPCODE_FP_SET_PROVISON_DATA            (0xC4D007)
#define TAL_MESH_OPCODE_FP_CONFIRM                      (0xC5D007)
#define TAL_MESH_OPCODE_FP_CONFIRM_STATUS               (0xC6D007)
#define TAL_MESH_OPCODE_FP_COMMPLETE                    (0xC7D007)

/* Tuya Mesh Opcode For Vendor Model */
#define TAL_MESH_OPCODE_WRITE                           (0xC9D007)
#define TAL_MESH_OPCODE_WRITE_UNACK                     (0xCAD007)
#define TAL_MESH_OPCODE_STAT                            (0xCBD007)
#define TAL_MESH_OPCODE_READ                            (0xCCD007)
#define TAL_MESH_OPCODE_DATA                            (0xCDD007)
#define TAL_MESH_OPCODE_REPORT                          (0xCED007)
#define TAL_MESH_OPCODE_REPORT_ACK                      (0xCFD007)
#define TAL_MESH_OPCODE_LOCAL_AUTO_WRITE                (0xD0D007)
#define TAL_MESH_OPCODE_LOCAL_AUTO_NOTIFY               (0xD1D007)

op code 数据结构体:

Code: Select all

/**< Define parameters for mesh model */
typedef struct{
    UCHAR_T present;                    /**< The present value of the Generic OnOff state. */
    UCHAR_T target;                     /**< The target value of the Generic OnOff state(optional). */
    UCHAR_T remain_t;                   /**< If the target field is present, the Remaining Time field shall also be present; otherwise these fields shall not be present. */
}TAL_MESH_GENERIC_ONOFF_STATUS_T;

typedef struct{
    UCHAR_T onoff;                      /**< The target value of the Generic OnOff state. */
    UCHAR_T tid;                        /**< Transaction Identifier */
    UCHAR_T transit_t;                  /**< Generic Default Transition Time(optional). */
    UCHAR_T delay;                      /**< If the transit_t field is present, the Delay field shall also be present; otherwise these fields shall not be present. */
}TAL_MESH_GENERIC_ONOFF_SET_T;

typedef struct{
    USHORT_T present;                   /**< The present value of the Light Lightness Actual state. */
    USHORT_T target;                    /**< The target value of the Light Lightness Actual state. (Optional) */
    UCHAR_T remain_t;                   /**< If the target field is present, the Remaining Time field shall also be present; otherwise these fields shall not be present */
}PACKED TAL_MESH_LIGHT_LIGHTNESS_STATUS_T;
 
typedef struct{
USHORT_T lightness;                 /**< The target value of the Light Lightness Actual state */
UCHAR_T tid;                        /**< Transaction Identifier */
UCHAR_T transit_t;                  /**< Generic Default Transition Time(optional) */
UCHAR_T delay;                      /**< If the transit_t field is present, the Delay field shall also be present; otherwise these fields shall not be present. */
}PACKED TAL_MESH_LIGHT_LIGHTNESS_SET_T;

typedef struct{
    USHORT_T present_lightness;         /**< The present value of the Light CTL Lightness state */
    USHORT_T present_temp;              /**< The present value of the Light CTL Temperature state */
    USHORT_T target_lightness;          /**< The target value of the Light CTL Lightness state (Optional) */
    USHORT_T target_temp;               /**< If the target_lightness field is present, this field shall also be present; otherwise this field shall not be present */
    UCHAR_T remain_t;                   /**< If the target_lightness field is present, this field shall also be present; otherwise this field shall not be present */
}PACKED TAL_MESH_LIGHT_CTL_STATUS_T;

typedef struct{
    USHORT_T present_temp;              /**< The present value of the Light CTL Temperature state */
    SHORT_T present_delta_uv;           /**< The present value of the Light CTL Delta UV state */
    USHORT_T target_temp;               /**< The target value of the Light CTL Temperature state (Optional) */
    SHORT_T target_delta_uv;            /**< If the target_temp field is present, this field shall also be present; otherwise this field shall not be present */
    UCHAR_T remain_t;                   /**< If the target_temp field is present, this field shall also be present; otherwise this field shall not be present */
}PACKED TAL_MESH_LIGHT_CTL_TEMP_STATUS_T;
 
typedef struct{
    USHORT_T lightness;                 /**< The target value of the Light CTL Lightness state */
    USHORT_T temp;                      /**< The target value of the Light CTL Temperature state */
    SHORT_T delta_uv;                   /**< The target value of the Light CTL Delta UV state */
    UCHAR_T tid;                        /**< Transaction Identifier */
    UCHAR_T transit_t;                  /**< Generic Default Transition Time(Optional) */
    UCHAR_T delay;                      /**< If the transit_t field is present, the Delay field shall also be present; otherwise these fields shall not be present. */
}PACKED TAL_MESH_LIGHT_CTL_SET_T;
 
typedef struct{
    USHORT_T temp;                      /**< The target value of the Light CTL Temperature state */
    SHORT_T delta_uv;                   /**< The target value of the Light CTL Delta UV state. */
    UCHAR_T tid;                        /**< Transaction Identifier */
    UCHAR_T transit_t;                  /**< Generic Default Transition Time(Optional) */
    UCHAR_T delay;                      /**< If the transit_t field is present, the Delay field shall also be present; otherwise these fields shall not be present. */
}PACKED TAL_MESH_LIGHT_CTL_TEMP_SET_T;

typedef struct{
    USHORT_T lightness;                 /**< The present value of the Light HSL Lightness state */
    USHORT_T hue;                       /**< The present value of the Light HSL Hue state */
    USHORT_T sat;                       /**< The present value of the Light HSL Saturation state */
    UCHAR_T remain_t;                   /**< Generic Default Transition Time(Optional) */
}PACKED TAL_MESH_LIGHT_HSL_STATUS_T;

typedef struct{
    USHORT_T lightness;                 /**< The target value of the Light HSL Lightness state */
    USHORT_T hue;                       /**< The target value of the Light HSL Hue state */
    USHORT_T sat;                       /**< The target value of the Light HSL Saturation state */
    UCHAR_T tid;                        /**< Transaction Identifier */
    UCHAR_T transit_t;                  /**< Generic Default Transition Time(Optional) */
    UCHAR_T delay;                      /**< If the transit_t field is present, the Delay field shall also be present; otherwise these fields shall not be present. */
}PACKED TAL_MESH_LIGHT_HSL_SET_T;
Talk is cheap, show me the code.
rockjablew
Posts: 46

Re: 【求助】mesh SDK各opcode涂鸦平台对应的参数在哪里获取

joey_nobug 2022年 Sep 23日 14:04

参考 tal_bluetooth_mesh_def.h 中相关定义

op code 具体定义:

Code: Select all

/* Onoff Model Opcode [Tuya Use] */
#define TAL_MESH_OPCODE_ON_OFF_GET                      (0x8201)
#define TAL_MESH_OPCODE_ON_OFF_SET                      (0x8202)
#define TAL_MESH_OPCODE_ON_OFF_SET_UNACK                (0x8203)
#define TAL_MESH_OPCODE_ON_OFF_STAT                     (0x8204)

/* Lightness Model Opcode [Tuya Use] */
#define TAL_MESH_OPCODE_LIGHTNESS_GET                   (0x824B)
#define TAL_MESH_OPCODE_LIGHTNESS_SET                   (0x824C)
#define TAL_MESH_OPCODE_LIGHTNESS_SET_UNACK             (0x824D)
#define TAL_MESH_OPCODE_LIGHTNESS_STAT                  (0x824E)

/* Light CTL Model Opcode [Tuya Use] */
#define TAL_MESH_OPCODE_LIGHT_CTL_GET                   (0x825D)
#define TAL_MESH_OPCODE_LIGHT_CTL_SET                   (0x825E)
#define TAL_MESH_OPCODE_LIGHT_CTL_SET_UNACK             (0x825F)
#define TAL_MESH_OPCODE_LIGHT_CTL_STAT                  (0x8260)

/* Temperature Model Opcode [Tuya Use] */
#define TAL_MESH_OPCODE_LIGHT_CTL_TEMP_GET              (0x8261)
#define TAL_MESH_OPCODE_LIGHT_CTL_TEMP_SET              (0x8264)
#define TAL_MESH_OPCODE_LIGHT_CTL_TEMP_SET_UNACK        (0x8265)
#define TAL_MESH_OPCODE_LIGHT_CTL_TEMP_STAT             (0x8266)

/* HSL Model Opcode [Tuya Use] */
#define TAL_MESH_OPCODE_LIGHT_HSL_GET                   (0x826D)
#define TAL_MESH_OPCODE_LIGHT_HSL_SET                   (0x8276)
#define TAL_MESH_OPCODE_LIGHT_HSL_SET_UNACK             (0x8277)
#define TAL_MESH_OPCODE_LIGHT_HSL_STAT                  (0x8278)

/* Tuya Mesh Opcode For Fast Provision */
#define TAL_MESH_OPCODE_FP_GET_MAC                      (0xC0D007)
#define TAL_MESH_OPCODE_FP_GET_MAC_STATUS               (0xC1D007)
#define TAL_MESH_OPCODE_FP_SET_ADDR                     (0xC2D007)
#define TAL_MESH_OPCODE_FP_SET_ADDR_STATUS              (0xC3D007)
#define TAL_MESH_OPCODE_FP_SET_PROVISON_DATA            (0xC4D007)
#define TAL_MESH_OPCODE_FP_CONFIRM                      (0xC5D007)
#define TAL_MESH_OPCODE_FP_CONFIRM_STATUS               (0xC6D007)
#define TAL_MESH_OPCODE_FP_COMMPLETE                    (0xC7D007)

/* Tuya Mesh Opcode For Vendor Model */
#define TAL_MESH_OPCODE_WRITE                           (0xC9D007)
#define TAL_MESH_OPCODE_WRITE_UNACK                     (0xCAD007)
#define TAL_MESH_OPCODE_STAT                            (0xCBD007)
#define TAL_MESH_OPCODE_READ                            (0xCCD007)
#define TAL_MESH_OPCODE_DATA                            (0xCDD007)
#define TAL_MESH_OPCODE_REPORT                          (0xCED007)
#define TAL_MESH_OPCODE_REPORT_ACK                      (0xCFD007)
#define TAL_MESH_OPCODE_LOCAL_AUTO_WRITE                (0xD0D007)
#define TAL_MESH_OPCODE_LOCAL_AUTO_NOTIFY               (0xD1D007)

op code 数据结构体:

Code: Select all

/**< Define parameters for mesh model */
typedef struct{
    UCHAR_T present;                    /**< The present value of the Generic OnOff state. */
    UCHAR_T target;                     /**< The target value of the Generic OnOff state(optional). */
    UCHAR_T remain_t;                   /**< If the target field is present, the Remaining Time field shall also be present; otherwise these fields shall not be present. */
}TAL_MESH_GENERIC_ONOFF_STATUS_T;

typedef struct{
    UCHAR_T onoff;                      /**< The target value of the Generic OnOff state. */
    UCHAR_T tid;                        /**< Transaction Identifier */
    UCHAR_T transit_t;                  /**< Generic Default Transition Time(optional). */
    UCHAR_T delay;                      /**< If the transit_t field is present, the Delay field shall also be present; otherwise these fields shall not be present. */
}TAL_MESH_GENERIC_ONOFF_SET_T;

typedef struct{
    USHORT_T present;                   /**< The present value of the Light Lightness Actual state. */
    USHORT_T target;                    /**< The target value of the Light Lightness Actual state. (Optional) */
    UCHAR_T remain_t;                   /**< If the target field is present, the Remaining Time field shall also be present; otherwise these fields shall not be present */
}PACKED TAL_MESH_LIGHT_LIGHTNESS_STATUS_T;
 
typedef struct{
USHORT_T lightness;                 /**< The target value of the Light Lightness Actual state */
UCHAR_T tid;                        /**< Transaction Identifier */
UCHAR_T transit_t;                  /**< Generic Default Transition Time(optional) */
UCHAR_T delay;                      /**< If the transit_t field is present, the Delay field shall also be present; otherwise these fields shall not be present. */
}PACKED TAL_MESH_LIGHT_LIGHTNESS_SET_T;

typedef struct{
    USHORT_T present_lightness;         /**< The present value of the Light CTL Lightness state */
    USHORT_T present_temp;              /**< The present value of the Light CTL Temperature state */
    USHORT_T target_lightness;          /**< The target value of the Light CTL Lightness state (Optional) */
    USHORT_T target_temp;               /**< If the target_lightness field is present, this field shall also be present; otherwise this field shall not be present */
    UCHAR_T remain_t;                   /**< If the target_lightness field is present, this field shall also be present; otherwise this field shall not be present */
}PACKED TAL_MESH_LIGHT_CTL_STATUS_T;

typedef struct{
    USHORT_T present_temp;              /**< The present value of the Light CTL Temperature state */
    SHORT_T present_delta_uv;           /**< The present value of the Light CTL Delta UV state */
    USHORT_T target_temp;               /**< The target value of the Light CTL Temperature state (Optional) */
    SHORT_T target_delta_uv;            /**< If the target_temp field is present, this field shall also be present; otherwise this field shall not be present */
    UCHAR_T remain_t;                   /**< If the target_temp field is present, this field shall also be present; otherwise this field shall not be present */
}PACKED TAL_MESH_LIGHT_CTL_TEMP_STATUS_T;
 
typedef struct{
    USHORT_T lightness;                 /**< The target value of the Light CTL Lightness state */
    USHORT_T temp;                      /**< The target value of the Light CTL Temperature state */
    SHORT_T delta_uv;                   /**< The target value of the Light CTL Delta UV state */
    UCHAR_T tid;                        /**< Transaction Identifier */
    UCHAR_T transit_t;                  /**< Generic Default Transition Time(Optional) */
    UCHAR_T delay;                      /**< If the transit_t field is present, the Delay field shall also be present; otherwise these fields shall not be present. */
}PACKED TAL_MESH_LIGHT_CTL_SET_T;
 
typedef struct{
    USHORT_T temp;                      /**< The target value of the Light CTL Temperature state */
    SHORT_T delta_uv;                   /**< The target value of the Light CTL Delta UV state. */
    UCHAR_T tid;                        /**< Transaction Identifier */
    UCHAR_T transit_t;                  /**< Generic Default Transition Time(Optional) */
    UCHAR_T delay;                      /**< If the transit_t field is present, the Delay field shall also be present; otherwise these fields shall not be present. */
}PACKED TAL_MESH_LIGHT_CTL_TEMP_SET_T;

typedef struct{
    USHORT_T lightness;                 /**< The present value of the Light HSL Lightness state */
    USHORT_T hue;                       /**< The present value of the Light HSL Hue state */
    USHORT_T sat;                       /**< The present value of the Light HSL Saturation state */
    UCHAR_T remain_t;                   /**< Generic Default Transition Time(Optional) */
}PACKED TAL_MESH_LIGHT_HSL_STATUS_T;

typedef struct{
    USHORT_T lightness;                 /**< The target value of the Light HSL Lightness state */
    USHORT_T hue;                       /**< The target value of the Light HSL Hue state */
    USHORT_T sat;                       /**< The target value of the Light HSL Saturation state */
    UCHAR_T tid;                        /**< Transaction Identifier */
    UCHAR_T transit_t;                  /**< Generic Default Transition Time(Optional) */
    UCHAR_T delay;                      /**< If the transit_t field is present, the Delay field shall also be present; otherwise these fields shall not be present. */
}PACKED TAL_MESH_LIGHT_HSL_SET_T;

但是根据打印结果,参数长度、数量,明显和这里的描述不一致啊

User avatar
joey_nobug
Posts: 143

Re: 【求助】mesh SDK各opcode涂鸦平台对应的参数在哪里获取

看下注释,有些参数是 optional 可选项

Talk is cheap, show me the code.
rockjablew
Posts: 46

Re: 【求助】mesh SDK各opcode涂鸦平台对应的参数在哪里获取

joey_nobug 2022年 Sep 23日 16:49

看下注释,有些参数是 optional 可选项

控制亮度色温为什么需要发送这条vendor 指令呢?这条指令的数据格式又是什么?

Attachments
6.png
beautifulzzzz
Posts: 48

Re: 【求助】mesh SDK各opcode涂鸦平台对应的参数在哪里获取

https://developer.tuya.com/cn/docs/iot- ... ikwhoo3gux

这有个SIG MESH协议的介绍,能够解决您的问题

创造传奇,不是卖艺! 8-)
rockjablew
Posts: 46

Re: 【求助】mesh SDK各opcode涂鸦平台对应的参数在哪里获取

beautifulzzzz 2022年 Sep 23日 17:53

https://developer.tuya.com/cn/docs/iot- ... ikwhoo3gux

这有个SIG MESH协议的介绍,能够解决您的问题

我 截图里就是这里,里面没有说到这些数据是什么

rockjablew
Posts: 46

Re: 【求助】mesh SDK各opcode涂鸦平台对应的参数在哪里获取

beautifulzzzz 2022年 Sep 23日 17:53

https://developer.tuya.com/cn/docs/iot- ... ikwhoo3gux

这有个SIG MESH协议的介绍,能够解决您的问题

控制亮度色温为什么需要发送这条vendor 指令呢?

User avatar
joey_nobug
Posts: 143

Re: 【求助】mesh SDK各opcode涂鸦平台对应的参数在哪里获取

你的 产品 id 方便发一下吗?

Talk is cheap, show me the code.
Post Reply