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 Reply Children
  • 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

  • Anything higher than 0x03 works. I was just curious why.  It's odd because  0x04 that I use is on your list as well.

    I'll try 0x10 so it does not conflict with your opcodes

    Question 

    0x04 is listed as "Simple OnOff Status" 

    What's the size of the message for this opcode? If it's 8 bytes - that would explain why I don't get "invalid message size" when I use it . 

    Thank you

  • AndyM said:

    What's the size of the message for this opcode? If it's 8 bytes - that would explain why I don't get "invalid message size" when I use it . 

    The contents and length of the messages can be found here. 

    I should mention that if you are simply testing, or not using this to make your own products it doesn't matter what company ID you use. However, using the Nordic ID for this isn't good (We might for instance decide to add another opcode which might conflict with yours). There is a special value for such purposes which is 0xFFFF (for more info see here). If you want to sell products however you would of course need to qualify the products and get your own company ID.

    Btw, could you give me the exact wording of the error message you were getting? 

    Regards,

    Elfving

  • I've moved on since, using company ID and opcodes 0xa and higher seems to work just fine

    From memory the message was "invalid message size for opcode....."

    Thank you for your help

Related