and where is you newdevice() method defined? can you show the class and method declaration and implementation?