Contiki 2.5
Functions
contiki-cooja-main.c File Reference

    COOJA Contiki mote main file.
More...

#include <jni.h>
#include <stdio.h>
#include <string.h>
#include "contiki.h"
#include "sys/clock.h"
#include "sys/etimer.h"
#include "sys/cooja_mt.h"
#include "sys/autostart.h"
#include "lib/random.h"
#include "lib/simEnvChange.h"
#include "net/rime.h"
#include "net/netstack.h"
#include "dev/serial-line.h"
#include "dev/cooja-radio.h"
#include "dev/button-sensor.h"
#include "dev/pir-sensor.h"
#include "dev/vib-sensor.h"
#include "node-id.h"

Go to the source code of this file.

Functions

JNIEXPORT void JNICALL Java_se_sics_cooja_corecomm_CLASSNAME_init (JNIEnv *env, jobject obj)
 Initialize a mote by starting processes etc. More...
 
JNIEXPORT void JNICALL Java_se_sics_cooja_corecomm_CLASSNAME_getMemory (JNIEnv *env, jobject obj, jint rel_addr, jint length, jbyteArray mem_arr)
 Get a segment from the process memory. More...
 
JNIEXPORT void JNICALL Java_se_sics_cooja_corecomm_CLASSNAME_setMemory (JNIEnv *env, jobject obj, jint rel_addr, jint length, jbyteArray mem_arr)
 Replace a segment of the process memory with given byte array. More...
 
JNIEXPORT void JNICALL Java_se_sics_cooja_corecomm_CLASSNAME_tick (JNIEnv *env, jobject obj)
 Let mote execute one "block" of code (tick mote). More...
 
JNIEXPORT void JNICALL Java_se_sics_cooja_corecomm_CLASSNAME_setReferenceAddress (JNIEnv *env, jobject obj, jint addr)
 Set the relative memory address of the reference variable. More...
 

Detailed Description

    COOJA Contiki mote main file.
Author
Fredrik Osterlind fros@.nosp@m.sics.nosp@m..se

Definition in file contiki-cooja-main.c.

Function Documentation

JNIEXPORT void JNICALL Java_se_sics_cooja_corecomm_CLASSNAME_getMemory ( JNIEnv *  env,
jobject  obj,
jint  rel_addr,
jint  length,
jbyteArray  mem_arr 
)

Get a segment from the process memory.

Parameters
startStart address of segment
lengthSize of memory segment
Returns
Java byte array containing a copy of memory segment.
        Fetches a memory segment from the process memory starting at
        (start), with size (length). This function does not perform
        ANY error checking, and the process may crash if addresses are
        not available/readable.

        This is a JNI function and should only be called via the
        responsible Java part (MoteType.java).

Definition at line 367 of file contiki-cooja-main.c.

JNIEXPORT void JNICALL Java_se_sics_cooja_corecomm_CLASSNAME_init ( JNIEnv *  env,
jobject  obj 
)

Initialize a mote by starting processes etc.

This function initializes a mote by starting certain processes and setting up the environment.

This is a JNI function and should only be called via the responsible Java part (MoteType.java).

Definition at line 345 of file contiki-cooja-main.c.

References NULL.

JNIEXPORT void JNICALL Java_se_sics_cooja_corecomm_CLASSNAME_setMemory ( JNIEnv *  env,
jobject  obj,
jint  rel_addr,
jint  length,
jbyteArray  mem_arr 
)

Replace a segment of the process memory with given byte array.

Parameters
startStart address of segment
lengthSize of memory segment
mem_arrByte array contaning new memory
        Replaces a process memory segment with given byte array.
        This function does not perform ANY error checking, and the
        process may crash if addresses are not available/writable.

        This is a JNI function and should only be called via the
        responsible Java part (MoteType.java).

Definition at line 392 of file contiki-cooja-main.c.

JNIEXPORT void JNICALL Java_se_sics_cooja_corecomm_CLASSNAME_setReferenceAddress ( JNIEnv *  env,
jobject  obj,
jint  addr 
)

Set the relative memory address of the reference variable.

Returns
Relative memory address.
        This is a JNI function and should only be called via the
        responsible Java part (MoteType.java).

Definition at line 474 of file contiki-cooja-main.c.

JNIEXPORT void JNICALL Java_se_sics_cooja_corecomm_CLASSNAME_tick ( JNIEnv *  env,
jobject  obj 
)

Let mote execute one "block" of code (tick mote).

Let mote defined by the active contiki processes and current process memory execute some program code. This code must not block or else this function will never return. A typical contiki process will return when it executes PROCESS_WAIT..() statements.

Before the control is left to contiki processes, any messages from the Java part are handled. These may for example be incoming network data. After the contiki processes return control, messages to the Java part are also handled (those which may need special attention).

This is a JNI function and should only be called via the responsible Java part (MoteType.java).

Definition at line 420 of file contiki-cooja-main.c.

References etimer_next_expiration_time(), etimer_pending(), and etimer_request_poll().