BLE Mesh Wildcard / Catch all Opcode handler callback

I have a project migrating to nrf Connect from ESP-IDF. We need to recreate a system to work with existing devices on BLE Mesh, but I am having trouble figuring out how to duplicate the following behavior. 

Some background: in ESP-IDF they have a single callback for messages sent to a specific model, in this function the user can then dispatch based on opcodes such as the following: 
```
 switch(param->model_operation.ctx->recv_op) {
    case OP_CODE_1:
     // Handle message type 1
      break;
    case OP_CODE_2:
     // Handle message type 2
      break;
    default:
      // Probably do nothing or log unknown message
      break;
  }
```

In our use case, this one device is used as a pass through, we do the same thing regardless of opcode. All opcodes that get sent to a model are handled and processed the same way by a single function in ESP-IDF. 


In nrf connect it seems we have to define callbacks for each opcode in the model as follows: 
```
const struct bt_mesh_model_op mymodelop[] = {
    { OP_CODE_1,       OP_CODE_1_LEN,   _handle_op_code_1},
    { OP_CODE_2,       OP_CODE_2_LEN,   _handle_op_code_2},
    BT_MESH_MODEL_OP_END,
};
```

My question, is there a way to add a wildcard or catch all entry to this bt_mesh_model_op array? 

The list of opcodes I need to handle, which all get handled the same way, is long and varies over time. We currently don't need to update this device when this list changes and would like to keep it that way. 

Parents Reply
  • Hi Hiue, yes that is surely a solution if the list is known.

    But as mentioned in our use case the list changes over time and this device should not require a firmware update when the list changes. The handling on this device has no dependency on the opcode so we want to keep the current situation where this device does not need an update in order for the new opcodes sent by other devices to be supported. 

Children
Related