public interface PtinyOSLoader
The PtinyOSDirector.preinitialize()
method creates a .java file that implements this class and then compiles
the .java file
Modifier and Type | Method and Description |
---|---|
void |
enqueueEvent(java.lang.String newTime)
Enqueue the next TOSSIM event into ptII at the specified time.
|
char |
getCharParameterValue(java.lang.String parameter)
Get a char value from PortParameter named parameter.
|
boolean |
joinThreads()
Join the TOSSIM event accept and TOSSIM command read threads.
|
void |
load(java.lang.String path,
PtinyOSDirector director)
Load the JNI shared object associated with the toplevel
PtinyOSDirector.
|
int |
main(java.lang.String[] argsToMain)
Native method that invokes the main() method in TOSSIM.
|
void |
processEvent(long currentTime)
Native method that calls TOSSIM to process an event at the
current time.
|
void |
receivePacket(long currentTime,
java.lang.String packet)
Native method that calls TOSSIM to receive a packet in TOSSIM.
|
boolean |
sendToPort(java.lang.String portName,
java.lang.String expression)
SSend an expression to a ptII port.
|
void |
startThreads()
Start the TOSSIM event accept and TOSSIM command read threads.
|
void |
tosDebug(java.lang.String debugMode,
java.lang.String message,
java.lang.String nodeID)
Print a debug message in ptII.
|
void |
wrapup()
Native method that calls TOSSIM to shut itself down.
|
void enqueueEvent(java.lang.String newTime)
This is a JNI method that gets called by TOSSIM to enqueue an event.
newTime
- A string representation of the time of the next
event. In TOSSIM, unit of time is a tick of a 4MHz clock, and
time is stored in a long long in C (a 64-bit integer on most
systems).char getCharParameterValue(java.lang.String parameter)
This is a JNI method that gets called by TOSSIM to get a sensor value.
parameter
- The parameter.void load(java.lang.String path, PtinyOSDirector director)
path
- The directory that contains the JNI shared object.director
- The director that loads this PtinyOSLoader.int main(java.lang.String[] argsToMain) throws InternalErrorException
argsToMain
- Arguments to pass to TOSSIM.InternalErrorException
- If thrown in TOSSIM.void processEvent(long currentTime)
currentTime
- The current time.void receivePacket(long currentTime, java.lang.String packet)
currentTime
- The current time.packet
- The string value of the packet to send to TOSSIM.boolean sendToPort(java.lang.String portName, java.lang.String expression)
This is a JNI method that gets called by TOSSIM to send a value to a ptII port.
portName
- The name of the port.expression
- The expression to send to the ptII port.void tosDebug(java.lang.String debugMode, java.lang.String message, java.lang.String nodeID)
This is a JNI method that gets called by TOSSIM to print a debug message in ptII.
debugMode
- A long long in C (currently unused).message
- A char * in C.nodeID
- A short in C.void wrapup()
void startThreads()
boolean joinThreads()