Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Adding isOn and isRunning methods to java api
Browse files Browse the repository at this point in the history
  • Loading branch information
jfly committed Oct 12, 2014
1 parent 478eeb6 commit cc4afc5
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
android:text=""
/>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout
android:id="@+id/graphArea"
android:layout_width="match_parent"
android:layout_height="match_parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class FSKubeWrapper {

public static native int getTimeMillis();

public static native boolean isOn();

public static native boolean isRunning();

public static native String getLogLevels();

public static native void setLogLevels(String logLevels);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ JNIEXPORT jint JNICALL Java_com_jflei_fskube_FSKubeWrapper_getTimeMillis
return fskube_getState().millis;
}

JNIEXPORT jboolean JNICALL Java_com_jflei_fskube_FSKubeWrapper_isOn
(JNIEnv *env, jclass clz) {
return fskube_getState().on;
}

JNIEXPORT jboolean JNICALL Java_com_jflei_fskube_FSKubeWrapper_isRunning
(JNIEnv *env, jclass clz) {
return fskube_isRunning();
}

JNIEXPORT jstring JNICALL Java_com_jflei_fskube_FSKubeWrapper_getLogLevels
(JNIEnv *env, jclass clz) {
return env->NewStringUTF(getLogLevels());
Expand All @@ -27,4 +37,4 @@ JNIEXPORT void JNICALL Java_com_jflei_fskube_FSKubeWrapper_setLogLevels
const char *cLogLevels = env->GetStringUTFChars(jLogLevels, 0);
setLogLevels(cLogLevels);
env->ReleaseStringUTFChars(jLogLevels, cLogLevels);
}
}
7 changes: 6 additions & 1 deletion src/capi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ class StackmatStateReceiver : public Receiver<StackmatState> {
private:
StackmatState state;
timespec timeLastStateWasReceived;
bool isRunning;

public:
bool receivedSomething;
bool isRunning;

StackmatStateReceiver() {
receivedSomething = false;
Expand Down Expand Up @@ -137,3 +137,8 @@ StackmatState fskube_getState() {
assert(initialized);
return stackmatStateReceiver.getState();
}

bool fskube_isRunning() {
assert(initialized);
return stackmatStateReceiver.isRunning;
}
2 changes: 2 additions & 0 deletions src/capi.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ bool fskube_addSample(double sample);

fskube::StackmatState fskube_getState();

bool fskube_isRunning();

}

#endif // CAPI_H

0 comments on commit cc4afc5

Please sign in to comment.