Vendor model opcodes

I have a vendor model bt_mesh_model_op defined as follows

const struct bt_mesh_model_op _admin_model_ops[] = {


    { BT_MESH_MODEL_OP_3(OPCODE_SET_UNACK, VENDOR_CID), BT_MESH_LEN_EXACT(4),  event_set_unack},
    BT_MESH_MODEL_OP_END,
};
OPCODE_SET_UNACK is an enumeration
If the value is 0 - 3 I get "invalid message size"  when publishing the message
If the value is > 3 the message goes out
Are the values 0-3 reserved ? Where is it documented?
What are the guidelines for creating vendor specific opcodes?
Thanks
Parents
  • Hello again, and sorry about the wait!

    The usage of vender specific opcodes is documented in section 3.7.3.1 in the Mesh Profile Spec.

    For an example on how this can be implemented, you could also have a look at the chat example in NCS.

    Regards,

    Elfving

  • In chat_cli.h there are  definitions of vendor opcodes :

    #define BT_MESH_CHAT_CLI_OP_MESSAGE BT_MESH_MODEL_OP_3(0x0A, \
                           BT_MESH_CHAT_CLI_VENDOR_COMPANY_ID)

    /** Private message opcode. */
    #define BT_MESH_CHAT_CLI_OP_PRIVATE_MESSAGE BT_MESH_MODEL_OP_3(0x0B, \
                           BT_MESH_CHAT_CLI_VENDOR_COMPANY_ID)
    ... etc
    That's how I build my opcodes as well.
    #define OPCODE_SET_UNACK <n> ( 0-3 does not work , 4 and higher does)
     
    BT_MESH_MODEL_OP_3(OPCODE_SET_UNACK, VENDOR_CID):
    The question is were the  do values for the 3rd octet i.e 0x0a, 0x0b etc come from?
    Are they based off of the last byte of the model ID?
    In the sample  the model ID is 0x000A so it appears to be the case. But that does not correlate to this quote from the spec
    "For example, when the manufacturer-specific opcode is equal to 0x23 and the company identifier is equal to 0x0136 [6], then the 3-octet opcode is equal to 0xE3 0x36 0x01." If I read this correctly the 3rd octet of the opcode is 0x01 which seems arbitrary.
    What is "manufacturer specific opcode" ? That term appears in the spec only in this paragraph
    Thank you
    .
  • AndyM said:
    "For example, when the manufacturer-specific opcode is equal to 0x23 and the company identifier is equal to 0x0136 [6], then the 3-octet opcode is equal to 0xE3 0x36 0x01." If I read this correctly the 3rd octet of the opcode is 0x01 which seems arbitrary.

    The first octet needs to start with 0b11 as it is a 3-octet opcode. Afterwards comes the manufacturer-specific opcode of 0x100011. 0b11 and 0b100011 is 0x23. When it comes to the final octets, it uses an endianness where "All multiple-octet numeric values in this layer shall be “little endian” (defined in section 3.7.1.). So the opcode of 0x0136 is split into the last two octets as 0x36 and 0x01. 

    AndyM said:
    What is "manufacturer specific opcode" ? That term appears in the spec only in this paragraph

    Yeah "manufacturer" might sound confusing, but it is referring to you as the creator or developer making your own opcodes. Here is list of the opcodes we've created for these models. I believe you would have to use some that are not yet reserved, have you tried 0x10?

    Regards,

    Elfving

Reply
  • AndyM said:
    "For example, when the manufacturer-specific opcode is equal to 0x23 and the company identifier is equal to 0x0136 [6], then the 3-octet opcode is equal to 0xE3 0x36 0x01." If I read this correctly the 3rd octet of the opcode is 0x01 which seems arbitrary.

    The first octet needs to start with 0b11 as it is a 3-octet opcode. Afterwards comes the manufacturer-specific opcode of 0x100011. 0b11 and 0b100011 is 0x23. When it comes to the final octets, it uses an endianness where "All multiple-octet numeric values in this layer shall be “little endian” (defined in section 3.7.1.). So the opcode of 0x0136 is split into the last two octets as 0x36 and 0x01. 

    AndyM said:
    What is "manufacturer specific opcode" ? That term appears in the spec only in this paragraph

    Yeah "manufacturer" might sound confusing, but it is referring to you as the creator or developer making your own opcodes. Here is list of the opcodes we've created for these models. I believe you would have to use some that are not yet reserved, have you tried 0x10?

    Regards,

    Elfving

Children
No Data
Related