]> granicus.if.org Git - esp-idf/commitdiff
ble_mesh: reorganize ble mesh model files
authorlly <lly@espressif.com>
Mon, 2 Sep 2019 03:41:39 +0000 (11:41 +0800)
committerlly <lly@espressif.com>
Mon, 9 Sep 2019 09:15:16 +0000 (17:15 +0800)
19 files changed:
components/bt/CMakeLists.txt
components/bt/component.mk
components/bt/esp_ble_mesh/btc/btc_ble_mesh_prov.c
components/bt/esp_ble_mesh/mesh_core/include/cfg_cli.h
components/bt/esp_ble_mesh/mesh_core/include/health_cli.h
components/bt/esp_ble_mesh/mesh_core/transport.c
components/bt/esp_ble_mesh/mesh_models/client/client_common.c [moved from components/bt/esp_ble_mesh/mesh_models/model_common.c with 95% similarity]
components/bt/esp_ble_mesh/mesh_models/client/generic_client.c [moved from components/bt/esp_ble_mesh/mesh_models/generic_client.c with 100% similarity]
components/bt/esp_ble_mesh/mesh_models/client/include/client_common.h [moved from components/bt/esp_ble_mesh/mesh_models/include/model_common.h with 93% similarity]
components/bt/esp_ble_mesh/mesh_models/client/include/generic_client.h [moved from components/bt/esp_ble_mesh/mesh_models/include/generic_client.h with 99% similarity]
components/bt/esp_ble_mesh/mesh_models/client/include/lighting_client.h [moved from components/bt/esp_ble_mesh/mesh_models/include/lighting_client.h with 99% similarity]
components/bt/esp_ble_mesh/mesh_models/client/include/sensor_client.h [moved from components/bt/esp_ble_mesh/mesh_models/include/sensor_client.h with 99% similarity]
components/bt/esp_ble_mesh/mesh_models/client/include/time_scene_client.h [moved from components/bt/esp_ble_mesh/mesh_models/include/time_scene_client.h with 99% similarity]
components/bt/esp_ble_mesh/mesh_models/client/lighting_client.c [moved from components/bt/esp_ble_mesh/mesh_models/lighting_client.c with 100% similarity]
components/bt/esp_ble_mesh/mesh_models/client/sensor_client.c [moved from components/bt/esp_ble_mesh/mesh_models/sensor_client.c with 100% similarity]
components/bt/esp_ble_mesh/mesh_models/client/time_scene_client.c [moved from components/bt/esp_ble_mesh/mesh_models/time_scene_client.c with 100% similarity]
components/bt/esp_ble_mesh/mesh_models/common/include/mesh_common.h [moved from components/bt/esp_ble_mesh/mesh_models/include/mesh_common.h with 69% similarity]
components/bt/esp_ble_mesh/mesh_models/common/include/model_opcode.h [moved from components/bt/esp_ble_mesh/mesh_models/include/model_opcode.h with 100% similarity]
components/bt/esp_ble_mesh/mesh_models/common/mesh_common.c [moved from components/bt/esp_ble_mesh/mesh_models/mesh_common.c with 72% similarity]

index 095493c1dd7cefa9751979e9ffd80bedf14aae47..2b8a96363d0819aed7f7981a4138f91fdf31ad7a 100644 (file)
@@ -297,7 +297,8 @@ if(CONFIG_BT_ENABLED)
                     "esp_ble_mesh/mesh_core/include"
                     "esp_ble_mesh/mesh_core/settings"
                     "esp_ble_mesh/btc/include"
-                    "esp_ble_mesh/mesh_models/include"
+                    "esp_ble_mesh/mesh_models/common/include"
+                    "esp_ble_mesh/mesh_models/client/include"
                     "esp_ble_mesh/api/core/include"
                     "esp_ble_mesh/api/models/include"
                     "esp_ble_mesh/api")
@@ -350,12 +351,12 @@ if(CONFIG_BT_ENABLED)
                     "esp_ble_mesh/mesh_core/settings.c"
                     "esp_ble_mesh/mesh_core/test.c"
                     "esp_ble_mesh/mesh_core/transport.c"
-                    "esp_ble_mesh/mesh_models/generic_client.c"
-                    "esp_ble_mesh/mesh_models/lighting_client.c"
-                    "esp_ble_mesh/mesh_models/mesh_common.c"
-                    "esp_ble_mesh/mesh_models/model_common.c"
-                    "esp_ble_mesh/mesh_models/sensor_client.c"
-                    "esp_ble_mesh/mesh_models/time_scene_client.c")
+                    "esp_ble_mesh/mesh_models/common/mesh_common.c"
+                    "esp_ble_mesh/mesh_models/client/client_common.c"
+                    "esp_ble_mesh/mesh_models/client/generic_client.c"
+                    "esp_ble_mesh/mesh_models/client/lighting_client.c"
+                    "esp_ble_mesh/mesh_models/client/sensor_client.c"
+                    "esp_ble_mesh/mesh_models/client/time_scene_client.c")
     endif()
 
     if(CONFIG_BT_NIMBLE_ENABLED)
index 2e7148d22e7099673a53f545e3007830f8a9f766..7fa74dcf03a16552b89de8adb2c29b00cc9dbf03 100644 (file)
@@ -132,19 +132,21 @@ COMPONENT_SRCDIRS += common/osi                                      \
 endif
 
 ifdef CONFIG_BLE_MESH
-    COMPONENT_ADD_INCLUDEDIRS += esp_ble_mesh/mesh_core             \
-                                 esp_ble_mesh/mesh_core/include     \
-                                 esp_ble_mesh/mesh_core/settings    \
-                                 esp_ble_mesh/btc/include           \
-                                 esp_ble_mesh/mesh_models/include   \
-                                 esp_ble_mesh/api/core/include      \
-                                 esp_ble_mesh/api/models/include    \
+    COMPONENT_ADD_INCLUDEDIRS += esp_ble_mesh/mesh_core                     \
+                                 esp_ble_mesh/mesh_core/include             \
+                                 esp_ble_mesh/mesh_core/settings            \
+                                 esp_ble_mesh/btc/include                   \
+                                 esp_ble_mesh/mesh_models/common/include    \
+                                 esp_ble_mesh/mesh_models/client/include    \
+                                 esp_ble_mesh/api/core/include              \
+                                 esp_ble_mesh/api/models/include            \
                                  esp_ble_mesh/api
 
     COMPONENT_SRCDIRS +=    esp_ble_mesh/mesh_core               \
                             esp_ble_mesh/mesh_core/settings      \
                             esp_ble_mesh/btc                     \
-                            esp_ble_mesh/mesh_models             \
+                            esp_ble_mesh/mesh_models/common      \
+                            esp_ble_mesh/mesh_models/client      \
                             esp_ble_mesh/api/core                \
                             esp_ble_mesh/api/models 
 endif
index c825e93907ce2d6adfa8582a8a17e03cdaf5ce95..e1517d6bb363f1844ec52af87d52b59361dd4623 100644 (file)
@@ -44,7 +44,7 @@
 #include "lighting_client.h"
 #include "sensor_client.h"
 #include "time_scene_client.h"
-#include "model_common.h"
+#include "client_common.h"
 
 #include "btc_ble_mesh_prov.h"
 #include "btc_ble_mesh_config_model.h"
index b001d84b8abf89c3f3e4cf8fc9d09297b3ddd90c..8f46a045ad007018a271d61cf82090b01fc50290 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "mesh_access.h"
 #include "mesh_kernel.h"
-#include "model_common.h"
+#include "client_common.h"
 
 /**
  * @brief Bluetooth Mesh
index 9d7230ebac33db2985ac9178489ddc96b1155b64..b1e1b693d0161020a02cddad5ba15f27acc9c7b6 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "mesh_access.h"
 #include "mesh_kernel.h"
-#include "model_common.h"
+#include "client_common.h"
 
 /**
  * @brief Bluetooth Mesh
index a456ebbfc8d8f2b59f6c02786490720b2474b3d0..0902783515597569cbf41bcd1e89a49913bc9da4 100644 (file)
@@ -31,7 +31,7 @@
 #include "settings.h"
 #include "transport.h"
 #include "mesh_common.h"
-#include "model_common.h"
+#include "client_common.h"
 #include "provisioner_main.h"
 
 /* The transport layer needs at least three buffers for itself to avoid
similarity index 95%
rename from components/bt/esp_ble_mesh/mesh_models/model_common.c
rename to components/bt/esp_ble_mesh/mesh_models/client/client_common.c
index cc694082cd9fd9440c43a34ecbd6c6f3af038d84..8802e424cce3844e51766170ab6d52ca7b4891fd 100644 (file)
@@ -23,7 +23,7 @@
 #include "mesh_main.h"
 
 #include "mesh.h"
-#include "model_common.h"
+#include "client_common.h"
 
 bt_mesh_client_node_t *bt_mesh_is_model_message_publish(struct bt_mesh_model *model,
         struct bt_mesh_msg_ctx *ctx,
@@ -316,21 +316,3 @@ int bt_mesh_set_model_role(bt_mesh_role_param_t *common)
     return 0;
 }
 
-u8_t bt_mesh_get_model_role(struct bt_mesh_model *model, bool srv_send)
-{
-    bt_mesh_client_common_t *client = NULL;
-
-    if (srv_send) {
-        BT_DBG("%s, Message is sent by a server model", __func__);
-        return NODE;
-    }
-
-    if (!model || !model->user_data) {
-        BT_ERR("%s, Invalid parameter", __func__);
-        return ROLE_NVAL;
-    }
-
-    client = (bt_mesh_client_common_t *)model->user_data;
-
-    return client->msg_role;
-}
similarity index 93%
rename from components/bt/esp_ble_mesh/mesh_models/include/model_common.h
rename to components/bt/esp_ble_mesh/mesh_models/client/include/client_common.h
index 486cdb769d24339e303966ab6c92c2110847eed2..55d78831d3632e81cb23e3514b86dae6bddf07aa 100644 (file)
@@ -119,15 +119,5 @@ typedef struct bt_mesh_role_param {
  */
 int bt_mesh_set_model_role(bt_mesh_role_param_t *common);
 
-/**
- * @brief This function gets msg role for stack internal use.
- *
- * @param[in] model:    Pointer to the model structure
- * @param[in] srv_send: Indicate if the message is sent by a server model
- *
- * @return 0 - Node, 1 - Provisioner
- */
-u8_t bt_mesh_get_model_role(struct bt_mesh_model *model, bool srv_send);
-
 #endif /* _MODEL_COMMON_H_ */
 
similarity index 99%
rename from components/bt/esp_ble_mesh/mesh_models/include/generic_client.h
rename to components/bt/esp_ble_mesh/mesh_models/client/include/generic_client.h
index e82587d7664dfd89b7c5b27520a9084d011ed569..b3cee9c75663ce5df0a560c14bac607f84cf16e7 100644 (file)
@@ -22,7 +22,7 @@
 #include "mesh_access.h"
 #include "mesh_kernel.h"
 
-#include "model_common.h"
+#include "client_common.h"
 
 /* Generic client model common structure */
 typedef bt_mesh_client_common_t bt_mesh_generic_client_t;
similarity index 99%
rename from components/bt/esp_ble_mesh/mesh_models/include/lighting_client.h
rename to components/bt/esp_ble_mesh/mesh_models/client/include/lighting_client.h
index 9e9789a821fe02f1e17fa8f7965041f46f00d35f..bd2b735a6ef4490e529568173592bfbe7e5a8e83 100644 (file)
@@ -22,7 +22,7 @@
 #include "mesh_access.h"
 #include "mesh_kernel.h"
 
-#include "model_common.h"
+#include "client_common.h"
 
 /* Light client model common structure */
 typedef bt_mesh_client_common_t bt_mesh_light_client_t;
similarity index 99%
rename from components/bt/esp_ble_mesh/mesh_models/include/sensor_client.h
rename to components/bt/esp_ble_mesh/mesh_models/client/include/sensor_client.h
index 095499ef5d84c0a7bee9772e46fcc4dcaff7e84e..14b450513e97c3b3c9007d3d21ec0c82ae3b0de3 100644 (file)
@@ -22,7 +22,7 @@
 #include "mesh_access.h"
 #include "mesh_kernel.h"
 
-#include "model_common.h"
+#include "client_common.h"
 
 /* Sensor Client Model Context */
 extern const struct bt_mesh_model_op sensor_cli_op[];
similarity index 99%
rename from components/bt/esp_ble_mesh/mesh_models/include/time_scene_client.h
rename to components/bt/esp_ble_mesh/mesh_models/client/include/time_scene_client.h
index a37cf878f4bed2aefc666d7bb3afe3e87dee4935..b6c8d18bf075e73808e8d685c42749c77847c509 100644 (file)
@@ -22,7 +22,7 @@
 #include "mesh_access.h"
 #include "mesh_kernel.h"
 
-#include "model_common.h"
+#include "client_common.h"
 
 /* Time scene client model common structure */
 typedef bt_mesh_client_common_t bt_mesh_time_scene_client_t;
similarity index 69%
rename from components/bt/esp_ble_mesh/mesh_models/include/mesh_common.h
rename to components/bt/esp_ble_mesh/mesh_models/common/include/mesh_common.h
index 468cf65afc4b46eeeb5547394e36c8b9d8a2a30e..501450c272ecfa0fe4997fcf0775c3f99cbd7969 100644 (file)
@@ -24,6 +24,7 @@
 #include "mesh_types.h"
 #include "mesh_buf.h"
 #include "mesh_trace.h"
+#include "mesh_access.h"
 
 /**
  * @brief This function allocates memory to store outgoing message.
@@ -43,4 +44,18 @@ struct net_buf_simple *bt_mesh_alloc_buf(u16_t size);
  */
 void bt_mesh_free_buf(struct net_buf_simple *buf);
 
+/**
+ * @brief This function gets device role for stack internal use.
+ * 
+ * @Note  Currently Provisioner only support client models, Node supports
+ *        client models and server models. Hence if srv_send is set to be
+ *        TRUE, then role NODE will be returned.
+ *
+ * @param[in] model:    Pointer to the model structure
+ * @param[in] srv_send: Indicate if the message is sent by a server model
+ *
+ * @return 0 - Node, 1 - Provisioner
+ */
+u8_t bt_mesh_get_model_role(struct bt_mesh_model *model, bool srv_send);
+
 #endif /* _MESH_COMMON_H_ */
\ No newline at end of file
similarity index 72%
rename from components/bt/esp_ble_mesh/mesh_models/mesh_common.c
rename to components/bt/esp_ble_mesh/mesh_models/common/mesh_common.c
index bb4aa6f934ab097caadd46944ea38ca558bf10f7..9e7185d451de9f7de5276760958fdcca7b686294 100644 (file)
@@ -15,6 +15,7 @@
 #include <string.h>
 #include <errno.h>
 
+#include "client_common.h"
 #include "mesh_common.h"
 
 struct net_buf_simple *bt_mesh_alloc_buf(u16_t size)
@@ -44,3 +45,22 @@ void bt_mesh_free_buf(struct net_buf_simple *buf)
         osi_free(buf);
     }
 }
+
+u8_t bt_mesh_get_model_role(struct bt_mesh_model *model, bool srv_send)
+{
+    bt_mesh_client_common_t *client = NULL;
+
+    if (srv_send) {
+        BT_DBG("%s, Message is sent by a server model", __func__);
+        return NODE;
+    }
+
+    if (!model || !model->user_data) {
+        BT_ERR("%s, Invalid parameter", __func__);
+        return ROLE_NVAL;
+    }
+
+    client = (bt_mesh_client_common_t *)model->user_data;
+
+    return client->msg_role;
+}