[Tinyos-contrib-commits]
CVS: tinyos-1.x/contrib/ptII/ptinyos/tos/platform/ptII
Nido.nc, 1.5, 1.6 external_comm.c, 1.6, 1.7 nido.h, 1.3,
1.4 ptII.c, 1.9, 1.10
Elaine Cheong
celaine at users.sourceforge.net
Sat Dec 9 02:17:24 PST 2006
Update of /cvsroot/tinyos/tinyos-1.x/contrib/ptII/ptinyos/tos/platform/ptII
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv7973/tos/platform/ptII
Modified Files:
Nido.nc external_comm.c nido.h ptII.c
Log Message:
Implemented JNI exception handling for all functions except socket calls.
Fixed "Time for mote" mote ID # to print properly.
Added more comments to files.
Index: Nido.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/ptII/ptinyos/tos/platform/ptII/Nido.nc,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Nido.nc 10 Nov 2006 03:36:28 -0000 1.5
--- Nido.nc 9 Dec 2006 10:17:21 -0000 1.6
***************
*** 336,340 ****
// Viptos: We assume that there is only one node per TOSSIM.
//dbg_clear(DBG_SIM|DBG_USR3, "SIM: Time for mote %lli initialized to %lli.\n",
! dbg_clear(DBG_SIM|DBG_USR3, "SIM: Time for mote %lli initialized to %lli.\n",
// i, tos_state.node_state[i].time);
_PTII_NODEID, tos_state.node_state[i].time);
--- 336,340 ----
// Viptos: We assume that there is only one node per TOSSIM.
//dbg_clear(DBG_SIM|DBG_USR3, "SIM: Time for mote %lli initialized to %lli.\n",
! dbg_clear(DBG_SIM|DBG_USR3, "SIM: Time for mote %i initialized to %lli.\n",
// i, tos_state.node_state[i].time);
_PTII_NODEID, tos_state.node_state[i].time);
Index: external_comm.c
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/ptII/ptinyos/tos/platform/ptII/external_comm.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** external_comm.c 13 Jul 2006 07:03:14 -0000 1.6
--- external_comm.c 9 Dec 2006 10:17:21 -0000 1.7
***************
*** 311,319 ****
dbg_clear(DBG_SIM|DBG_ERROR, "SIM: Closed event server socket.\n");
! if (ptII_joinThreads() == 0) {
dbg_clear(DBG_SIM|DBG_ERROR, "SIM: Joined commandReadThread.\n");
dbg_clear(DBG_SIM|DBG_ERROR, "SIM: Joined eventAcceptThread.\n");
} else {
! dbg_clear(DBG_SIM|DBG_ERROR, "SIM: Could not join commandReadThread or eventAcceptThread.\n");
}
--- 311,319 ----
dbg_clear(DBG_SIM|DBG_ERROR, "SIM: Closed event server socket.\n");
! if (ptII_joinThreads()) {
dbg_clear(DBG_SIM|DBG_ERROR, "SIM: Joined commandReadThread.\n");
dbg_clear(DBG_SIM|DBG_ERROR, "SIM: Joined eventAcceptThread.\n");
} else {
! dbg_clear(DBG_SIM|DBG_ERROR, "SIM: Could not join commandReadThread and/or eventAcceptThread.\n");
}
Index: nido.h
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/ptII/ptinyos/tos/platform/ptII/nido.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** nido.h 1 Feb 2006 07:50:12 -0000 1.3
--- nido.h 9 Dec 2006 10:17:21 -0000 1.4
***************
*** 138,142 ****
void ptII_cleanup();
extern void ptII_updateLeds(int moteID, short red, short green, short yellow);
! extern void ptII_send_packet(void *msg);
// Viptos: Replacing pthread objects with JNI objects.
--- 138,142 ----
void ptII_cleanup();
extern void ptII_updateLeds(int moteID, short red, short green, short yellow);
! extern void ptII_send_packet(TOS_MsgPtr msg);
// Viptos: Replacing pthread objects with JNI objects.
Index: ptII.c
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/ptII/ptinyos/tos/platform/ptII/ptII.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** ptII.c 6 Dec 2006 22:00:58 -0000 1.9
--- ptII.c 9 Dec 2006 10:17:21 -0000 1.10
***************
*** 35,40 ****
#include <jni.h>
! // FIXME
! // from tos/types/AM.h
#ifndef TOSH_DATA_LENGTH
#define TOSH_DATA_LENGTH 29
--- 35,39 ----
#include <jni.h>
! // Begin from tinyos-1.x/contrib/ptII/ptinyos/tos/types/AM.h ==============
[...1212 lines suppressed...]
! jboolean retVal = (*env)->CallBooleanMethod(env, obj, ptII_jmethodID_joinThreads);
! jthrowable throwable = NULL;
! // Check for exception, in case it wasn't properly handled in Java.
! if (throwable = (*env)->ExceptionOccurred(env)) {
! // Print exception and stack trace to system error-reporting
! // channel (e.g., stderr).
! (*env)->ExceptionDescribe(env);
! // Clear exception that is currently being thrown.
! (*env)->ExceptionClear(env);
!
! // Create and thrown our own exception.
! snprintf(ERROR_MESSAGE, sizeof(ERROR_MESSAGE),
! "\nError in %s[%d]: \nCall to loader.joinThreads() generated exception.",
! __FILE__, __LINE__);
! JNU_ThrowByName(env,
! "ptolemy/kernel/util/InternalErrorException", ERROR_MESSAGE);
! }
! return (retVal == JNI_TRUE) ? 1 : 0;
}
More information about the Tinyos-contrib-commits
mailing list