diff --git a/library/api.go b/library/api.go index ded544e6..1831d6a4 100644 --- a/library/api.go +++ b/library/api.go @@ -48,6 +48,13 @@ func waku_stop() *C.char { return C.CString(response) } +//export waku_is_started +// Determine is a node is started or not +func waku_is_started() *C.char { + response := mobile.IsStarted() + return C.CString(response) +} + //export waku_peerid // Obtain the peer ID of the waku node func waku_peerid() *C.char { diff --git a/library/api_store.go b/library/api_store.go index 4880f31a..cd0983a6 100644 --- a/library/api_store.go +++ b/library/api_store.go @@ -14,7 +14,7 @@ import ( // "startTime": 1234, // optional, unix epoch time in nanoseconds // "endTime": 1234, // optional, unix epoch time in nanoseconds // "contentFilters": [ // optional -// "contentTopic1", "contentTopic2" ... +// "contentTopic1", ... // ], // "pagingOptions": {// optional pagination information // "pageSize": 40, // number diff --git a/mobile/api.go b/mobile/api.go index 3cc89ba0..be48fd7d 100644 --- a/mobile/api.go +++ b/mobile/api.go @@ -25,6 +25,7 @@ import ( ) var wakuNode *node.WakuNode +var wakuStarted = false var errWakuNodeNotReady = errors.New("go-waku not initialized") @@ -151,6 +152,8 @@ func Start() string { return makeJSONResponse(err) } + wakuStarted = true + return makeJSONResponse(nil) } @@ -160,11 +163,17 @@ func Stop() string { } wakuNode.Stop() + + wakuStarted = false wakuNode = nil return makeJSONResponse(nil) } +func IsStarted() string { + return prepareJSONResponse(wakuStarted, nil) +} + func PeerID() string { if wakuNode == nil { return makeJSONResponse(errWakuNodeNotReady)