This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CODECOMPOSER: Gui Composer Custom Codec Received Databind

Part Number: CODECOMPOSER

Tool/software:

I'm using the following target configuration and am able to send and receive data (as in I can see the received data when debugging my custom codec decode function).

usb+cr+custom+streaming

I need to bind the received data to a label and run another function when received. How would I go about implementing this?

If possible, an example project would be very helpful.

Thanks!

  • Hi Aiden,

    Based on your comment, I assume you are using GCv3. Is that correct?

    Thanks

    ki

  • Thanks, I'll bring this thread to the attention of the GC experts. 

  • Hi Aiden, 

    Your custom codecs decode function parses the data buffer that is coming in to create a javascript object, which then should be passed to streaming model with this type of a function call

    this.targetDecoder.decode(YourJavaScriptObject);

    You would then need to create a connection (what we call a data binding) between your label widget and streaming model. The way to do this is by selecting a widget in designer and using property page on the right side to create a binding (click on chainlink icon beside "label" field and choose streaming from left drop down selection and in right hand side box enter js object field. 

    Could you clarify what you are trying to do with your function? Are you trying to add a function to accumulate data (e.g. create a log of received values) or transform your data? The second case can be used to for example to transform data e.g. change temperature sensor reading in Celsius to Fahrenhait. 

    martin

  • Hi Martin,

    I'm attempting to use UART for reading and writing to the registers on my device but I'm having to use the setSymbols from the register model every time a read or write is made, I've resulted to doing this in the decode function of the custom codec. 

    Is there a way to override the functions the register model uses to read and write. This is somewhat unrelated to my initial question but I believe it'd be an easier solution. Something like a custom codec for the register model like the streaming model has.

    Thanks!

  • Hi Aiden, 

    setSymbols is not really intended to be used for register information updates. It is use is to provide register information to register model, kind of like providing a schema to a database. The actual data updates would need to use a different mechanism. 

    The way this would need to be setup is the target configuration would need usb transport + custom codec + register model. The main challenge is that it needs to be custom codec that is implemented differently than what streaming model expects. We do not have this type of an example in public documentation. I'll send you pseudo code example through e-mail. 

    Martin