GENIVI / AudioManager

The GENIVI Audiomanager
https://genivi.github.io/AudioManager
Other
25 stars 19 forks source link

problem about default alsa.xml in PluginRoutingAdapterAlsa #37

Open chengyi opened 6 years ago

chengyi commented 6 years ago

In default alsa.xml, the gateway's source (sink) is not visible, but in the code:

 if ((info.srcClsNam.length() != 0) && (source.visible == true))
 {
        peekSourceClassID(info.srcClsNam, source.sourceClassID);
 }

when the source is visible, then it has source class id which must be used in registering source.

how to fix this?

make the gateway source visible or modify source code?

JensLorenz commented 6 years ago

Short answer - the controller need to register a source class with ID=1 at database. This represent either the BASE source as configured in {{alsa.xml}} or you use this for all the hidden sources (and sinks) as kind of "DUMMY" class. The function to register classes is IAmControlReceive::enterSourceClassDB and ::enterSinkClassDB. The ID=1 is predefined in the parser https://github.com/GENIVI/AudioManagerPlugins/blob/master/PluginRoutingAdapterALSA/src/CAmRoutingAdapterALSAParser.cpp#L89.

REASON: Gateways and its sources and sinks shall be not published to applications. Applications are only interested in connecting MainSources to MainSinks - see https://genivi.github.io/AudioManager/views.html. The Gateway pattern is a mechanism to connect different domains together and they are only used inside the route suggestion IAmControlReceive::getRoute and can be important to know by controller too.

CLASS ID Ownership: The classID needs to be known at least at the point were the controller receives the registration request from routing side via IAmControlSend::hookSystemRegisterSource or ::hookSystemRegisterSink and delegates it to the final registration on IAmControlReceive::enterSourceDB and ::enterSinkDB. Hence the gateway elements are not need to be assigned to a classID we skip it simply to save a call e.g. via DBus and in case it is needed to be filled out the controller can do so (Generic Controller does it).

PSS: Watch out, the Send or Receive interface are named from the Daemon point of view!

chengyi commented 6 years ago

@JensLorenz I use GenericController, But it seems can't specify class id in config xml. does it need to modify code?

JensLorenz commented 6 years ago

I checked the code and at the end if feels like an inconsistency between ALSA Routing Adapter and Generic Controller. Currently the controller is not able to register a specific id at all. Even if, there should be a mechanism for the ALSA Routing Adatper to register the classID directly.

Therefore, try to remove the visibility check you provided in the code snippet of ALSA Routing Adapter. This should work. I would love the see a patch than. Thx in advance for your contribution.