Page 1 of 1

Read variable name in C

Posted: 17 Mar 2017, 12:35
by JuspB
Hello,

I've been looking the examples in the piTest C program. I wonder If is it possible to get the variable names from the DIO modules. For instance, get the variable name from the byte or bit position. Do you have any example?

Thanks and best regards!

Re: Read variable name in C

Posted: 17 Mar 2017, 14:50
by volker
Sorry, but not yet. We are on the way delivering such a function. Please give us 2-3 weeks.

Re: Read variable name in C

Posted: 02 May 2017, 09:37
by JuspB
Hello,

Any news about this? :)

Re: Read variable name in C

Posted: 03 May 2017, 01:40
by volker
No sorry, not yet. You could e.g. also scan and interpret the JSON file containing the complete information. But you would need to calculate the offsets and it's a bit tricky to retrieve the information you're looking for...

Re: Read variable name in C

Posted: 29 Jun 2017, 20:19
by fpf_baden
Is there a complete documentation of the JSON file containing the complete information?

Re: Read variable name in C

Posted: 30 Jun 2017, 09:53
by dirk
Yes here https://revolution.kunbus.de/json-attribute/
Unfortunately currently only in german

Re: Read variable name in C

Posted: 01 Jul 2017, 11:26
by fpf_baden
This describes the RAP file format.
I am looking for the schema of the config.rsc file.

Re: Read variable name in C

Posted: 04 Jul 2017, 11:11
by volker
We will bring the documentation online soon. There is a lot of stuff inside the file which has nothing to do with the PA and the devices and the variables but a lot with the current views of PiCtory (position of windows etc.). So instead of parsing all that stuff how about scanning the ST-Export?
The export file is formatted as ST global var declaration and thus explains itself. Example:

Code: Select all

GLOBALS hardwareConfig
		 VAR_GLOBAL
		 		 RevPiStatus AT %IB1.960: BYTE := 0; // 
		 		 RevPiIOCycle AT %IB1.961: BYTE := 0; // 
		 		 RevPiLED AT %QB1.966: BYTE := 0; // 
		 		 I_1 AT %IX1.971.0: BOOL := 0; // 
		 		 I_2 AT %IX1.971.1: BOOL := 0; // 
		 		 I_3 AT %IX1.971.2: BOOL := 0; // 
		 		 I_4 AT %IX1.971.3: BOOL := 0; // 
		 		 I_5 AT %IX1.971.4: BOOL := 0; // 
		 		 I_6 AT %IX1.971.5: BOOL := 0; // 
		 		 I_7 AT %IX1.971.6: BOOL := 0; // 
		 		 I_8 AT %IX1.971.7: BOOL := 0; // 
		 		 I_9 AT %IX1.971.8: BOOL := 0; // 
		 		 I_10 AT %IX1.971.9: BOOL := 0; // 
		 		 I_11 AT %IX1.971.10: BOOL := 0; // 
		 		 I_12 AT %IX1.971.11: BOOL := 0; // 
		 		 I_13 AT %IX1.971.12: BOOL := 0; // 
		 		 I_14 AT %IX1.971.13: BOOL := 0; // 
		 		 I_15 AT %IX1.971.14: BOOL := 0; // 
		 		 I_16 AT %IX1.971.15: BOOL := 0; // 
		 		 O_1 AT %QX1.1041.0: BOOL := 0; // 
		 		 O_2 AT %QX1.1041.1: BOOL := 0; // 
		 		 O_3 AT %QX1.1041.2: BOOL := 0; // 
		 		 O_4 AT %QX1.1041.3: BOOL := 0; // 
		 		 O_5 AT %QX1.1041.4: BOOL := 0; // 
		 		 O_6 AT %QX1.1041.5: BOOL := 0; // 
		 		 O_7 AT %QX1.1041.6: BOOL := 0; // 
		 		 O_8 AT %QX1.1041.7: BOOL := 0; // 
		 		 O_9 AT %QX1.1041.8: BOOL := 0; // 
END_VAR
END_GLOBALS
The file is automatically written every time you save a configuration in PiCtory. You can find it here in the RevPi Core file system:
/var/www/pictory/export/revpi.global

It is also possible to get remote access to this configuration via https using the following URL:
http://192.168.0.10/pictory/export/revpi.global

Please note that only those variables are listed in the file which have been marked as "export" in the PiCtory's PA-List per module.
Hope this helps until we get the ioctl call for variable names into the PiControl driver.