how to call Context.getDeviceManager().lookupAttributeInteger inside protocol class

Ayman Elarian6 years ago

hello ,

i am trying to get device some configuration to adjust protocol it self as the following for example

if (deviceSession != null) {
 enginekey = Context.getDeviceManager().lookupAttributeInteger(
                        deviceSession.getDeviceId(), "maping.engine", 1, true);
                doorkey = Context.getDeviceManager().lookupAttributeInteger(
                        deviceSession.getDeviceId(), "maping.door", 2, true);
} 

but i get java.nullpointerexception , i believe it's because of Context.getDeviceManager() , any advice or help ?

Anton Tananaev6 years ago

It should be available. Note that it won't be available for unit tests.

Ayman Elarian6 years ago

thats the exact problem i face
its not available for the unit test , any advice to bypass that ?

Anton Tananaev6 years ago

Disable unit tests for this class is the easiest solution.