Skip to content
This repository was archived by the owner on Apr 24, 2019. It is now read-only.

Separating coap code from mbed-client-c #119

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions .cproject
Original file line number Diff line number Diff line change
Expand Up @@ -217,21 +217,6 @@
<storageModule moduleId="org.eclipse.cdt.internal.ui.text.commentOwnerProjectMappings"/>
<storageModule moduleId="org.eclipse.cdt.make.core.buildtargets">
<buildTargets>
<target name="libCoap" path="libCoap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>true</runAllBuilders>
</target>
<target name="clean" path="libCoap" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<buildArguments/>
<buildTarget>clean</buildTarget>
<stopOnError>true</stopOnError>
<useDefaultCommand>true</useDefaultCommand>
<runAllBuilders>false</runAllBuilders>
</target>
<target name="coap-server" path="coap-server" targetID="org.eclipse.cdt.build.MakeTargetBuilder">
<buildCommand>make</buildCommand>
<stopOnError>true</stopOnError>
Expand Down
10 changes: 2 additions & 8 deletions .settings/language.settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser" keep-relative-paths="false" name="CDT GCC Build Output Parser" parameter="(.*gcc)|([gc]\+\+)|(clang)|(ArmCC)" prefer-non-shared="true" resource-scope="per-project" store-entries-with-project="true">
<language id="org.eclipse.cdt.core.gcc">
<resource project-relative-path="">
<entry kind="includePath" name="/${ProjName}/libNsdl/src/include">
<flag value="VALUE_WORKSPACE_PATH"/>
</entry>
<entry kind="includePath" name="/${ProjName}/libCoap/src/include">
<entry kind="includePath" name="/${ProjName}/source/include">
<flag value="VALUE_WORKSPACE_PATH"/>
</entry>
<entry kind="includePath" name="/libService/include">
Expand Down Expand Up @@ -97,10 +94,7 @@
</entry>
</resource>
<resource project-relative-path="">
<entry kind="includePath" name="/${ProjName}/libNsdl/src/include">
<flag value="VALUE_WORKSPACE_PATH"/>
</entry>
<entry kind="includePath" name="/${ProjName}/libCoap/src/include">
<entry kind="includePath" name="/${ProjName}/source/include">
<flag value="VALUE_WORKSPACE_PATH"/>
</entry>
<entry kind="includePath" name="/libService/include">
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ override CFLAGS += -Isource/libCoap/src/include/
SERVLIB_DIR := ../libService
override CFLAGS += -I$(SERVLIB_DIR)/libService
override CFLAGS += -Insdl-c/
override CFLAGS += -I../mbed-coap/
override CFLAGS += -I../mbed-coap/source/include/

include ../libService/toolchain_rules.mk

Expand Down
9 changes: 3 additions & 6 deletions module.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
{
"name": "mbed-client-c",
"version": "4.0.0",
"description": "Nanostack NSDL and COAP library",
"description": "Nanostack NSDL library",
"keywords": [
"coap",
"nanostack"
],
"license": "Apache-2.0",
"extraIncludes": [
"nsdl-c",
"source/libNsdl/src/include",
"source/libCoap/src/include"
"source/include"
],
"dependencies": {
"nanostack-libservice": "^3.0.0",
"mbed-trace": ">=0.2.0,<2.0.0",
"nanostack-randlib": "^1.2.0"
"mbed-coap": "^4.0.0"
},
"targetDependencies": {}
}
57 changes: 1 addition & 56 deletions nsdl-c/sn_nsdl.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,62 +33,7 @@ extern "C" {
#define SN_NSDL_SUCCESS 0
#define SN_NSDL_FAILURE (-1)

/* * * * * * * * * * * * * * */
/* * * * ENUMERATIONS * * * */
/* * * * * * * * * * * * * * */


/**
* \brief Used protocol
*/
typedef enum sn_nsdl_capab_ {
SN_NSDL_PROTOCOL_HTTP = 0x01, /**< Unsupported */
SN_NSDL_PROTOCOL_HTTPS = 0x02, /**< Unsupported */
SN_NSDL_PROTOCOL_COAP = 0x04 /**< Supported */
} sn_nsdl_capab_e;

/**
* \brief Address type of given address
*/
typedef enum sn_nsdl_addr_type_ {
SN_NSDL_ADDRESS_TYPE_IPV6 = 0x01, /**< Supported */
SN_NSDL_ADDRESS_TYPE_IPV4 = 0x02, /**< Supported */
SN_NSDL_ADDRESS_TYPE_HOSTNAME = 0x03, /**< Unsupported */
SN_NSDL_ADDRESS_TYPE_NONE = 0xFF
} sn_nsdl_addr_type_e;


#define SN_NDSL_RESOURCE_NOT_REGISTERED 0
#define SN_NDSL_RESOURCE_REGISTERING 1
#define SN_NDSL_RESOURCE_REGISTERED 2


/* * * * * * * * * * * * * */
/* * * * STRUCTURES * * * */
/* * * * * * * * * * * * * */

/**
* \brief Address structure of Packet data
*/
typedef struct sn_nsdl_addr_ {
uint8_t addr_len;
sn_nsdl_addr_type_e type;
uint16_t port;
uint8_t *addr_ptr;
} sn_nsdl_addr_s;

/**
* \brief Used for creating manually registration message with sn_coap_register()
*/
typedef struct registration_info_ {
uint8_t endpoint_len;
uint8_t endpoint_type_len;
uint16_t links_len;

uint8_t *endpoint_ptr; /**< Endpoint name */
uint8_t *endpoint_type_ptr; /**< Endpoint type */
uint8_t *links_ptr; /**< Resource registration string */
} registration_info_t;
#include "mbed-coap/sn_coap_header.h"

#endif /* SN_NSDL_H_ */

Expand Down
6 changes: 3 additions & 3 deletions source/libNsdl/src/sn_grs.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
#include "ns_list.h"
#include "ns_types.h"
#include "sn_nsdl.h"
#include "sn_coap_header.h"
#include "sn_coap_protocol.h"
#include "sn_coap_protocol_internal.h"
#include "mbed-coap/sn_coap_header.h"
#include "mbed-coap/sn_coap_protocol.h"
#include "source/include/sn_coap_protocol_internal.h"
#include "sn_nsdl_lib.h"
#include "sn_grs.h"
#include "mbed-trace/mbed_trace.h"
Expand Down
10 changes: 5 additions & 5 deletions source/libNsdl/src/sn_nsdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@

#include "ns_types.h"
#include "sn_nsdl.h"
#include "sn_coap_header.h"
#include "sn_coap_protocol.h"
#include "sn_coap_protocol_internal.h"
#include "mbed-coap/sn_coap_header.h"
#include "mbed-coap/sn_coap_protocol.h"
#include "source/include/sn_coap_protocol_internal.h"
#include "sn_nsdl_lib.h"
#include "sn_grs.h"
#include "sn_config.h"
#include "mbed-coap/sn_config.h"
#include "mbed-trace/mbed_trace.h"

#define TRACE_GROUP "coap"
Expand Down Expand Up @@ -155,7 +155,7 @@ int8_t sn_nsdl_destroy(struct nsdl_s *handle)
handle->sn_nsdl_free(handle->oma_bs_address_ptr);
}

/* Destroy also libCoap and grs part of libNsdl */
/* Destroy also libmbedcoap and grs part of libNsdl */
sn_coap_protocol_destroy(handle->grs->coap);
sn_grs_destroy(handle->grs);
handle->sn_nsdl_free(handle);
Expand Down
3 changes: 3 additions & 0 deletions test/nsdl-c/unittest/makefile_defines.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ INCLUDE_DIRS =\
../../../../yotta_modules/nanostack-libservice/mbed-client-libservice\
../../../../yotta_modules/mbed-trace\
../../../../yotta_modules/nanostack-randlib/mbed-client-randlib\
../../../../yotta_modules/mbed-coap\
../../../../yotta_modules/mbed-coap/mbed-coap\
../../../../yotta_modules/mbed-coap/source/include\
../../../../../libService/libService\
../../../../source/libCoap/src/include\
../../../../source/libNsdl/src/include\
Expand Down