From 0e5d0d242fb6b716b167cb891ab25682e39f173a Mon Sep 17 00:00:00 2001 From: "saerome.kim" Date: Mon, 3 Jul 2017 19:26:45 +0900 Subject: [PATCH] Change some API from public to in-house - remove 'data_rate' parameter at mesh_network_new_with() - change below API to internal . mesh_network_set_data_rate() . mesh_network_get_data_rate() . mesh_cancel_scan() . mesh_set_gate() . mesh_unset_gate() . mesh_get_station_info() . mesh_get_mpath_info() . mesh_set_interface() Signed-off-by: saerome.kim --- include/mesh.h | 213 +------------------------------------------- include/mesh_dbus.h | 1 + src/mesh.c | 5 +- test/common.h | 1 + test/mesh_network.c | 10 ++- 5 files changed, 13 insertions(+), 217 deletions(-) diff --git a/include/mesh.h b/include/mesh.h index 54032b0..e05b5e1 100644 --- a/include/mesh.h +++ b/include/mesh.h @@ -128,21 +128,6 @@ typedef enum { MESH_EVENT_STATION_LEFT = 0x04, /**< This event takes place when existing station left */ } mesh_event_e; -/** - * @brief The HWMP type for mesh_hwmp_root_mode_e - * - * @since_tizen 4.0 - */ -typedef enum { - MESH_HWMP_ROOT_REACTIVE_MODE = 0, /**< Disable Proative Mode */ - MESH_HWMP_ROOT_SIMPLE_PROACTIVE_MODE = 2, /**< Enable the Proactive PREQ with no PREP */ - MESH_HWMP_ROOT_FORCED_PROACTIVE_MODE = 3, /**< Enable the Proactive PREQ with PREP. - Once you do this, all the nodes in your mesh will proactively create paths to your gate. - Mesh nodes will send to gate(s) all traffic to those destinations that could not be resolved in the mesh. */ - MESH_HWMP_ROOT_PROACTIVE_WITH_RANN_MODE = 4, /**< If we use HWMP_ROOTMODE as 4, every 5 sec, - our DUT sends action_frame with root announce. */ -} mesh_hwmp_root_mode_e; - /** * @brief The structure type for the MESH_EVENT_ENABLED callback data. * @details The result of creating or joining mesh network. @@ -282,7 +267,6 @@ int mesh_network_clone(mesh_network_h* dst, mesh_network_h src); * @param[in] bssid The Basic Service Set ID * @param[in] channel The operating channel number * @param[in] rssi The Received Signal Strength Indicator - * @param[in] data_rate The maximum data rate * @param[in] security The security type for network * @param[in] passphrase The passphrase for network connection * @@ -297,8 +281,8 @@ int mesh_network_clone(mesh_network_h* dst, mesh_network_h src); * */ int mesh_network_new_with(mesh_network_h* network, const char *meshid, - const char *bssid, int channel, int rssi, int data_rate, - mesh_security_type_e security, const char *passphrase); + const char *bssid, int channel, int rssi, mesh_security_type_e security, + const char *passphrase); /** * @brief Destroys network handle for network information. @@ -467,42 +451,6 @@ int mesh_network_get_rssi(mesh_network_h network, int *rssi); */ int mesh_network_set_rssi(mesh_network_h network, int rssi); -/** - * @brief Gets the maximum data rate. - * @details This function is to get the maximum data rate - * - * @since_tizen 4.0 - * - * @param[in] network The mesh network information handle. - * @param[out] data_rate The maximum data rate. - * - * @return 0 on success, otherwise a negative error value. - * @retval #MESH_ERROR_NONE Successful - * @retval #MESH_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see mesh_network_set_data_rate() - * - */ -int mesh_network_get_data_rate(mesh_network_h network, int *data_rate); - -/** - * @brief Sets the maximum data rate. - * @details This function is to set the maximum data rate - * - * @since_tizen 4.0 - * - * @param[in] network The mesh network information handle. - * @param[in] data_rate The maximum data rate. - * - * @return 0 on success, otherwise a negative error value. - * @retval #MESH_ERROR_NONE Successful - * @retval #MESH_ERROR_INVALID_PARAMETER Invalid parameter - * - * @see mesh_network_get_data_rate() - * - */ -int mesh_network_set_data_rate(mesh_network_h network, int data_rate); - /** * @brief Gets the security type. * @details This function is to get the security type. @@ -755,27 +703,6 @@ int mesh_scan(mesh_h handle); */ int mesh_specific_scan(mesh_h handle, const char* ssid, int channel); -/** - * @brief Cancel scanning for the mesh network. - * @details Stop scanning process of mesh network. - * - * @since_tizen 4.0 - * - * @param[in] handle The mesh handle - * - * - * @return 0 on success, otherwise a negative error value. - * @retval #MESH_ERROR_NONE Successful - * @retval #MESH_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MESH_ERROR_IO_ERROR Unexpected d-bus error - * - * @see mesh_scan() - * @see mesh_specific_scan() - * @see mesh_scan() - * - */ -int mesh_cancel_scan(mesh_h handle); - /** * @brief Called after mesh_foreach_found_mesh_network() * @details This function can receive scan results from mesh network. @@ -929,51 +856,6 @@ int mesh_is_joined(mesh_h handle, bool* is_joined); */ int mesh_get_joined_network(mesh_h handle, mesh_network_h* network); -/** - * @brief Sets gate options - * @details This function sets mesh gate options. - * - * @since_tizen 4.0 - * - * @param[in] handle The mesh handle - * @param[in] gate_announce Enable / Disable Gate Announce to peers - * @param[in] hwmp_root_mode HWMP (Hybrid Wireless Mesh Protocol) Root Mode \n - * #MESH_HWMP_ROOT_REACTIVE_MODE \n - * #MESH_HWMP_ROOT_SIMPLE_PROACTIVE_MODE \n - * #MESH_HWMP_ROOT_FORCED_PROACTIVE_MODE \n - * #MESH_HWMP_ROOT_PROACTIVE_WITH_RANN_MODE \n - * @param[in] stp Enable / Disable Gate Announce to peers - * - * - * @return 0 on success, otherwise a negative error value. - * @retval #MESH_ERROR_NONE Successful - * @retval #MESH_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MESH_ERROR_IO_ERROR Unexpected d-bus error - * - * @see mesh_unset_gate() - * - */ -int mesh_set_gate(mesh_h handle, int gate_announce, int hwmp_root_mode, bool stp); - -/** - * @brief Unsets gate options - * @details This function unsets mesh gate options. - * - * @since_tizen 4.0 - * - * @param[in] handle The mesh handle - * - * - * @return 0 on success, otherwise a negative error value. - * @retval #MESH_ERROR_NONE Successful - * @retval #MESH_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MESH_ERROR_IO_ERROR Unexpected d-bus error - * - * @see mesh_set_gate() - * - */ -int mesh_unset_gate(mesh_h handle); - /** * @brief Sets softap options * @details This function sets softap options. @@ -1128,98 +1010,7 @@ int mesh_disconnect_mesh_network(mesh_h handle, mesh_network_h network); */ int mesh_forget_mesh_network(mesh_h handle, mesh_network_h network); -/** - * @brief Called after mesh_get_stations_info() - * @details This function can receive joined station information from mesh network. - * - * @since_tizen 4.0 - * - * @param[out] station mesh station information handle - * @param[out] user_data user data pointer - * - * @pre The callback must be registered with mesh_foreach_found_mesh_network() - * - * @see mesh_foreach_found_mesh_network() - */ -typedef void (*mesh_found_station_cb)(mesh_station_info_h station, void* user_data); - -/** - * @brief Get information of all connected stations. - * @details Get information about all stations present in the currently connected mesh network. - * - * @since_tizen 4.0 - * - * @param[in] handle The mesh handle - * @param[in] cb The callback function to receive station information - * @param[in] user_data User data - * - * - * @return 0 on success, otherwise a negative error value. - * @retval #MESH_ERROR_NONE Successful - * @retval #MESH_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MESH_ERROR_IO_ERROR Unexpected d-bus error - * - * @see mesh_get_path_info() - * - */ -int mesh_get_stations_info(mesh_h handle, mesh_found_station_cb cb, void *user_data); - -/** - * @brief Called after mesh_get_stations_info() - * @details This function can receive joined station information from mesh network. - * - * @since_tizen 4.0 - * - * @param[out] path mesh path information handle - * @param[out] user_data user data pointer - * - * @pre The callback must be registered with mesh_foreach_found_mesh_network() - * - * @see mesh_foreach_found_mesh_network() - */ -typedef void (*mesh_found_mpath_cb)(mesh_mpath_info_h path, void* user_data); - -/** - * @brief Get information of all mesh paths. - * @details Get information about all mesh paths present in the currently connected mesh network. - * - * @since_tizen 4.0 - * - * @param[in] handle The mesh handle - * @param[in] cb The callback function to receive mesh path information - * @param[in] user_data User data - * - * - * @return 0 on success, otherwise a negative error value. - * @retval #MESH_ERROR_NONE Successful - * @retval #MESH_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MESH_ERROR_IO_ERROR Unexpected d-bus error - * - * @see mesh_get_stations_info() - * - */ -int mesh_get_mpath_info(mesh_h handle, mesh_found_mpath_cb cb, void *user_data); -/** - * @brief Sets network device interface name. - * @details This function provides the ability to manually select interfaces for advanced users. - * - * @since_tizen 4.0 - * - * @param[in] handle The mesh handle - * @param[in] mesh An interface name for mesh network - * @param[in] gate An interface name for external network - * @param[in] softap An interface name for internal softap - * - * - * @return 0 on success, otherwise a negative error value. - * @retval #MESH_ERROR_NONE Successful - * @retval #MESH_ERROR_INVALID_PARAMETER Invalid parameter - * @retval #MESH_ERROR_IO_ERROR Unexpected d-bus error - * - */ -int mesh_set_interfaces(mesh_h handle, - const char *mesh, const char* gate, const char *softap); /** * @} */ diff --git a/include/mesh_dbus.h b/include/mesh_dbus.h index 0293355..be47a83 100644 --- a/include/mesh_dbus.h +++ b/include/mesh_dbus.h @@ -18,6 +18,7 @@ #define __MESH_DBUS_H__ #include "mesh.h" +#include "mesh_internal.h" #ifdef __cplusplus extern "C" { diff --git a/src/mesh.c b/src/mesh.c index 873f4f2..eb19f80 100644 --- a/src/mesh.c +++ b/src/mesh.c @@ -87,8 +87,8 @@ EXPORT_API int mesh_network_clone(mesh_network_h* dst, mesh_network_h src) } EXPORT_API int mesh_network_new_with(mesh_network_h* network, const char *meshid, - const char *bssid, int channel, int rssi, int data_rate, - mesh_security_type_e security, const char *passphrase) + const char *bssid, int channel, int rssi, mesh_security_type_e security, + const char *passphrase) { struct mesh_network_s *net; @@ -108,7 +108,6 @@ EXPORT_API int mesh_network_new_with(mesh_network_h* network, const char *meshid snprintf(net->bssid, MAX_BSSID_LEN, "%s", bssid); net->channel = channel; net->rssi = rssi; - net->data_rate = data_rate; net->security = security; if (passphrase) snprintf(net->passphrase, MAX_PASSPHRASE_LEN, "%s", passphrase); diff --git a/test/common.h b/test/common.h index 0a91e9f..b499a88 100644 --- a/test/common.h +++ b/test/common.h @@ -19,6 +19,7 @@ #define __COMMON_H__ #include +#include __BEGIN_DECLS diff --git a/test/mesh_network.c b/test/mesh_network.c index c8e4c9f..6642624 100644 --- a/test/mesh_network.c +++ b/test/mesh_network.c @@ -58,6 +58,8 @@ static void found_mesh_network_cb(mesh_network_h network, void* user_data) mesh_network_h net = NULL; char *meshid = NULL; char *bssid = NULL; + int rssi; + int data_rate; mesh_security_type_e security; int channel; @@ -72,9 +74,11 @@ static void found_mesh_network_cb(mesh_network_h network, void* user_data) mesh_network_get_meshid(net, &meshid); mesh_network_get_bssid(net, &bssid); mesh_network_get_channel(net, &channel); + mesh_network_get_rssi(net, &rssi); + mesh_network_get_data_rate(net, &data_rate); mesh_network_get_security(net, &security); - msgb(" [%02d] Mesh ID[%-10s] BSSID[%s] Channel[%d] Security[%4s]", - g_scan_net_idx, meshid, bssid, channel, + msgb(" [%02d] Mesh ID[%-10s] BSSID[%s] Channel[%d] RSSI[%ddBm] Date Rate[%dMbps] Security[%4s]", + g_scan_net_idx, meshid, bssid, channel, rssi == 0 ? 0 : rssi-120, data_rate, (MESH_SECURITY_SAE == security) ? "SAE" : "NONE"); g_scan_net_idx++; @@ -437,7 +441,7 @@ static int run_create_network(MManager *mm, struct menu_data *menu) security = ((1 == ret) ? MESH_SECURITY_SAE : MESH_SECURITY_NONE); } - mesh_network_new_with(&net, meshid, NULL, _mesh_channel, 0, 0, + mesh_network_new_with(&net, meshid, NULL, _mesh_channel, 0, security, security == MESH_SECURITY_SAE ? mesh_passphrase : NULL); ret = mesh_create_mesh_network(mesh, net); mesh_network_destroy(net); -- 2.34.1