14
14
* limitations under the License.
15
15
*/
16
16
17
- #ifndef __ABSTRACTMESH_H__
18
- #define __ABSTRACTMESH_H__
17
+ #ifndef THREADINTERFACE_H
18
+ #define THREADINTERFACE_H
19
19
20
- #include " mbed.h"
21
- #include " mesh_interface_types.h"
22
-
23
- /* *
24
- * \brief Abstract Mesh networking interface.
25
- * This class can't be instantiated directly.
26
- */
27
- class AbstractMesh
28
- {
20
+ #include " NanostackInterface.h"
29
21
22
+ class ThreadInterface : public MeshInterfaceNanostack {
30
23
public:
31
24
32
- /* *
33
- * Typedef for network callback
25
+ /* * Create an uninitialized LoWPANNDInterface
26
+ *
27
+ * Must initialize to initialize the mesh on a phy.
34
28
*/
35
- typedef FunctionPointerArg1< void , mesh_connection_status_t > mesh_network_handler_t ;
29
+ ThreadInterface () : MeshInterfaceNanostack() {
36
30
37
- /* *
38
- * Constructor
39
- * \param type mesh network type
31
+ }
32
+
33
+ /* * Create an initialized MeshInterface
34
+ *
40
35
*/
41
- AbstractMesh ( mesh_network_type_t type);
36
+ ThreadInterface (NanostackRfPhy *phy) : MeshInterfaceNanostack(phy) {
42
37
43
- // Destructor, force derived classes to implement own destructors
44
- // and prevent class creation.
45
- virtual ~AbstractMesh () = 0 ;
38
+ }
46
39
47
- /* *
40
+ int connect ();
41
+ int disconnect ();
42
+ private:
43
+ /*
48
44
* \brief Initialization of the interface.
49
- * \param registered device is physical device registered
50
- * \param callbackHandler is callback that is called when network state changes
51
45
* \return MESH_ERROR_NONE on success.
52
46
* \return MESH_ERROR_PARAM when input parameters are illegal (also in case when RF device is already associated to other interface)
53
47
* \return MESH_ERROR_MEMORY in case of memory error
54
48
* \return MESH_ERROR_UNKNOWN in other error cases
55
49
*/
56
- virtual mesh_error_t init (int8_t registered_device_id, mesh_network_handler_t callbackHandler);
57
-
50
+ mesh_error_t init ();
58
51
/* *
59
52
* \brief Connect interface to the mesh network
60
53
* \return MESH_ERROR_NONE on success.
@@ -63,20 +56,14 @@ class AbstractMesh
63
56
* \return MESH_ERROR_STATE if interface is already connected to network.
64
57
* \return MESH_ERROR_UNKNOWN in case of unspecified error.
65
58
* */
66
- virtual mesh_error_t connect ();
59
+ mesh_error_t mesh_connect ();
67
60
68
61
/* *
69
62
* \brief Disconnect interface from the mesh network
70
63
* \return MESH_ERROR_NONE on success.
71
64
* \return MESH_ERROR_UNKNOWN in case of error.
72
65
* */
73
- virtual mesh_error_t disconnect ();
74
-
75
- /* *
76
- * \brief Callback from C-layer
77
- * \param state state of the network
78
- * */
79
- void callback (mesh_connection_status_t state);
66
+ mesh_error_t mesh_disconnect ();
80
67
81
68
/* *
82
69
* \brief Read own global IP address
@@ -85,29 +72,7 @@ class AbstractMesh
85
72
* \param len is the length of the address buffer, must be at least 40 bytes
86
73
* \return true if address is read successfully, false otherwise
87
74
*/
88
- virtual bool getOwnIpAddress (char *address, int8_t len) = 0;
89
-
90
- protected:
91
-
92
- /*
93
- * Mesh callback function
94
- */
95
- mesh_network_handler_t _mesh_network_handler;
96
-
97
- /*
98
- * Network interface ID
99
- */
100
- int8_t _network_interface_id;
101
-
102
- /*
103
- * Registered device ID
104
- */
105
- int8_t _device_id;
106
-
107
- /*
108
- * Mesh network type
109
- */
110
- mesh_network_type_t _mesh_network_type;
75
+ bool getOwnIpAddress (char *address, int8_t len);
111
76
};
112
77
113
- #endif /* __ABSTRACTMESH_H__ */
78
+ #endif // THREADINTERFACE_H
0 commit comments