#ifndef _KAMESERIAL
#define _KAMESERIAL


#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <termios.h>
#include <unistd.h>
#include <jni.h>

#include <android/log.h>


#define SERIAL_PORT "/dev/ttyUSB0"
#define BAUD_RATE    B115200

enum eKAMEMOTION {

    HOME_POSITON = 0,

    WALK_TOWARD_2 = 10,
    WALK_TOWARD_4 = 11,
    WALK_TOWARD_8 = 12,
    WALK_TOWARD_16 = 13,
    WALK_TOWARD_32 = 14,

    WALK_BACK_4 = 20,

    TURN_RIGHT_1 = 30,
    TURN_RIGHT_2 = 31,
    TURN_RIGHT_4 = 32,
    TURN_RIGHT_6 = 33,
    TURN_RIGHT_8 = 34,

    TURN_LEFT_1 = 40,
    TURN_LEFT_2 = 41,
    TURN_LEFT_4 = 42,
    TURN_LEFT_6 = 43,
    TURN_LEFT_8 = 44,

};


#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

JNIEXPORT
jint
JNICALL
Java_cc_openframeworks_DroidBot_init(JNIEnv* env,
                                       jobject thiz);

JNIEXPORT
jint
JNICALL
Java_cc_openframeworks_DroidBot_homePosition(JNIEnv* env,
                                               jobject thiz);

JNIEXPORT
jint
JNICALL
Java_cc_openframeworks_DroidBot_walkToward2(JNIEnv* env,
                                              jobject thiz);

JNIEXPORT
jint
JNICALL
Java_cc_openframeworks_DroidBot_walkToward4(JNIEnv* env,
                                              jobject thiz);

JNIEXPORT
jint
JNICALL
Java_cc_openframeworks_DroidBot_walkToward8(JNIEnv* env,
                                              jobject thiz);

JNIEXPORT
jint
JNICALL
Java_cc_openframeworks_DroidBot_walkToward16(JNIEnv* env,
                                               jobject thiz);

JNIEXPORT
jint
JNICALL
Java_cc_openframeworks_DroidBot_walkToward32(JNIEnv* env,
                                               jobject thiz);

JNIEXPORT
jint
JNICALL
Java_cc_openframeworks_DroidBot_walkBack4(JNIEnv* env,
                                            jobject thiz);


JNIEXPORT
jint
JNICALL
Java_cc_openframeworks_DroidBot_turnRight1(JNIEnv* env,
                                             jobject thiz);

JNIEXPORT
jint
JNICALL
Java_cc_openframeworks_DroidBot_turnRight2(JNIEnv* env,
                                             jobject thiz);

JNIEXPORT
jint
JNICALL
Java_cc_openframeworks_DroidBot_turnRight4(JNIEnv* env,
                                             jobject thiz);

JNIEXPORT
jint
JNICALL
Java_cc_openframeworks_DroidBot_turnRight6(JNIEnv* env,
                                             jobject thiz);

JNIEXPORT
jint
JNICALL
Java_cc_openframeworks_DroidBot_turnRight8(JNIEnv* env,
                                             jobject thiz);


JNIEXPORT
jint
JNICALL
Java_cc_openframeworks_DroidBot_turnLeft1(JNIEnv* env,
                                            jobject thiz);

JNIEXPORT
jint
JNICALL
Java_cc_openframeworks_DroidBot_turnLeft2(JNIEnv* env,
                                            jobject thiz);


JNIEXPORT
jint
JNICALL
Java_cc_openframeworks_DroidBot_turnLeft4(JNIEnv* env,
                                            jobject thiz);

JNIEXPORT
jint
JNICALL
Java_cc_openframeworks_DroidBot_turnLeft6(JNIEnv* env,
                                            jobject thiz);

JNIEXPORT
jint
JNICALL
Java_cc_openframeworks_DroidBot_turnLeft8(JNIEnv* env,
                                            jobject thiz);


    extern int check_switch();
    extern int init_robot();
    extern int do_scenario(enum eKAMEMOTION motion);
#ifdef __cplusplus
}
#endif /* __cplusplus */


#endif
