Mesh Location Client and Server in Snip folder

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
PICH_4397076
Level 3
Level 3
25 replies posted 10 replies posted 10 questions asked

Dear All,,

I hoped to find the location server and client code example, just like the other examples in demo / application.

However, since I only searched the location server and client example in snip / application.

From the mesh_location_client.c file of the mesh location code example in snip/application, I can see "mesh_app_proc_rx_cmd" function.

Without "mesh_app_proc_rx_cmd" function,  I'm going to create and take a test any mesh communication between mesh location client and server according to broadcast mesh message.

In the process, I have the following question.

From the mesh_location_client.c file of the mesh location client code example, I can see "mesh_app_proc_rx_cmd" function.

In this function, I can see "wiced_bt_mesh_create_event_from_wiced_hci" function.

To use without "mesh_app_proc_rx_cmd" function, I'm going to call "wiced_bt_mesh_create_event" function instead of "wiced_bt_mesh_create_event_from_wiced_hci" function.

Question 1 : To call "wiced_bt_mesh_create_event" function directly, how can I put app_key_idx among the function argument?

(As you know, in case of using "mesh_app_proc_rx_cmd" function, the value of the command packet is parsed and inserted)?

Question 2: In case of "wiced_bt_mesh_create_event" function, I can see the description below at API reference.

But, I can not understand fully about this function.

Please explain in detail so that I can understand???

===========================================================================================================================

/**

* \brief Create mesh event for an unsolicited message.

* \details In case dst is 0 the function takes all information from the model's publication or fails if publication is not configured for the specified model.

* In case non-0 dst the function uses specified dst and app_key_idx and fills all other fields with default values.

* In special case with company_id equals to 0xffff the function creates a message event with default ttl.

*

* @param      element_index  Element index.

* @param      company_id      Company ID.

* @param      model_id        Model ID.

* @param      dst            Destination address. If parameter is 0, the function finds publication and take uses its fields for the mesh event.

* @param      app_key_idx    Global app key index. The parameter is ignored if dst is equal to 0. The 0xffff means device key.

*

* @return      p_event Pointer to a newly allocated mesh event.

*/

wiced_bt_mesh_event_t *wiced_bt_mesh_create_event(uint8_t element_index, uint16_t company_id, uint16_t model_id, uint16_t dst, uint16_t app_key_idx);

=============================================================================================================================

Question 3: Using the client control mesh application, I'll be a beginner with a guide on how to test the location mesh client and server in the snip folder and follow the instructions as directed?

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

updated client control is attached

View solution in original post

0 Likes
24 Replies
PICH_4397076
Level 3
Level 3
25 replies posted 10 replies posted 10 questions asked

Dear All,,,

Question 3 is solved.

Please provide feedback to me on Question 1 and 2.

Thanks,,,

0 Likes

Dear All,,,

Any update for us?

Thanks,

0 Likes

In BLE mesh, the Provisioner/Configuration Manager is responsible to configure everything.  For example, if you use a phone, to provision your device, the phone will read the Composition Data of your device and discover that your device has a Location Client.  Among other things, the phone will add an application key,  it will bind the Location Client model to this application key, and it will configure Location Client model to publish messages to the specific destination address.

When your application calls wiced_bt_mesh_create event, it should use zeroes for dst and app_key_idx. If your device was properly configured for publication, the mesh core will fill all required values (dst, app_key_idx, ttl, retransmission params,...).  If your device is not property configured for publications the function will return NULL and you should not try to send anything. 

To test your applications, I wonder if it will be easier to use MeshClient to provision your devices. The document should be installed with your SDK. If you create a group before provisioning the devices, and then set Current group to be the group you created, the Mesh Client will configure Location Client to publish messages to the group and configure Location Server to subscribe to messages sent to this group.

Dear All,,,

I have one more question!

After calling wiced_bt_mesh_create_event() function, when should I call  wiced_bt_mesh_release_event() function???

Thanks,

0 Likes

Typically you pass the event down to the mesh stack, and the event is released by the stack when the message is sent out.  If you created an event and for some reason decided not to send it, you should definitely release it.

When you receive an event, and you do not need to send a reply using the same event, you should release it.

0 Likes
lock attach
Attachments are accessible only for community members.

Dear All,,,

I modified the mesh location client code provided by Cypress with the attached file. To get global location information from mesh location server every 10 seconds.

The attached modified code is using the Generic appKey index value for app_key_idx in the JSON file generated by provisioning and the 0xffff meaning broadcast message for dst  iwhen creating the event.
I've seen that with the modified code, I get the global location value from the mesh location server as well.

But, You gave the following in the previous comments:

=====================================================================

When your application calls wiced_bt_mesh_create event, it should use zeroes for dst and app_key_idx. If your device was properly configured for publication, the mesh core will fill all required values (dst, app_key_idx, ttl, retransmission params,...).  If your device is not property configured for publications the function will return NULL and you should not try to send anything.

===========================================================

So, Could you please review the attached code, what's wrong with my purpose?

Thanks,

0 Likes

If your device is a provisioner and has access to the mesh database, your method will indeed work (although I would not recommend to use broadcast).

If your device is not a provisioner, the provisioner needs to configure your device so that when you want to publish your message, you know the destination address, application key index and other parameters.

0 Likes
lock attach
Attachments are accessible only for community members.

Dear all,,,

Would you please try my modified code attached.

When I create an event like this, if dst and app_key_idx are set to 0, no event is generated and always null.

=================================================================

wiced_bt_mesh_event_t *p_event = wiced_bt_mesh_create_event(MESH_LOCATION_CLIENT_ELEMENT_INDEX, MESH_COMPANY_ID_BT_SIG, WICED_BT_MESH_CORE_MODEL_ID_GENERIC_LOCATION_CLNT, 0, 0);

=================================================================

The below is console capture.

=====================================================================

location restart timer:10000

pool size/cur/max/total 64/5/17/42 140/0/3/20 376/0/3/12 1024/0/0/3

Pub needed period

wiced_bt_mesh_create_event error!!!

location restart timer:10000

Pub needed period

wiced_bt_mesh_create_event error!!!

location restart timer:10000

Pub needed period

wiced_bt_mesh_create_event error!!!

location restart timer:10000

=====================================================================

What does it mean about "If your device is not property configured for publications"???

And, How to do for property configured for publications???

Thanks,

0 Likes

How did you provision/configure your device.  You device is probably not configured for publication.

0 Likes
lock attach
Attachments are accessible only for community members.

Here is what I tested:

First, the following 1 to 5 are the test methods that Cypress has informed.

Steps: (1~5)

  1. Download mesh_provision_client  and mesh_location_server on two devices. (make sure you enable location_client model for mesh_provision_client by selecting 'change application settings')
  2. Open ClientControl - Light Control tab and open COM port of the mesh_provision_client device. And then, provision location_server device.
  3. Note down the address allocated to mesh_location_server device (Eg: 0002).
  4. Goto ClientControl directory (.\components\BT-SDK\common\apps\snip\mesh\ClientControl\Release) and open Network.JSON. And check the appKeys generated.
  5. Select model tab on MeshClientControl and use appropriate destination address and app_key_index. (For GET messages you have to use Generic appKey index and for SET messages you have to use Setup appKey index.)
  6. Select location from the drop down menu and then use location commands (GET/SET) to change it’s parameters.

In this way I successfully sent and received location information via get / set message on clientcontrol model tab.

After that, I modified the mesh location client code provided by Cypress with the attached file and want to get global location information from mesh location server every 10 seconds.

(Pls, refer to the attached file)

Step (7~8)

6.Download the modified code to the new device.

7.Added new device (modified mesh location client) to mesh network. On ClientControl, Light Control tab and open COM port of the mesh_provision_client device. And then, provision location_client device

When an event is generated from the modified code, dst is used 0xffff as the meaning of broadcast message and generic app_key index is used in the existing JSON file for app_key_idx. As shown below, the global location information is imported.

Pub time:4408505

location restart timer:10000

company_id:ffff opcode:40

location clt msg:4

Global lat/long/alt:4/5/6

no trans buffer

pool size/cur/max/total 64/5/18/42 140/1/3/20 376/0/3/12 1024/0/0/3

Pub needed period

location clt msg:255

tx complete status:2

no trans buffer

company_id:ffff opcode:8225

ignored

wiced_bt_mesh_model_location_client_send_global_get: 0

Pub time:4418509

location restart timer:10000

company_id:ffff opcode:40

location clt msg:4

Global lat/long/alt:4/5/6

no trans buffer

Pub needed period

9. As your instructions, when I create an event, dst and app_key_idx are set to 0, no event is generated and always null
The below is capture screen..

location restart timer:10000

pool size/cur/max/total 64/5/17/42 140/0/3/20 376/0/3/12 1024/0/0/3

Pub needed period

wiced_bt_mesh_create_event error!!!

location restart timer:10000

Pub needed period

wiced_bt_mesh_create_event error!!!

location restart timer:10000

Pub needed period

wiced_bt_mesh_create_event error!!!

location restart timer:10000

 
From your instructions, I think I provisioned the test I wanted, but I didn't configure that device.
Please let me know how to provision and configure the device for the test I want.
0 Likes
lock attach
Attachments are accessible only for community members.

Here is what I tested:

First, the following 1 to 5 are the test methods that Cypress has informed.

Steps: (1~5)

  1. Download mesh_provision_client  and mesh_location_server on two devices. (make sure you enable location_client model for mesh_provision_client by selecting 'change application settings')
  2. Open ClientControl - Light Control tab and open COM port of the mesh_provision_client device. And then, provision location_server device.
  3. Note down the address allocated to mesh_location_server device (Eg: 0002).
  4. Goto ClientControl directory (.\components\BT-SDK\common\apps\snip\mesh\ClientControl\Release) and open Network.JSON. And check the appKeys generated.
  5. Select model tab on MeshClientControl and use appropriate destination address and app_key_index. (For GET messages you have to use Generic appKey index and for SET messages you have to use Setup appKey index.)
  6. Select location from the drop down menu and then use location commands (GET/SET) to change it’s parameters.

In this way I successfully sent and received location information via get / set message on clientcontrol model tab.

After that, I modified the mesh location client code provided by Cypress with the attached file and want to get global location information from mesh location server every 10 seconds.

(Pls, refer to the attached file)

Step (6~9)

6.Download the modified code to the new device.

7.Added new device (modified mesh location client) to mesh network. On ClientControl, Light Control tab and open COM port of the mesh_provision_client device. And then, provision location_client device

8.When an event is generated from the modified code, dst is used 0xffff as the meaning of broadcast message and generic app_key index is used in the existing JSON file for app_key_idx. As shown below, the global location information is imported.

*** Console Capture ***

Pub time:4408505

location restart timer:10000

company_id:ffff opcode:40

location clt msg:4

Global lat/long/alt:4/5/6

no trans buffer

pool size/cur/max/total 64/5/18/42 140/1/3/20 376/0/3/12 1024/0/0/3

Pub needed period

location clt msg:255

tx complete status:2

no trans buffer

company_id:ffff opcode:8225

ignored

wiced_bt_mesh_model_location_client_send_global_get: 0

Pub time:4418509

location restart timer:10000

company_id:ffff opcode:40

location clt msg:4

Global lat/long/alt:4/5/6

no trans buffer

Pub needed period

9.As your instructions, when I create an event, dst and app_key_idx are set to 0. no event is generated

and always null is returned.

*** Console Capture ***

location restart timer:10000

pool size/cur/max/total 64/5/17/42 140/0/3/20 376/0/3/12 1024/0/0/3

Pub needed period

wiced_bt_mesh_create_event error!!!

location restart timer:10000

Pub needed period

wiced_bt_mesh_create_event error!!!

location restart timer:10000

Pub needed period

wiced_bt_mesh_create_event error!!!

location restart timer:10000

From your instructions, I think I provisioned the test I wanted, but I didn't configure that device.

Pls, let me know how to provision and configure the device for the test I want.


					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
0 Likes

1. Download mesh_location client on one board, and mesh_location_server on another board.

2. Start MeshClient (you can also use ClientControl with a third board running mesh_provision_client). 

3. Type in network name, click Create and then Open.

4. Type in Group name, click on Create

5. Select newly created group in the Current group box,

6. Scan unprovisioned/stop scan/provision for the first device (does not matter which one)

7. Scan unprovisioned/stop scan/provision for the second device

I believe your client should be now publishing location data to the Group address (most likely 0xC000) and your server should be processing location commands because it is subscribed to the group address 0xC000.

You can check JSON file to see if client is configured for publication and if server is configured for subscription.  You can also check trace.txt to see what Configuration Manager was doing.  You should see Add Key, Subscription Change....

You can also reconfigure your client to publish to different address.  In the MeshClient select Use Device / Configure Publication. (I am not sure it will work, because it has been tested with lighting scenarios).

It is also possible to do using Configuration tab of the Client Control, but its a bit painful.  Not sure what your goal is.

lock attach
Attachments are accessible only for community members.

Dear All,,,

I have tested many times as instructed below.

1. Download mesh_location client on one board, and mesh_location_server on another board.

2. Start MeshClient (you can also use ClientControl with a third board running mesh_provision_client).

3. Type in network name, click Create and then Open.

4. Type in Group name, click on Create

5. Select newly created group in the Current group box,

6. Scan unprovisioned/stop scan/provision for the first device (does not matter which one)

7. Scan unprovisioned/stop scan/provision for the second device

But, I wasn't successful, it fails on event creation in the attached code, and returns null.

So I attached json file for provisioning and configure.
I haven't seen publish information in the json file.

Would you please review the attached json file?

And, Let me know how to check trace.txt you informed?

Thanks,,,

0 Likes
lock attach
Attachments are accessible only for community members.

Please check if attached would work for you

lock attach
Attachments are accessible only for community members.

Dear All,,,

First, Thanks for your support!

I tested the two apps (ClientControlMesh and MeshClient) you sent me.

In conclusion, meshclient works fine, but clientcontrolmesh does not work with provision and configure settings.

-. MeshClient Test

Through the attached json file, I can see that publish and subscribe are well set, and I can see the global location information of the location server every 10 seconds from the location client as shown in the console screen below.

Pub needed period

location clt msg:255

tx complete status:2

no trans buffer

wiced_bt_mesh_model_location_client_send_global_get: 0

Pub time:6060112

location restart timer:10000

company_id:ffff opcode:40

location clt msg:4

Global lat/long/alt:0/0/0

no trans buffer

company_id:ffff opcode:40

location clt msg:4

Global lat/long/alt:0/0/0

no trans buffer

company_id:ffff opcode:40

location clt msg:4

Global lat/long/alt:0/0/0

no trans buffer

pool size/cur/max/total 64/5/15/42 140/1/3/20 376/0/3/12 1024/0/1/3

Could please Check the clientcontrolmesh app so that it can be run again?
0 Likes
lock attach
Attachments are accessible only for community members.

updated client control is attached

0 Likes

Dear All,,,

The clientcontrolmesh app that you sent this time works fine.

Thanks for your help!^^

I'm trying to do that the mesh location client publishes the GET message to get global location information every 10 seconds from location server, and transmit three times per publish.

Pls, refer to the below console screen on location client board.

Pub needed period

location clt msg:255

tx complete status:2

no trans buffer

wiced_bt_mesh_model_location_client_send_global_get: 0

Pub time:4400951

location restart timer:10000

company_id:ffff opcode:40

location clt msg:4

Global lat/long/alt:0/0/0

no trans buffer

company_id:ffff opcode:40

location clt msg:4

Global lat/long/alt:0/0/0

no trans buffer

company_id:ffff opcode:40

location clt msg:4

Global lat/long/alt:0/0/0

no trans buffer

Pub needed period

location clt msg:255

tx complete status:2

no trans buffer

wiced_bt_mesh_model_location_client_send_global_get: 0


I have one question and see "no trans buffer" on upper console screen.

As far as I know, this message is what you see when the following two functions are called:
However, my app has never called these two functions:

My Question : 

What does the "no trans buffer" message mean? How is it called and this message appears on the console screen?

wiced_bt_mesh_hci_event_t *wiced_bt_mesh_create_hci_event(wiced_bt_mesh_event_t *p_event)

{

    wiced_bt_mesh_hci_event_t *p_hci_event = (wiced_bt_mesh_hci_event_t *)wiced_transport_allocate_buffer(host_trans_pool);

    if (p_hci_event == NULL)

    {

        WICED_BT_TRACE("no trans buffer\n");

    }

    else if (p_event != NULL)

    {

        p_hci_event->src         = p_event->src;

        p_hci_event->dst         = p_event->dst;

        p_hci_event->app_key_idx = p_event->app_key_idx;

        p_hci_event->element_idx = p_event->element_idx;

        p_hci_event->rssi        = p_event->rssi;

        p_hci_event->ttl         = p_event->ttl;

        p_hci_event->company_id  = p_event->company_id;

        p_hci_event->opcode      = p_event->opcode;

    }

    return p_hci_event;

}

wiced_bt_mesh_hci_event_t *wiced_bt_mesh_alloc_hci_event(uint8_t element_idx)

{

    wiced_bt_mesh_hci_event_t *p_hci_event = (wiced_bt_mesh_hci_event_t *)wiced_transport_allocate_buffer(host_trans_pool);

    if (p_hci_event == NULL)

    {

        WICED_BT_TRACE("no trans buffer\n");

    }

    else

    {

        p_hci_event->src         = 0;

        p_hci_event->app_key_idx = 0;

        p_hci_event->element_idx = element_idx;

    }

    return p_hci_event;

}

0 Likes

I do not understand what "transmit 3 times per publish means".  Client can typically do whatever he wants.  You can configure Server to publish every 10 seconds to the Client's address, or to the group address.

Transport refers to UART.  No transport buffers probably means that application tried to send something over HCI UART but failed.  It is probably because nothing is connected to the HCI UART on the other side.

0 Likes

Dear All,,,

If I review the code, I can see the conditional compilation defined by HCI_CONTROL as follows:

===============================================================

#ifdef HCI_CONTROL

#include "wiced_transport.h"

#include "hci_control_api.h"

#endif

#if defined HCI_CONTROL

    wiced_bt_mesh_hci_event_t *p_hci_event;

#endif

#if defined HCI_CONTROL

        if ((p_hci_event = wiced_bt_mesh_create_hci_event(p_event)) != NULL)

            wiced_bt_mesh_send_hci_tx_complete(p_hci_event, p_event);

#endif

===============================================================

I want to compile after disabling HCI_CONTROL conditions.

How can I disable HCI_CONTROL condition?

0 Likes

Do disable HCI_CONTROL, go to the IDE project settings (right click project, Properties, C/C++ Build, Settings) and modify compiler/linker settings there like any other IDE.

Unfortunately this method will change in Modus Toolbox 2.0...

0 Likes

Dear All,,,

Our final goal is to create a patient tracker based on the cypress mesh location client & server example.

With an updated app that is supported by you, we now provision and configure three location servers 
and one location server / client (control model) using the mesh demo kit. Under testing.
For our final goal, we need a dedicated provisioning & configure app and also an app for entering 
GPS coordinates.
So, we need to know what's changed between the previous MeshClient / ClientControlMesh App 
and the updated app we provided to us this time.
 
I have two requests below.
1.   What is the change in the previous app and the app you updated about 
MeshClient / ClientControlMesh App?
2.   Please provide the source code of the updated app about MeshClient / ClientControlMesh!

Thanks,

0 Likes

The next release will contain source code with all fixes included. I believe it is expected end of the month.

0 Likes

Dear All,,,

Thanks for your inform.

Regarding the patient tracker, which is our application, our internal development schedule is tight. So, can you tell me the difference between the previous app and the update app you gave us and what modifications you gave us?

Thanks,

0 Likes
lock attach
Attachments are accessible only for community members.

Attached files contain fixes for the location client/server processing in the ClientControl and MeshClient apps.  You should be able to diff with the version of the files in the release to see the changes.  Note that the files are from the upcoming 2.0 release, so there might be changes that should not be merged in to the 1.4 files.