Hi,
I am working on a adding new messages to the already existing code base.
The android device basically gets updated readings from the sensors on a development board through USB.
The handler for the receiver thread calls an update function to get the new value:
The DEV_ACCL_X is the new message that I am trying to add. According to the LogCat, this message is being received by the app, just before it crashes.
I/EA AOA (30663): Recv Node id=144, CapId= 96, data=233 -- corresponds to the new message.
Any inputs on why the app is crashing and how to rectify will be really helpful. I am an embedded programmer and an amateur in Java.
Thanks in advance!
I am working on a adding new messages to the already existing code base.
The android device basically gets updated readings from the sensors on a development board through USB.
The handler for the receiver thread calls an update function to get the new value:
Code:
public String getValue(int capId) {
String val = "";
int v = values.get(Integer.valueOf(capId));
switch (capId) {
case Node.DEV_TEMP:
val = Double.toString( ((double)v)/100 );
break;
case Node.DEV_LIGHT:
val = Integer.toString(v);
break;
case Node.DEV_BTN:
val = Integer.toString(v);
break;
case Node.DEV_ACCL_X:
val = Integer.toString(v);
break;
}
return val;
}
The DEV_ACCL_X is the new message that I am trying to add. According to the LogCat, this message is being received by the app, just before it crashes.
I/EA AOA (30663): Recv Node id=144, CapId= 96, data=233 -- corresponds to the new message.
Code:
/UsbDeviceManager( 163): entering USB accessory mode: UsbAccessory[mManufacturer=Embedded Artists AB, mModel=AOA Board - Nodes, mDescription=Demo - AOA Nodes, mVersion=1.0, mUri=http://www.embeddedartists.com/_aoa/Demo_AOA_Nodes.apk, mSerial=N/A]
I/ActivityManager( 163): START {flg=0x10000000 cmp=com.android.systemui/.usb.UsbConfirmActivity (has extras)} from pid 163
I/ActivityManager( 163): Displayed com.android.systemui/.usb.UsbConfirmActivity: +71ms
I/ActivityManager( 163): START {act=android.hardware.usb.action.USB_ACCESSORY_ATTACHED flg=0x10000000 cmp=com.embeddedartists.aoa.nodes/.MainActivity (has extras)} from pid 315
I/EA AOA CAN(30663): onResume
I/EA AOA (30663): Receiver.run
I/EA AOA (30663): Recv Node Add: id=144, capLen=7
I/EA AOA (30663): Recv Node id=144, CapId= 16, data=2650
I/ActivityManager( 163): Displayed com.embeddedartists.aoa.nodes/.MainActivity: +97ms
D/OpenGLRenderer( 315): Flushing caches (mode 0)
I/EA AOA (30663): Recv Node id=144, CapId= 32, data=227
I/EA AOA (30663): Recv Node id=144, CapId= 48, data=0
D/OpenGLRenderer( 315): Flushing caches (mode 1)
I/EA AOA (30663): Recv Node id=144, CapId= 32, data=245
I/EA AOA (30663): Recv Node id=144, CapId= 96, data=245
D/AndroidRuntime(30663): Shutting down VM
W/dalvikvm(30663): threadid=1: thread exiting with uncaught exception (group=0x40a471f8)
E/AndroidRuntime(30663): FATAL EXCEPTION: main
E/AndroidRuntime(30663): java.lang.NullPointerException
E/AndroidRuntime(30663): at com.embeddedartists.aoa.nodes.NodeView$1.handleMessage(NodeView.java:171)
E/AndroidRuntime(30663): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(30663): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(30663): at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime(30663): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(30663): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(30663): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime(30663): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime(30663): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 163): Force finishing activity com.embeddedartists.aoa.nodes/.MainActivity
D/dalvikvm( 163): GC_FOR_ALLOC freed 401K, 24% free 12582K/16391K, paused 54ms
W/ActivityManager( 163): Activity pause timeout for ActivityRecord{4134eaf0 com.embeddedartists.aoa.nodes/.MainActivity}
I/EA AOA (30663): Recv Node id=144, CapId= 32, data=222
I/EA AOA (30663): Recv Node id=144, CapId= 96, data=222
I/EA AOA (30663): Recv Node id=144, CapId= 32, data=233
I/EA AOA (30663): Recv Node id=144, CapId= 96, data=233
I/Process (30663): Sending signal. PID: 30663 SIG: 9
W/InputDispatcher( 163): channel '41356ab0 com.embeddedartists.aoa.nodes/com.embeddedartists.aoa.nodes.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x8
E/InputDispatcher( 163): channel '41356ab0 com.embeddedartists.aoa.nodes/com.embeddedartists.aoa.nodes.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!
W/InputDispatcher( 163): Attempted to unregister already unregistered input channel '41356ab0 com.embeddedartists.aoa.nodes/com.embeddedartists.aoa.nodes.MainActivity (server)'
I/ActivityManager( 163): Process com.embeddedartists.aoa.nodes (pid 30663) has died.
I/WindowManager( 163): WIN DEATH: Window{410e8e00 com.embeddedartists.aoa.nodes/com.embeddedartists.aoa.nodes.MainActivity paused=false}
W/ActivityManager( 163): Force removing ActivityRecord{4109b628 com.embeddedartists.aoa.nodes/.MainActivity}: app died, no saved state
I/WindowManager( 163): WIN DEATH: Window{41356ab0 com.embeddedartists.aoa.nodes/com.embeddedartists.aoa.nodes.MainActivity paused=false}
I/WindowManager( 163): WINDOW DIED Window{41356ab0 com.embeddedartists.aoa.nodes/com.embeddedartists.aoa.nodes.MainActivity paused=false}
W/InputManagerService( 163): Got RemoteException sending setActive(false) notification to pid 30663 uid 10012
D/UsbDeviceManager( 163): exited USB accessory mode
D/MtpService(25247): addStorageLocked 65537 /mnt/sdcard
D/MtpService(25247): starting MTP server in MTP mode
D/MtpService(25247): addStorageLocked 65537 /mnt/sdcard
D/dalvikvm( 315): GC_CONCURRENT freed 332K, 58% free 8215K/19271K, paused 6ms+5ms
Any inputs on why the app is crashing and how to rectify will be really helpful. I am an embedded programmer and an amateur in Java.
Thanks in advance!