SecureStrncpy

Hi.
I found one problem using the RscString class. (img1)
제목 없음.pngHere, the N constant is 16384, and the arg.Length() is 7870.

However, I don’t know why Arp::Exception throws this error (img2)

image.png
Is the maximum value of the constant N of the RscString class less than 16384?

I’d appreciate it if you could answer

best regards.

The issue has been reproduced an I am currently investigating it with the developers. I will let you know as soon as we have a work-around for this problem.

The issue has been reproduced an I am currently investigating it with the developers. I will let you know as soon as we have a work-around for this problem.</p>

Thank you, and I hope the problem will be solved!
best regards.

This has now been reported as a bug in the firmware.
I understand that your PEM file contains 4 certificates, so the suggested workaround is to break up the file into two or more parts, with each part containing one or more certificates, and with each part less than or equal to 4096 characters. The Validate() function can then be called multiple times in order to get the device information.
I hope that this is a suitable workaround until the bug can be fixed.

This has now been reported as a bug in the firmware.</p>I understand that your PEM file contains 4 certificates, so the suggested workaround is to break up the file into two or more parts, with each part containing one or more certificates, and with each part less than or equal to 4096 characters. The Validate() function can then be called multiple times in order to get the device information.</p>I hope that this is a suitable workaround until the bug can be fixed.</p>

I understood about the certificate division. Thank you.

Can I see the sample code using the Validate() function using the IDeviceIdentityValidatorService class?

best regards.

Can I see the sample code using the Validate() function using the IDeviceIdentityValidatorService class?Unfortunately we don’t have any sample code for that specific service at the moment. The RSC service can be set up and called in a similar way to other RSC services, many of which do have samples available. If you can describe a specific issue you’re having, we can try to help.
To help us keep track of different issues, please open a new conversation for each new issue.

Can I see the sample code using the Validate() function using the IDeviceIdentityValidatorService class?</p>Unfortunately we don’t have any sample code for that specific service at the moment. The RSC service can be set up and called in a similar way to other RSC services, many of which do have samples available. If you can describe a specific issue you’re having, we can try to help.</p>To help us keep track of different issues, please open a new conversation for each new issue.</p>

I’m sure you’re busy, but thank you for answering.

Do I need to create ProxyFactory with the GetProxyFactory() function first to use the Validate() function of the IDeviceIdentityValiderService class?
If yes, I wonder what are the parameters of the IRScServiceProxyFactory::CreateServiceProxy() function.
image.pngWhat is RscHandle?
What is the RscClient?
I have a lot of questions because I’m not good enough. Please understand.

best regards.

Do I need to create ProxyFactory with the GetProxyFactory() function first to use the Validate() function of the IDeviceIdentityValiderService class?No.
Please work through the tutorials that are available on github.
Firstly, create and deploy a simple ACF component (also called a „Function Extension“).
Then modify that ACF component to implement a simple RSC client for a basic RSC service, something like the ReadSingle method on the DataAccess service:
https://github.com/PLCnext/CppExamples/blob/master/Examples/DataAccess
If you can successfully call the ReadSingle method on the DataAccess service, then it should be fairly easy to call the Validate method on the DeviceIdentityValidatorService using the same pattern.

Thank you for your response.

When I tried the link you gave me, I got two questions.
First, where does the DataAccessLibrary.hpp file exist?
image.pngSecond, when you create a DataAccessComponent class object, what are the two parameters?
image.png
I’d appreciate it if you could answer.

best regards.

If you follow the instructions in the README:
CppExamples/Examples/DataAccess/README.MD at master · PLCnext/CppExamples Collection of various C++ sample code for PLCnext Technology controllers. - PLCnext/CppExamples … then the file DataAccessLibrary.hpp will be created when the ACF project is created and you will not get that compiler error.
It’s not necessary to understand the Component constructor parameters in order to get the example working, because component instances are created by the PLCnext Runtime, and it knows what parameters to pass. We could get into the details of what those parameters are and where they come from, but that won’t help you to get this example working.
If you have any other questions, please let us know. We’re happy to help.

If you follow the instructions in the README:</p>[https://github.com/PLCnext/CppExamples/blob/master/Examples/DataAccess/README.MD</a></p>… then the file DataAccessLibrary.hpp will be created when the ACF project is created and you will not get that compiler error.</p>It’s not necessary to understand the Component constructor parameters in order to get the example working, because component instances are created by the PLCnext Runtime, and it knows what parameters to pass. We could get into the details of what those parameters are and where they come from, but that won’t help you to get this example working.</p>If you have any other questions, please let us know. We’re happy to help.</p>

Thank you for your answer.

I’m installing plcncli on my Linux and creating a user authentication app using a .so file created after build.

I’ve never used the PLCnext Engineer.

So, is PLCnext Engineer necessary to access the data?
image.png
If not, where should I place the DataAccess.pcwlx file in the project directory?

If you don’t want to use PLCnext Engineer, then you can modify the example to not use PLCnext Engineer at all.
In the ACF component you can create just one OUT port GDS variable, and then use the ReadSingle and WriteSingle methods to read and write the value of the GDS variable. When that works, you’ve successfully used the Data access RSC service, and that should help you to set up a client for the Device Validator service in the same way.

If you don’t want to use PLCnext Engineer, then you can modify the example to not use PLCnext Engineer at all.</p>In the ACF component you can create just one OUT port GDS variable, and then use the ReadSingle and WriteSingle methods to read and write the value of the GDS variable. When that works, you’ve successfully used the Data access RSC service, and that should help you to set up a client for the Device Validator service in the same way.</p>

Thank you for your answer.
The error of not finding the DataAccessLibrary.hpp file was just my mistake.

But I have another error. I’m trying to work it out on my own, but it’s not solved, so I’m asking. I’m not good enough. I’m sorry.

Error while building the DataAccess project.
image.pngI created the project, copied and built the files as shown on GitHub.
I haven’t modified the cpp file or hpp yet.

I look forward to hearing from you.

best regards.

After copying the source files from the github project to the new ACF project, these commands worked for me with plcncli version 2023.6 and the SDK for AXCF2152 version 2023.6:

plcncli set target --name AXCF2152 --version 23.6 --add
plcncli generate code
plcncli generate config
plcncli build

After copying the source files from the github project to the new ACF project, these commands worked for me with plcncli version 2023.6 and the SDK for AXCF2152 version 2023.6:</p>

plcncli set target --name AXCF2152 --version 23.6 --add\nplcncli generate code\nplcncli generate config\nplcncli build\n<\/pre>
I did,  
plcncli new poroject -n DataAccess  
plcncli set target --add -n AXCF3152  
copy src file,  
plcncli generate code  
plcncli generate config  
plcncli build  
  
my plcncli version is 23.0.0 LTS  
and sdk is 2023.0.2 LTS  
What kind of problem?  
Does it work only on AXCF2152 by any chance?  
  
best regards.

The first command needs to be:

plcncli new acfproject -n DataAccess

Do I need to create ProxyFactory with the GetProxyFactory() function first to use the Validate() function of the IDeviceIdentityValiderService class?</p>No.</p>Please work through the tutorials that are available on github.</p>Firstly, create and deploy a simple ACF component (also called a „Function Extension“).</p>Then modify that ACF component to implement a simple RSC client for a basic RSC service, something like the ReadSingle method on the DataAccess service: </p>[https://github.com/PLCnext/CppExamples/blob/master/Examples/DataAccess</a></p>If you can successfully call the ReadSingle method on the DataAccess service, then it should be fairly easy to call the Validate method on the DeviceIdentityValidatorService using the same pattern.</p>

The first command needs to be:</p>

plcncli new acfproject -n DataAccess\n<\/pre>
Thanks for your help.  
  
so .. Is there any way to know the identity information of the device other than the Validate() function?  
  
If not, is there a relationship between the ReadSingle method and the Vaildate method?  
  
I have no idea how to use the IDeviceIdentityValidatorService class now.  
Does Validate() call within the DataAccessComponent::AccessData() method?  
  
  
best regards.

Is there any way to know the identity information of the device other than the Validate() function?It depends what identity information you need. The Device Info Service provides information like the unique Serial Number of the device and the unique Cloud UUID of the device:
RSC Device Interface Services
The RSC Device Interface Services provide a range of functions for accessing properties of the operating system and the controller hardware. You can call the information with the following interfaces and defined parameters. The following headers are required to use the service; integrate these headers via #include, if necessary:
is there a relationship between the ReadSingle method and the Vaildate method?Does Validate() call within the DataAccessComponent::AccessData() method?No. The only reason I suggested that you could try the ReadSingle Method on the DataAccess service is because, if you got that working, then you should be able to call the Validate method on the IDeviceIdentityValidatorService in a similar way. The two methods are part of two completely different RSC services, but the pattern for using those two services (and all other RSC services) is similar:
RSC documentation reference
Here 's an overview to the available documentation regarding the RSC services that are built into the PLCnext Runtime System. This reference will be updated over time.

                                                              1. include the relevant header file for that RSC service in your ACF component
                                                              2. use the ServiceManager to get a reference to the service
                                                              3. call one or more methods on the service
If you have successfully completed those steps for the ReadSingle method on the DataAccess service, then you should be able to use the same pattern for any other RSC service, including the IDeviceIdentityValidatorService  and the IDeviceInfoService. A complete list of RSC services is shown here:  
The documentation describes the set of methods that are available for each service.
Is there any way to know the identity information of the device other than the Validate() function?<\/p>It depends what identity information you need. The Device Info Service provides information like the unique Serial Number of the device and the unique Cloud UUID of the device:<\/p>[https:\/\/www.plcnext.help\/te\/Communication_interfaces\/Remote_Service_Calls_RSC\/RSC_device_interface_services.htm#IDeviceInfoService<\/a><\/p>is there a relationship between the ReadSingle method and the Vaildate method?<\/p>Does Validate() call within the DataAccessComponent::AccessData() method?<\/p>No. The only reason I suggested that you could try the ReadSingle Method on the DataAccess service is because, if you got that working, then you should be able to call the Validate method on the IDeviceIdentityValidatorService in a similar way. The two methods are part of two completely different RSC services, but the pattern for using those two services (and all other RSC services) is similar:<\/p>
                                                              1. include the relevant header file for that RSC service in your ACF component<\/li>
                                                              2. use the ServiceManager to get a reference to the service<\/li>
                                                              3. call one or more methods on the service<\/li><\/ol>If you have successfully completed those steps for the ReadSingle method on the DataAccess service, then you should be able to use the same pattern for any other RSC service, including the IDeviceIdentityValidatorService  and the IDeviceInfoService. A complete list of RSC services is shown here:<\/p>[https:\/\/www.plcnext.help\/te\/Communication_interfaces\/Remote_Service_Calls_RSC\/RSC_documentation_reference.htm<\/a><\/p>The documentation describes the set of methods that are available for each service.<\/p>
                                  Thank you for always helping me.  
                                    
                                  After building the acf project  
                                  It was distributed to PLC with reference to DataAccess/How_to_deploy.txt.  
                                    
                                  But, Rebooting the PLC does not create info in the Output.log file.  
                                    
                                  1. mkdir /opt/plcnext/projects/DataAccess  
                                  2. scp src/DataAccessLibrary.acf.config admin@192.168.1.20:/opt/plcnext/projects/DataAccess  
                                  3. scp -r bin/AXCF3152_23.0.2.56/Release/lib admin@192.168.1.20:/opt/plcnext/projects/DataAccess  
                                  4. vi DataAccess.acf.config and copy this xml  
                                  [image.png](https:\\/\\/forum.plcnext-community.net\\/uploads\\/FDUA8DUZN1FO\\/image.png)5. cp DataAccess.acf.config /opt/plcnext/projects/Default  
                                    
                                  Did I make a mistake?  
                                    
                                  best regards.

All that looks OK.
Are there any messages at all in the Output.log file related to DataAccess, during the startup of the PLCnext Runtime?
The DataAccess.acf.config file should include the DataAccessLibrary.acf.config file, which should instruct the PLCnext Runtime to create an instance of your ACF component. If there is a problem creating that component instance, then there should be an error message in the Output.log file.