Hi all,
Currently the Mesh Lighting Development Kit has 3 buttons. 1 for ON/OFF, and another 2 for brightness control. I would like to develop an application to add another push button (on the MeshSwitch) such that when it is pressed, it tiggers an effect on the MeshLight, eg. flash the LEDs for 10 seconds.
I am new to development on CSR. Can someone shed some light on how this can be done? Is it easy to modify the existing sample application to include this function?
Thanks in advance.
Anyone can provide any recomendations on this?
This is possible. One way to implement this would be to alter the switch code to send messages to the MeshLights to turn on and off, and then use a timer in the MeshSwitch application to control when these messages get sent.
Roger
Thanks Roger,
But this is not an efficient method. If I want to light to blink for 1 minute, then my switch needs to be sending messages to the light for 1 minute. My switch is battery powered and the light is powered by mains power supply.
I am thinking if just sending a specific message/command to the light instead. I was reading through some of the documentation and came across the DataModel:
The Data Model transmits either a stream or blocks of arbitrary data between two devices. For stream data, each octet within the stream has an octet number. This octet number provides the reliable delivery of the stream data as a sequence number. For block data, there is no reliable delivery of messages.
Should I be using the data model instead? Or is there any other better method?
Yes, data model is also a way to do this as well, and does have the benefit of reducing the quantity of messages being sent.
Roger
Hi Roger,
I just realised, isn't the dataModel implemented only for mobile application? There is no dataModel implementation for the bluetooth module. I look at the CSRMesh 1.3 API and there isn't a dataModel module.
What I really want is to send a message from the switch to the light. Something like trigger_effect1, trigger_effect2, etc.
In the CSRMeshLight example application, inside the csr_mesh_light.c file, there is this function:
extern void AppProcessCsrMeshEvent(csr_mesh_event_t event_code, uint8* data, uint16 length, void **state_data)
Inside this function, there is a switch-case statement for different csr_mesh_event. One of the events is:
/* Received a raw message from lower-layers.
* Notify to the control device if connected.
*/
case CSR_MESH_RAW_MESSAGE:
{
if (g_lightapp_data.state == app_state_connected)
{
MeshControlNotifyResponse(g_lightapp_data.gatt_data.st_ucid,data, length);
}
}
break;
I am wondering if I can use this CSR_MESH_RAW_MESSAGE case, and depending on what is the raw message received, I can perform the appropriate task I want.
In the API there is this function:
Enables/disables the notification of CSR_MESH_RAW_MESSAGE event. This event is sent when a CSRmesh message not belonging to any enabled models is received. This can be used by the application for its own processing.
Typically Raw message event is enabled on a GATT bridge which supports Mesh Control service and notifies the received CSRmesh messages to the connected CSRmesh Control application.
So on the switch side, how do I send a raw message? What is the function I need to call? is it this function:
bool CsrMeshSendMessage(unit8*message, unit16 message_length)
Thanks!
I just found out about the Stream Model in Mesh1.3 API. I think this is what is used to send messges in the mesh network. Will try it out and provide my feedback and findings here.
May be Attention Model can help you in this.
Here you can set the duration of blink too.
Regards.