Read variable name in C

Topics about the Software of Revolution Pi
Post Reply
JuspB
Posts: 8
Joined: 08 Feb 2017, 12:22

Read variable name in C

Post 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!
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41

Re: Read variable name in C

Post by volker »

Sorry, but not yet. We are on the way delivering such a function. Please give us 2-3 weeks.
Unser RevPi Motto: Don't just claim it - make it!
JuspB
Posts: 8
Joined: 08 Feb 2017, 12:22

Re: Read variable name in C

Post by JuspB »

Hello,

Any news about this? :)
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41

Re: Read variable name in C

Post 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...
Unser RevPi Motto: Don't just claim it - make it!
User avatar
fpf_baden
Posts: 20
Joined: 08 Jun 2017, 08:31
Location: Karlsruhe
Contact:

Re: Read variable name in C

Post by fpf_baden »

Is there a complete documentation of the JSON file containing the complete information?
User avatar
dirk
KUNBUS
Posts: 2174
Joined: 15 Dec 2016, 13:19

Re: Read variable name in C

Post by dirk »

Yes here https://revolution.kunbus.de/json-attribute/
Unfortunately currently only in german
User avatar
fpf_baden
Posts: 20
Joined: 08 Jun 2017, 08:31
Location: Karlsruhe
Contact:

Re: Read variable name in C

Post by fpf_baden »

This describes the RAP file format.
I am looking for the schema of the config.rsc file.
User avatar
volker
Posts: 1046
Joined: 09 Nov 2016, 15:41

Re: Read variable name in C

Post 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.
Unser RevPi Motto: Don't just claim it - make it!
Post Reply