Forums - Additional button and function for Mesh Lighting Application

8 posts / 0 new
Last post
Additional button and function for Mesh Lighting Application
kian
Join Date: 8 Jun 16
Posts: 43
Posted: Wed, 2016-06-08 07:23

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.

  • Up0
  • Down0
kian
Join Date: 8 Jun 16
Posts: 43
Posted: Tue, 2016-06-14 22:21

Anyone can provide any recomendations on this?

 

  • Up0
  • Down0
rg02
Join Date: 1 Jun 16
Posts: 19
Posted: Wed, 2016-06-15 08:00

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

 

  • Up0
  • Down0
kian
Join Date: 8 Jun 16
Posts: 43
Posted: Thu, 2016-06-16 01:09

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?

  • Up0
  • Down0
rg02
Join Date: 1 Jun 16
Posts: 19
Posted: Thu, 2016-06-16 05:55

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

  • Up0
  • Down0
kian
Join Date: 8 Jun 16
Posts: 43
Posted: Thu, 2016-06-16 07:43

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:

void CsrMeshEnableRawMsgEvent(bool enable

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!

 

  • Up0
  • Down0
kian
Join Date: 8 Jun 16
Posts: 43
Posted: Thu, 2016-06-16 18:47

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.

 

  • Up0
  • Down0
Siddhesh
Join Date: 27 Sep 16
Location: Mumbai
Posts: 24
Posted: Tue, 2016-09-27 23:17

May be Attention Model can help you in this.

Here you can set the duration of blink too.

Regards.

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.