aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJames Prestwood <james.prestwood@intel.com>2017-03-15 12:37:08 -0700
committerGeoff Gustafson <geoff@linux.intel.com>2017-03-15 12:37:08 -0700
commitfa7b5fccea4bd9a6aa14fb9669a06d6f5b3023c1 (patch)
tree0e1967b4b8886220feb5137eb02f89969872aa54 /src
parent556ac3404ded8217f890cc5e61aff5811b81a840 (diff)
[ocf] Added OCF client documentation (#825)
- Moved setBleAddress() to ocf object Signed-off-by: James Prestwood <james.prestwood@intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/zjs_ocf_ble.c11
-rw-r--r--src/zjs_ocf_ble.h5
-rw-r--r--src/zjs_ocf_common.c4
3 files changed, 12 insertions, 8 deletions
diff --git a/src/zjs_ocf_ble.c b/src/zjs_ocf_ble.c
index 27ee19d..85b9522 100644
--- a/src/zjs_ocf_ble.c
+++ b/src/zjs_ocf_ble.c
@@ -54,10 +54,10 @@ static int str2bt_addr_le(const char *str, const char *type, bt_addr_le_t *addr)
return 0;
}
-static jerry_value_t ocf_set_ble_address(const jerry_value_t function_val,
- const jerry_value_t this,
- const jerry_value_t argv[],
- const jerry_length_t argc)
+jerry_value_t zjs_ocf_set_ble_address(const jerry_value_t function_val,
+ const jerry_value_t this,
+ const jerry_value_t argv[],
+ const jerry_length_t argc)
{
// args: address
ZJS_VALIDATE_ARGS(Z_STRING);
@@ -99,7 +99,4 @@ void zjs_init_ocf_ble()
BT_ADDR_SET_STATIC(&id_addr.a);
bt_storage_register(&storage);
#endif
- jerry_value_t global_obj = jerry_get_global_object();
- zjs_obj_add_function(global_obj, ocf_set_ble_address, "setBleAddress");
- jerry_release_value(global_obj);
}
diff --git a/src/zjs_ocf_ble.h b/src/zjs_ocf_ble.h
index 6aa4418..e36a18e 100644
--- a/src/zjs_ocf_ble.h
+++ b/src/zjs_ocf_ble.h
@@ -9,4 +9,9 @@
void zjs_init_ocf_ble();
+jerry_value_t zjs_ocf_set_ble_address(const jerry_value_t function_val,
+ const jerry_value_t this,
+ const jerry_value_t argv[],
+ const jerry_length_t argc);
+
#endif /* SRC_ZJS_OCF_BLE_H_ */
diff --git a/src/zjs_ocf_common.c b/src/zjs_ocf_common.c
index 9e4f6b7..d039cea 100644
--- a/src/zjs_ocf_common.c
+++ b/src/zjs_ocf_common.c
@@ -475,7 +475,9 @@ jerry_value_t zjs_ocf_init()
zjs_set_property(ocf_object, "server", server);
jerry_release_value(server);
#endif
-
+#ifdef ZJS_CONFIG_BLE_ADDRESS
+ zjs_obj_add_function(ocf_object, zjs_ocf_set_ble_address, "setBleAddress");
+#endif
return ocf_object;
}