COVESA / capicxx-someip-tools

Common API C++ SOMEIP tooling
Mozilla Public License 2.0
76 stars 55 forks source link

Is it possible to have "reliable/TCP" Attribute Changed Event Notifiers? #47

Open Broeserl opened 6 months ago

Broeserl commented 6 months ago

Hi,

I am tinkering around with the someip libs and the code generators, but now I found something I don't understand. Btw. Great work :smile:

When I try to make/set an attribute to reliable with SomeIpReliable = true within the fdepl file, the commonapi-someip-generator seems to not take this into account when generating the files. If I modify manually the generated SomeIPStubAdapter.hpp and the SomeIPProxy.cpp and replace RT_UNRELIABLE with RT_RELIABLE, it works within my tests (checked with Wireshark).

For methods or broadcasts, this works without any changes required.

Now my questions are:

Thanks in advance!

Test.fidl

package test

interface Service {
version { major 1 minor 0 }

enumeration ReturnStatus {
        <** @description: the operation was successfully. **>
        OK = 0,
        <** @description: error occured while handling request. **>
        OPERATION_FAILURE = 1
    }

    method payloadToServiceUnreliable{
        in {
            String message
        }
        out {
            ReturnStatus returnStatus
        }
    }

    method payloadToServiceReliable{
        in {
            String message
        }
        out {
            ReturnStatus returnStatus
        }
    }

    method payloadFromServiceUnreliable{
        out {
            String message
            ReturnStatus returnStatus
        }
    }

    method payloadFromServiceReliable{
        out {
            String message
            ReturnStatus returnStatus
        }
    }

    broadcast broadcastUnreliable {
        out {
            String message
        }
    }

    broadcast broadcastReliable {
        out {
            String message
        }
    }

    attribute String notifierUnreliable readonly

    attribute String notifierReliable readonly
}

Test.fdepl

import "platform:/plugin/org.genivi.commonapi.someip/deployment/CommonAPI-4-SOMEIP_deployment_spec.fdepl"
import "../fidl/Test.fidl"

define org.genivi.commonapi.someip.deployment for interface test.Service{

    SomeIpServiceID=1234

    method payloadToServiceUnreliable {
        SomeIpMethodID = 1
    }

    method payloadToServiceReliable {
        SomeIpReliable = true
        SomeIpMethodID = 2
    }

    method payloadFromServiceUnreliable {
        SomeIpMethodID = 3
    }

    method payloadFromServiceReliable {
        SomeIpReliable = true
        SomeIpMethodID = 4
    }

    broadcast broadcastUnreliable {
        SomeIpEventID = 56787
        SomeIpEventGroups = { 1858 }
    }

    broadcast broadcastReliable {
        SomeIpEventID = 56788
        SomeIpReliable = true
        SomeIpEventGroups = { 1859 }
    }

    attribute notifierUnreliable {
        SomeIpNotifierID = 56789
        SomeIpGetterID = 5678
        SomeIpNotifierEventGroups = { 1860 }
    }

    attribute notifierReliable {
        SomeIpNotifierID = 56790
        SomeIpGetterID = 5679
        SomeIpNotifierEventGroups = { 1861 }
        SomeIpReliable = true
    }

}

define org.genivi.commonapi.someip.deployment for provider as Service {
    instance test.Service {
        InstanceId = "test.Service"
        SomeIpInstanceID = 4567
    }
}
Broeserl commented 6 months ago

I found it myself, after some additional searching in the code.

Deployment.java

        // host 'attributes'
        public Boolean getSomeIpAttributeReliable(FAttribute obj) {
            return target.getBoolean(obj, "SomeIpAttributeReliable");
        }

So if one wants to have an attribute reliable the config parameter is SomeIpAttributeReliable = true instead of SomeIpReliable = true

imho, it is worth mentioning that this is quite hard to find. Maybe it would be an idea to document this somehow/somewhere.