Hello Dialog,
Using the example project "ble_app_peripheral" we created our project with new custom profile with 3 new characteristics Param1 - 1 byte, Param2 - 1 byte and Param2 - 2 bytes. An external MCU communicates with the BLE chip and can read and update these parameters. Mobile application also can read and update the parameters. Questions:
1. Which is the best and fastest way to read the actual values of these characteristics from the custom profile (e.g., there is a serial command from the external MCU "Get Params")?
2. Which is the best and fastest way to write the new values of these characteristics to the custom profile (e.g., there is a serial command from the external MCU "Set Params")?
3. How to update the default values of the characteristics with our values after POR and the default initialization of the data base? Probably the answer of the second question will help us for the third question.
Thank you in advance for the fast question.
Hi AngelT,
You have a fully embedded or a fully hosted implementation ? To be more exact the application that operates on the 580 runs on the 580 or the external MCU over GTL ? If over GTL then:
1) There isn't any implementation on this in the profile but i suppose you can retrieve the data from the database by using a custom message and a custom function that reads the database from the 580 (on the 580 in the profile firmware) and returns a message over the GTL interface to your application. For example in the 580 prox_reporter_ext in the diss service there is a function diss_set_char_val_req_handler() that is used in order to set data in the database (its invoked by the windows application as soon as the application has a confirmation that the device has created the database). You can create an additional function in order to retrive the data from the database with attmdb_att_get_value() and return the value over GTL.
Also there are commands that you can issue from the external application, you can check at the RW-BLE-GATT-IS the GATTM_ATT_GET_VALUE_REQ is the one that you are looking for.
2) You can use the allready implemented message CUSTS1_VAL_SET_REQ and update the value of the database or again implement the command GATTM_ATT_SET_VALUE_REQ.
3) The same way as indicated in the second question.
Thanks MT_dialog
Hi MT_dialog,
Thank you for the fast answers. I succeeded to implement read/write operation to the DB using your suggestions and the example projects, but I have a few questions.
1. Is it correct to execute the functions attmdb_att_get_value() and attmdb_att_set_value() in the TASK_APP and to read/write characteristics from the custom profile where the task is TASK_CUSTS1?
2. These is a defined message CUSTS1_VAL_SET_REQ, but there is not a message CUSTS1_VAL_GET_REQ. Why? I checked all example projects and profiles (e.g. DISS and DISC). Nothing.
3. Why in the example project "ble_app_peripheral" the execution of the function custs1_val_set_req_handler() is enabled only if the device is in connected mode? If the message CUSTS1_VAL_SET_REQ is sent and the current state is not "connected" the function will not be executed. This behavior is defined by the BLE standard or these is other reason.
Hi AngelT,
1)我不得到这个问题,为什么这一点should be wrong ? If you have a fully hosted application those functions are the only way to direct access the values of your characteristics, in a fully embedded design you can either use them via a custom message or use the GTL commands i ve indicated.
2) You can implement one if you would like, i suppose that reason is because the application is aware of what are the values that are set on the characterictics which can be read and if
有一个写从主会有一个different kind of indication (a write indication) that will inform that application for the changed value in the database.
3) I dont see any specific reason for that and its definately not defined by the SIG since this is a custom profile, i suppose that the specification under which the custom profile was build dictated that the interaction with the profile should be done only of the device is connected.
Thanks MT_dialog