Additional component implementation
PhreaK
Posts: 966
Hey there fellow duet-ers and duet-ettes. I've run into some interesting behavior that's got me stumped.
Normally to extend a base device type to implement additional functionality (adding say the DialerComponent to an AudioConferencer etc) you implement the desired component interface, set up the mapping in components.xml and then SNAPI calls the appropriate methods and everything plays nice. Also, if you want to implement a component multiple times, make sure your class handles it appropriately and map it on the number of ports your require in components.xml. This is all nice, simple and neat... assuming none of the component API's conflict.
Where I'm stuck is say in the case of a combined CD / cassette deck where you'd want to implement both the DiscTransport (or DiscTransport2) and TapeTransport components to handle things neatly and allow both to be operated independently. I was hoping this would be the case of just implementing them then mapping one to port 1 and one to port 2 in components.xml with both given index 1.
Where this fails is that regardless of the index you assign component.getXXComponent(..) is always called with an index equivalent to the port assignment. The fix if you only require a single implementation of the extending component is to ignore the index passed into your getXXComponent(..) method and always return the first component. Surely there must be a less hacky way to do this.
Normally to extend a base device type to implement additional functionality (adding say the DialerComponent to an AudioConferencer etc) you implement the desired component interface, set up the mapping in components.xml and then SNAPI calls the appropriate methods and everything plays nice. Also, if you want to implement a component multiple times, make sure your class handles it appropriately and map it on the number of ports your require in components.xml. This is all nice, simple and neat... assuming none of the component API's conflict.
Where I'm stuck is say in the case of a combined CD / cassette deck where you'd want to implement both the DiscTransport (or DiscTransport2) and TapeTransport components to handle things neatly and allow both to be operated independently. I was hoping this would be the case of just implementing them then mapping one to port 1 and one to port 2 in components.xml with both given index 1.
Where this fails is that regardless of the index you assign component.getXXComponent(..) is always called with an index equivalent to the port assignment. The fix if you only require a single implementation of the extending component is to ignore the index passed into your getXXComponent(..) method and always return the first component. Surely there must be a less hacky way to do this.
0