cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4 MCU

ToVa_285016
Contributor

Hi,

   

I have a project that has a few arrays of items that the Android app can change.  For instance, there is an array of 10 'custom value' items that consist each of:

   
        
  • value number (1-10)
  •     
  • value address (0-511)
  •     
  • value (0-255)
  •     
  • enabled (0,1)
  •    
   

Do I need to set up 10 different characteristics, one for each 'custom value'?  

   

When I receive a read request, is there a way to determine which one the app wants to read, write it into the characteristic, and then let the app read the data, or generate a notification for the app to read the updated characteristic?  

   

I am trying to simplify things, and don't want 10 different, identical in structure characteristics if I don't have to.  I also have a 'custom color' and 'custom program' characteristic that this would apply to.

   

Sorry if this is unclear, please let me know if you have any questions
Thank you,
Tom

0 Likes
1 Solution
Anonymous
Not applicable

1) Depends on how you want to split the data. Most likely, you will need to have a characteristic for each of your "10" items, and either splice all of the array items into the same field within the characteristic, or split it up so each has its own characteristic that contains it.

   

2) When you receive a read request, there is a handle value indicating what is being read passed throught the eventParam pointer. See documentation for the BLE events associated with the read function. The documentation also explains the exact process, but I believe you can receive the event, process the data in some way, then send the new/old data to the android app. Tldr; Yes. This is possible/setup easily.

   

3) You can structure each item in the array as a service, with the characteristics contained within it. But ultimately, in order to "simplify" things as you are describing it, I would suspect that you either need to hide it in some way on the app, or have fixed names/fields that can all be unique.

View solution in original post

0 Likes
2 Replies
Anonymous
Not applicable

1) Depends on how you want to split the data. Most likely, you will need to have a characteristic for each of your "10" items, and either splice all of the array items into the same field within the characteristic, or split it up so each has its own characteristic that contains it.

   

2) When you receive a read request, there is a handle value indicating what is being read passed throught the eventParam pointer. See documentation for the BLE events associated with the read function. The documentation also explains the exact process, but I believe you can receive the event, process the data in some way, then send the new/old data to the android app. Tldr; Yes. This is possible/setup easily.

   

3) You can structure each item in the array as a service, with the characteristics contained within it. But ultimately, in order to "simplify" things as you are describing it, I would suspect that you either need to hide it in some way on the app, or have fixed names/fields that can all be unique.

View solution in original post

0 Likes
ToVa_285016
Contributor

Thank you for your comments.  I think that number 2 will probably work the best.  I will test this out.

   

Regards,
Tom

0 Likes