joulescope_driver 0.0.0 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,39 +1,39 @@
1
- /*
2
- * Copyright 2024 Jetperch LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- #ifndef JOULESCOPE_DRIVER_NODE_H
18
- #define JOULESCOPE_DRIVER_NODE_H
19
-
20
- #include <napi.h>
21
- #include "jsdrv.h"
22
-
23
- class JoulescopeDriver : public Napi::ObjectWrap<JoulescopeDriver> {
24
- public:
25
- static Napi::Object Init(Napi::Env env, Napi::Object exports);
26
- JoulescopeDriver(const Napi::CallbackInfo& info);
27
-
28
- private:
29
- Napi::Value publish(const Napi::CallbackInfo& info);
30
- Napi::Value query(const Napi::CallbackInfo& info);
31
- Napi::Value subscribe(const Napi::CallbackInfo& info);
32
- Napi::Value unsubscribe(const Napi::CallbackInfo& info);
33
- Napi::Value unsubscribe_all(const Napi::CallbackInfo& info);
34
- Napi::Value finalize(const Napi::CallbackInfo& info);
35
-
36
- struct jsdrv_context_s * context_;
37
- };
38
-
39
- #endif // JOULESCOPE_DRIVER_NODE_H
1
+ /*
2
+ * Copyright 2024 Jetperch LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ #ifndef JOULESCOPE_DRIVER_NODE_H
18
+ #define JOULESCOPE_DRIVER_NODE_H
19
+
20
+ #include <napi.h>
21
+ #include "jsdrv.h"
22
+
23
+ class JoulescopeDriver : public Napi::ObjectWrap<JoulescopeDriver> {
24
+ public:
25
+ static Napi::Object Init(Napi::Env env, Napi::Object exports);
26
+ JoulescopeDriver(const Napi::CallbackInfo& info);
27
+
28
+ private:
29
+ Napi::Value publish(const Napi::CallbackInfo& info);
30
+ Napi::Value query(const Napi::CallbackInfo& info);
31
+ Napi::Value subscribe(const Napi::CallbackInfo& info);
32
+ Napi::Value unsubscribe(const Napi::CallbackInfo& info);
33
+ Napi::Value unsubscribe_all(const Napi::CallbackInfo& info);
34
+ Napi::Value finalize(const Napi::CallbackInfo& info);
35
+
36
+ struct jsdrv_context_s * context_;
37
+ };
38
+
39
+ #endif // JOULESCOPE_DRIVER_NODE_H
@@ -1,31 +1,31 @@
1
- /*
2
- * Copyright 2024 Jetperch LLC
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- const JoulescopeDriver = require("..");
18
- const assert = require("assert");
19
-
20
- const sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay));
21
-
22
- async function testBasic(){
23
- await sleep(100);
24
- var drv = new JoulescopeDriver();
25
- var device_paths = drv.device_paths();
26
- console.log('device_paths: ' + device_paths);
27
- drv.finalize();
28
- console.log('testBasic passed')
29
- }
30
-
31
- assert.doesNotThrow(async() => {await testBasic()}, undefined, "testBasic threw an exception");
1
+ /*
2
+ * Copyright 2024 Jetperch LLC
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ const JoulescopeDriver = require("..");
18
+ const assert = require("assert");
19
+
20
+ const sleep = (delay) => new Promise((resolve) => setTimeout(resolve, delay));
21
+
22
+ async function testBasic(){
23
+ await sleep(100);
24
+ var drv = new JoulescopeDriver();
25
+ var device_paths = drv.device_paths();
26
+ console.log('device_paths: ' + device_paths);
27
+ drv.finalize();
28
+ console.log('testBasic passed')
29
+ }
30
+
31
+ assert.doesNotThrow(async() => {await testBasic()}, undefined, "testBasic threw an exception");