Example for ua_file_reader_load_file

Questions regarding the use of the High Perfomance SDK for Server development

Moderator: uasdkhpc

Post Reply
jfischer
Jr. Member
Jr. Member
Posts: 2
Joined: 23 Jan 2018, 16:45

Example for ua_file_reader_load_file

Post by jfischer »

Hi,

I'm currently evaluating the High Performance SDK. My goal is to load a binary file (e.g., ns0.bin as provided in example 'getting_started/lesson02'). I initialized an ua_file_reader with a set of handler functions (my_add_namespace, my_add_string_table, ...) as shown in the API documentation:

Code: Select all

struct ua_file_reader reader;
ua_file_reader_init(&reader, my_add_namespace, my_add_string_table, my_add_string, my_add_node, my_add_reference, my_report_stat, 0);
ret = ua_file_reader_load_file(&reader, "ns0.bin");
The usage of these handler functions is not clear to me. Can anyone please provide some example code that shows what these handler functions do? It would also be great if someone can provide an explanation on their parameters and return values.

Thank you very much,

Joerg

User avatar
Support Team
Hero Member
Hero Member
Posts: 3070
Joined: 18 Mar 2011, 15:09

Re: Example for ua_file_reader_load_file

Post by Support Team »

Hello Joerg,

The file_reader is used internally by the SDK to load address spaces.
You can simply use ua_addressspace_load_file to load an address space from a binary file.
See http://documentation.unified-automation ... odel_files for one example.
Actually most of our examples use this approach.

The file_reader would only be necessary if you want to load a file for other purposes, e.g. creating a configuration tool.
But for the main use case, loading a file into the server, we have already implemented this in ua_addressspace_load_file.

regards,
Unified Automation Support Team
Best regards
Unified Automation Support Team

jfischer
Jr. Member
Jr. Member
Posts: 2
Joined: 23 Jan 2018, 16:45

Re: Example for ua_file_reader_load_file

Post by jfischer »

Thank you for the answer.

Best,

Joerg

Post Reply