getAllServiceReferences() for multiple devices
mstocum
Posts: 120
Let's say I have multiple DVD players in one system, 41001 and 41002, and I want to grab a reference to 41002 specifically, is there an easy way to do this? I imagine I could call
Would something like
getAllServiceReferences("com.amx.duet.devicesdk.DiscDevice", null)and iterate over the results, looking for a reference where the DUET_DEVICE property has a device number of 41002, but that seems a bit cumbersome.
Would something like
getAllServiceReferences("com.amx.duet.devicesdk.DiscDevice", "(Duet-Device=41002:*)")work? From the OSGi documentation, it seems it should.
0
Comments
Also, you may want to consider using getServiceReferences(..) as a opposed to getAllServiceReferences(..). This one only returns service references guaranteed to be classloader compatible with your bundle so will protect you against class cast exceptions when you try to start using it.
Do you have an example you can post? No matter what I try, if I specify any filter, I get nothing back. If I pass null for the filter, I get an array of every module of that type, which I can iterate over.