Use mesh chat example to communicate node with iphone

As the introduction of mesh chat document,I have provisioned "Mesh Chat" and Provisioner--Iphone. But I can't get a show of message from iphone(unicast address 0x0006) to node(unicast address 0x0008) by nRF Mesh APP in Putty. 

Hope to know if communication between iPhone and node is possible, and,if it is possible,  where did the error occur.

mesh chat node provision:

   

iphone provision:

  

iphone send message to mesh chat node :

no display in Putty:

Parents
  • Hi ImmanuelLee,

    Unfortunately, I don't have an iOS device. However, judging from my test and your screenshot, the Android UI should be fairly similar.

    I think perhaps you misunderstood the feature a little.

    You may find from chat_cli.h that the opcodes of the chat model are defined like the following example:

    /** Private message opcode. */
    #define BT_MESH_CHAT_CLI_OP_PRIVATE_MESSAGE BT_MESH_MODEL_OP_3(0x0B, \
    				       BT_MESH_CHAT_CLI_VENDOR_COMPANY_ID)
    

    If you look into the macro expansion, you can see that this subsequently resolve the macro as followed:

    #define BT_MESH_CHAT_CLI_OP_PRIVATE_MESSAGE ((((0x0B) << 16) | 0xc00000) | (BT_MESH_CHAT_CLI_VENDOR_COMPANY_ID))
    
    // then
    #define BT_MESH_CHAT_CLI_OP_PRIVATE_MESSAGE (0xCB0000 | BT_MESH_CHAT_CLI_VENDOR_COMPANY_ID)
    // then
    #define BT_MESH_CHAT_CLI_OP_PRIVATE_MESSAGE (0xCB0000 | 0x5900)
    // then
    #define BT_MESH_CHAT_CLI_OP_PRIVATE_MESSAGE 0xCB5900
    

    In the above example, the full opcode for the private message feature is 0xCB5900.

    Look at the app UI, you can see similar boolean math expression in the Vendor Model Control section:

    Here, the opcode without the company ID is going to be 0xC0 | <your input>.
    The private message opcode is 0xCB5900. Without the company ID, it is 0xCB. Therefore, to get the private message opcode, your input should be 0x0B (or 0xCB should technically also work).

    In the parameter, you simply put the message you want to send in raw ASCII hex, with a 0x00 at the end as the termnation character.

    For example,
    - "123" would be 0x31323300
    - "abc" would be 0x61626300

    For the direction from the device to phone, I think what you are typing into the device shell is correct. You should see the message in the "Response" section of this screenshot.

    Sorry if it is still confusing. I think it will make more sense if you experiment for a few times while going over my explanation. I recommend using the public message opcode (0x0A or 0xCA5900) and the private message opcode (0x0B or 0xCB5900).

    Please retry with the information above in mind and let me know if things make more sense now.

    Hieu

  • Thanks for you, as your suggestion, implemented this function.

Reply Children
Related