/**
* @ingroup CAPI_NETWORK_THREAD_MODULE
+ * @brief Get the PanId from Operational Network
+ * @since_tizen 7.0
+ *
+ * @param[out] panid The PanId
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #THREAD_ERROR_NONE Successful
+ * @retval #THREAD_ERROR_NOT_INITIALIZED Not initialized
+ * @retval #THREAD_ERROR_OPERATION_FAILED Operation failed
+ * @retval #THREAD_ERROR_NOT_SUPPORTED Not supported
+ *
+ * @pre thread API must be initialized with thread_initialize().
+ * @pre Active Operational Dataset must be set using thread_set_active_dataset_tlvs().
+ *
+ * @see thread_network_create_operational_network()
+ * @see thread_set_active_dataset_tlvs()
+ */
+int thread_network_get_panid(thread_instance_h instance, uint16_t *panid);
+
+/**
+ * @ingroup CAPI_NETWORK_THREAD_MODULE
* @brief Attach the OT hardware to the active Operational Network, which is pre-set
* @since_tizen 7.0
*
return ret;
}
+int thread_network_get_panid(thread_instance_h instance, uint16_t *panid)
+{
+ FUNC_ENTRY;
+ THREAD_CHECK_SUPPORTED_FEATURE(THREAD_FEATURE_COMMON);
+ THREAD_CHECK_INIT_STATUS();
+ THREAD_VALIDATE_INPUT_PARAMETER(instance);
+ THREAD_VALIDATE_INPUT_PARAMETER(panid);
+
+ int ret = THREAD_ERROR_NONE;
+ GVariant *out = NULL;
+
+ /* get "PanId" dbus property */
+ ret = _thread_dbus_get_property(
+ THREAD_DBUS_PROPERTY_PANID, &out);
+ retv_if(ret != THREAD_ERROR_NONE, ret);
+
+ g_variant_get(out, "q", panid);
+ THREAD_DBG("Thread PanId: %u", (size_t)*panid);
+ g_variant_unref(out);
+
+ FUNC_EXIT;
+ return THREAD_ERROR_NONE;
+}
+
static int __thread_attach_active_network()
{
FUNC_ENTRY;