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

Create model from config file failed when there is no physical address for GSEControl and SampledValueControl #518

Open
Tachiguishi opened this issue Jul 29, 2024 · 0 comments

Comments

@Tachiguishi
Copy link

There are two scenarios when generating a config file from CID using genconfig.jar: one with a GSEControl that has a physical address and one without.

genconfig.jar code:

if (gseAddress == null) {
    output.println(");");
} else {
    output.println("){");
    
    output.print("PA(");
    output.print(gseAddress.getVlanPriority() + " ");
    output.print(gseAddress.getVlanId() + " ");
    output.print(gseAddress.getAppId() + " ");
    
    for (int i = 0; i < 6; i++)
        output.printf("%02x", gseAddress.getMacAddress()[i]);
    
    output.println(");");
    
    output.println("}");
}

Generated result:

// Without physical address
GC(gcbEvents events Events3 2 0 1000 3000 );

// With physical address 
GC(gcbEvents events Events3 2 0 1000 3000 ){
PA(4 1 4096 010ccd010001);
}

However, in config_file_parser.c, the variable indentation is set to 4 after parsing lines starting with "GC", which only handles GSEControls with a physical address. This causes the parser to fail when encountering a GSEControl without a physical address.
Same for SampledValueControl.

config_file_parser.c code

else if (StringUtils_startsWith((char*) lineBuffer, "GC")) {
    uint32_t confRef;
    int fixedOffs;
    int minTime = -1;
    int maxTime = -1;

    int matchedItems = sscanf((char*) lineBuffer, "GC(%129s %129s %129s %u %i %i %i)",
            nameString, nameString2, nameString3, &confRef, &fixedOffs, &minTime, &maxTime);

    if (matchedItems < 5) goto exit_error;

    currentGoCB = GSEControlBlock_create(nameString, currentLN, nameString2,
            nameString3, confRef, fixedOffs, minTime, maxTime);

     indendation = 4;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant