Read value of variables from outside of Storyboard
Hi, so I have been trying to use iogen and iorcv to set and get variable values from the Storyboard. I tried this by first running the iorcv to listen to the "test" channel (shown in picture below) which corresponds to my application, running my application in Storyboard as normally, and then running iogen in a separate command prompt to toggle the variable "toggle" of Checkbox inside Layer to 1. However, with this setup, the iogen is unable to get to "verification OK!" part and is stuck, with the iorcv command prompt showing a greio.iodata_set data value that is not equal to what I want.
This is also evident if I run the debugger and check the value of Layer.Checkbox.toggle manually; it is not changed/toggled to 1.
The command prompt commands I executed is shown below:
But if I run only the iogen command (without first running iorcv), it works fine.
Thus my problem is that I can set values in the Storyboard externally, but I cannot read or verify variable values in the Storyboard. Can anyone help me with how to read variable values from an external source (like the cmd prompt above or even better probably from a Python script)?
Comments
Hi Aldo,
It is certainly possible to also write to and read back the values of application variables using Storyboard IO API:
https://support.cranksoftware.com/hc/en-us/articles/360056943772-Storyboard-IO-Utilities
https://support.cranksoftware.com/hc/en-us/articles/360057413451-Setting-Application-Data
You can test the set data operation by using for example the ClusterIO sample that is included with Storyboard Designer. I can set the speed value variable (speedometer_content.speed.text) to value '123' directly using iogen:
As you can see the iogen utility automatically verifies the result of the greio.iodata-set request by issuing a second request of type greio.iodata-get with one string parameter which is the name of the receive channel to send the response to - in this case 'iogen_receive':
This behaviour is hard coded in the iogen utility and so it cannot be used to do what you are trying to do in its-own. What iogen actually does is open a receive channel 'iogen_receive' temporarily to receive the response and then validates that the variable when read back is the same value as what you sent and hence the Verification OK! message.
Note that the receive channel parameter is fixed length must be exactly 25 bytes long so you may need to pad with NULL or space characters.
What you actually get sent back from the request via the receive channel specified in the request is an event greio.iodata_get_reply containing the value:
Now you should have all the pieces and can call this from C/C++ quite easily. This is the code fragment from iogen which does it:
If you wish to experiment with Python then we have a prototype Python 3 wrapper library around Storyboard IO API. It is available on request and there is a post on the forum here:
https://support.cranksoftware.com/hc/en-us/community/posts/360077162471-Writing-SBIO-backend-in-Python
Hopefully this answers your query.
Regards,
Garry
Please sign in to leave a comment.