Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i78: ut-core: upgrade core to support multiple profile inputs that get merged into a single lookup #78

Open
Ulrond opened this issue May 3, 2024 · 2 comments · May be fixed by #158
Open
Assignees
Labels
enhancement New feature or request

Comments

@Ulrond
Copy link
Contributor

Ulrond commented May 3, 2024

Consideration

it would be good if we can support

./hdmi_cec -p hdmiProfile.yaml -p platformTestProfile.yaml

And all the profiles get merged together, in a single entry. I realise this means that instead of supporting file based kvp, in the backend we would need to support adding a new function to kvp. Since we have open - which opens the first file, we can introduce read which basically appends to the current ut_kvp_instance_t with extra data..

or we change the basic configuration for open, to always append to the already open data..

@Ulrond Ulrond added the enhancement New feature or request label May 3, 2024
@Ulrond Ulrond transferred this issue from rdkcentral/ut-core Jun 19, 2024
@Ulrond Ulrond transferred this issue from rdkcentral/ut-control Jun 25, 2024
@Ulrond
Copy link
Contributor Author

Ulrond commented Jun 28, 2024

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#define MAX_FILES 10 // Maximum number of files to handle

int main(int argc, char *argv[]) {
    int opt;
    char *filenames[MAX_FILES];  
    int fileCount = 0;
    const char *optString = "f:"; 

    while ((opt = getopt(argc, argv, optString)) != -1) {
        switch (opt) {
            case 'f':
                if (fileCount < MAX_FILES) {
                    filenames[fileCount++] = optarg;
                } else {
                    fprintf(stderr, "Error: Maximum number of files reached.\n");
                    exit(EXIT_FAILURE);
                }
                break;
            default: 
                fprintf(stderr, "Usage: %s [-f filename]...\n", argv[0]); // Notice the "..."
                exit(EXIT_FAILURE);
        }
    }

    printf("Processing %d files:\n", fileCount);
    for (int i = 0; i < fileCount; i++) {
        printf("  - %s\n", filenames[i]);
        // Do something with each file (e.g., call your process_node function)
    }

    return 0;
}

Yaml file

./your_program -f file1.yaml -f file2.json -f http://example.com/config.yaml

@Ulrond
Copy link
Contributor Author

Ulrond commented Jun 28, 2024

we should be able to support this via changing the input file to ut-control-kvp-open to something like this !include <file>, which appends the included file into the instance. or !include <http://url>

@Ulrond Ulrond changed the title upgrade core to support multiple profile inputs that get merged into a single lookup i78: ut-core: upgrade core to support multiple profile inputs that get merged into a single lookup Sep 9, 2024
@Ulrond Ulrond moved this from Todo to Under Review in UT-Core Roadmap Dec 16, 2024
kanjoe24 added a commit that referenced this issue Dec 18, 2024
kanjoe24 added a commit that referenced this issue Dec 19, 2024
kanjoe24 added a commit that referenced this issue Dec 19, 2024
kanjoe24 added a commit that referenced this issue Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Under Review
Development

Successfully merging a pull request may close this issue.

2 participants