Commit ab8b3481 authored by George Nash's avatar George Nash Committed by Rick Bell

Move oc_endpoint.h into its own interface file

Change-Id: Idc2a5410719d7268223a4cd207ee69bec82e7e9e
Signed-off-by: George Nash's avatarGeorge Nash <george.nash@intel.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/29434Reviewed-by: Larry Sachs's avatarLarry Sachs <larry.j.sachs@intel.com>
Tested-by: default avatarIoTivity Jenkins <jenkins-daemon@iotivity.org>
Reviewed-by: default avatarRick Bell <richard.s.bell@intel.com>
parent 3d18dff6
......@@ -170,6 +170,10 @@ ${OBJDIR}/swig/oc_collection_wrap.o: ${SWIG_DIR}/oc_collection_wrap.c
@mkdir -p ${@D}
${CC} -c -o $@ $< ${CFLAGS} -I../ -DOC_CLIENT -DOC_SERVER
${OBJDIR}/swig/oc_endpoint_wrap.o: ${SWIG_DIR}/oc_endpoint_wrap.c
@mkdir -p ${@D}
${CC} -c -o $@ $< ${CFLAGS} -I../ -DOC_CLIENT -DOC_SERVER
${OBJDIR}/swig/oc_rep_wrap.o: ${SWIG_DIR}/oc_rep_wrap.c
@mkdir -p ${@D}
${CC} -c -o $@ $< ${CFLAGS} -I../ -DOC_CLIENT -DOC_SERVER
......
......@@ -174,6 +174,7 @@
<ClCompile Include="..\..\..\..\swig\java_lang\oc_api_wrap.c" />
<ClCompile Include="..\..\..\..\swig\java_lang\oc_clock_wrap.c" />
<ClCompile Include="..\..\..\..\swig\java_lang\oc_collection_wrap.c" />
<ClCompile Include="..\..\..\..\swig\java_lang\oc_endpoint_wrap.c" />
<ClCompile Include="..\..\..\..\swig\java_lang\oc_obt_wrap.c" />
<ClCompile Include="..\..\..\..\swig\java_lang\oc_rep_wrap.c" />
<ClCompile Include="..\..\..\..\swig\java_lang\oc_storage_wrap.c" />
......
......@@ -5,6 +5,7 @@ import java.util.Arrays;
import org.iotivity.OCDiscoveryHandler;
import org.iotivity.OCDiscoveryFlags;
import org.iotivity.OCEndpoint;
import org.iotivity.OCEndpointUtil;
import org.iotivity.OCInterfaceMask;
import org.iotivity.OCMain;
import org.iotivity.OCQos;
......@@ -98,7 +99,7 @@ public class MyDiscoveryHandler implements OCDiscoveryHandler {
OCEndpoint ep = endpoint;
while (ep != null) {
String[] endpointStr = new String[1];
OCMain.endpointToString(ep, endpointStr);
OCEndpointUtil.toString(ep, endpointStr);
System.out.println("\t\tendpoint: " + endpointStr[0]);
System.out.println("\t\t\tendpoint.device " + ep.getDevice());
System.out.println("\t\t\tendpoint.flags " + ep.getFlags());
......
package java_onboarding_tool;
import org.iotivity.OCEndpoint;
import org.iotivity.OCEndpointUtil;
import org.iotivity.OCMain;
import org.iotivity.OCObtDiscoveryHandler;
import org.iotivity.OCUuidUtil;
......@@ -14,7 +15,7 @@ public class OwnedDeviceHandler implements OCObtDiscoveryHandler {
System.out.println("\nDiscovered owned device: "+ deviceId + " at:");
while (endpoints != null) {
String[] endpointStr = new String[1];
OCMain.endpointToString(endpoints, endpointStr);
OCEndpointUtil.toString(endpoints, endpointStr);
System.out.println(endpointStr[0]);
endpoints = endpoints.getNext();
}
......
package java_onboarding_tool;
import org.iotivity.OCEndpoint;
import org.iotivity.OCEndpointUtil;
import org.iotivity.OCMain;
import org.iotivity.OCObtDiscoveryHandler;
import org.iotivity.OCUuidUtil;
......@@ -14,7 +15,7 @@ public class UnownedDeviceHandler implements OCObtDiscoveryHandler {
System.out.println("\nDiscovered unowned device: "+ deviceId + " at:");
while (endpoints != null) {
String[] endpointStr = new String[1];
OCMain.endpointToString(endpoints, endpointStr);
OCEndpointUtil.toString(endpoints, endpointStr);
System.out.println(endpointStr[0]);
endpoints = endpoints.getNext();
}
......
......@@ -17,6 +17,8 @@ gcc -c -fPIC -fno-asynchronous-unwind-tables -fno-omit-frame-pointer -ffreestand
gcc -c -fPIC -fno-asynchronous-unwind-tables -fno-omit-frame-pointer -ffreestanding -Os -fno-stack-protector -ffunction-sections -fdata-sections -fno-reorder-functions -fno-defer-pop -fno-strict-overflow -I"$JAVA_HOME/include/" -I"$JAVA_HOME/include/linux/" -I../.. -I../../include/ -I../../port/ -I../../port/linux/ -I../../util/ -I../../deps/tinycbor/src/ -Wall -Wextra -Werror -pedantic -D__OC_RANDOM -DOC_CLIENT -DOC_SERVER -DOC_IPV4 -DOC_DYNAMIC_ALLOCATION -DOC_DEBUG -DOC_SECURITY -g -O0 -Wno-unused-parameter -Wno-strict-aliasing -Wno-unused-function -Wno-sign-compare -Wno-address oc_obt_wrap.c -o ./obj/oc_obt_wrap.o
gcc -c -fPIC -fno-asynchronous-unwind-tables -fno-omit-frame-pointer -ffreestanding -Os -fno-stack-protector -ffunction-sections -fdata-sections -fno-reorder-functions -fno-defer-pop -fno-strict-overflow -I"$JAVA_HOME/include/" -I"$JAVA_HOME/include/linux/" -I../.. -I../../include/ -I../../port/ -I../../port/linux/ -I../../util/ -I../../deps/tinycbor/src/ -Wall -Wextra -Werror -pedantic -D__OC_RANDOM -DOC_CLIENT -DOC_SERVER -DOC_IPV4 -DOC_DYNAMIC_ALLOCATION -DOC_DEBUG -DOC_SECURITY -g -O0 -Wno-unused-parameter -Wno-strict-aliasing -Wno-unused-function -Wno-unused-variable -Wno-sign-compare -Wno-address oc_endpoint_wrap.c -o ./obj/oc_endpoint_wrap.o
gcc -c -fPIC -fno-asynchronous-unwind-tables -fno-omit-frame-pointer -ffreestanding -Os -fno-stack-protector -ffunction-sections -fdata-sections -fno-reorder-functions -fno-defer-pop -fno-strict-overflow -I"$JAVA_HOME/include/" -I"$JAVA_HOME/include/linux/" -I../.. -I../../include/ -I../../port/ -I../../port/linux/ -I../../util/ -I../../deps/tinycbor/src/ -Wall -Wextra -Werror -pedantic -D__OC_RANDOM -DOC_CLIENT -DOC_SERVER -DOC_IPV4 -DOC_DYNAMIC_ALLOCATION -DOC_DEBUG -DOC_SECURITY -g -O0 -Wno-unused-parameter -Wno-strict-aliasing -Wno-unused-function -Wno-unused-variable -Wno-sign-compare -Wno-address oc_rep_wrap.c -o ./obj/oc_rep_wrap.o
gcc -c -fPIC -fno-asynchronous-unwind-tables -fno-omit-frame-pointer -ffreestanding -Os -fno-stack-protector -ffunction-sections -fdata-sections -fno-reorder-functions -fno-defer-pop -fno-strict-overflow -I"$JAVA_HOME/include/" -I"$JAVA_HOME/include/linux/" -I../.. -I../../include/ -I../../port/ -I../../port/linux/ -I../../util/ -I../../deps/tinycbor/src/ -Wall -Wextra -Werror -pedantic -D__OC_RANDOM -DOC_CLIENT -DOC_SERVER -DOC_IPV4 -DOC_DYNAMIC_ALLOCATION -DOC_DEBUG -DOC_SECURITY -g -O0 -Wno-unused-parameter -Wno-strict-aliasing -Wno-unused-function -Wno-sign-compare -Wno-address -Wno-unused-variable oc_uuid_wrap.c -o ./obj/oc_uuid_wrap.o
......
......@@ -11,6 +11,8 @@ swig -java -package org.iotivity -outcurrentdir -outdir ../iotivity-lite-java/sr
swig -java -package org.iotivity -outcurrentdir -outdir ../iotivity-lite-java/src/org/iotivity/ -I../../include/ ../swig_interfaces/oc_collection.i
swig -java -package org.iotivity -outcurrentdir -outdir ../iotivity-lite-java/src/org/iotivity/ -I../../include/ ../swig_interfaces/oc_endpoint.i
swig -java -package org.iotivity -outcurrentdir -outdir ../iotivity-lite-java/src/org/iotivity/ -I../../include/ ../swig_interfaces/oc_rep.i
if [ "$#" -ge 1 ] && [ "$1" = "linux" ]
......
......@@ -108,7 +108,7 @@ public class OcUtils {
public static String endpointToString(OCEndpoint endpoint) {
String[] endpointString = new String[1];
OCMain.endpointToString(endpoint, endpointString);
OCEndpointUtil.toString(endpoint, endpointString);
return endpointString[0];
}
......
......@@ -10,6 +10,7 @@
%include "oc_ri.i"
%import "oc_collection.i"
%import "oc_clock.i"
%import "oc_endpoint.i"
%import "oc_rep.i"
%import "oc_uuid.i"
......@@ -1243,37 +1244,14 @@ void jni_oc_remove_delayed_callback(jobject callback) {
%}
%include "oc_api.h"
/*******************Begin oc_endpoint.h*********************/
%rename(OCEndpoint) oc_endpoint_t;
// transport flags are pulled from hand generated class as `int` not `enum`
%ignore transport_flags;
//%rename (OCTransportFlags) transport_flags;
%rename(DevAddr) dev_addr;
//if uncommented the following apply lines will cause the output to be byte[] vs short[]
//%apply signed char[ANY] { uint8_t address[4] };
//%apply signed char[ANY] { uint8_t address[16] };
%rename(OCIPv6Addr) oc_ipv6_addr_t;
%rename(OCIPv4Addr) oc_ipv4_addr_t;
%rename(OCLEAddr) oc_le_addr_t;
%rename(addrLocal) addr_local;
%rename(OCFVersion) ocf_version_t;
%rename(interfaceIndex) interface_index;
// look into exposing oc_make_ipv4_endpoint and oc_make_ipv6_endpoint
%rename(newEndpoint) oc_new_endpoint;
%rename(freeEndpoint) oc_free_endpoint;
%rename(endpointSetDi) oc_endpoint_set_di;
%apply oc_string_t *OUTPUT { oc_string_t *endpointStrOut };
%rename(endpointToString) oc_endpoint_to_string;
int oc_endpoint_to_string(oc_endpoint_t *endpoint, oc_string_t *endpointStrOut);
%apply oc_string_t *INPUT { oc_string_t *endpoint_str };
%apply oc_string_t *OUTPUT { oc_string_t *uri };
%rename(stringToEndpoint) oc_string_to_endpoint;
%rename(ipv6EndpointIsLinkLocal) oc_ipv6_endpoint_is_link_local;
%rename(endpointCompare) oc_endpoint_compare;
%rename(endpointCompareAddress) oc_endpoint_compare_address;
%include "oc_endpoint.h"
/*******************End oc_endpoint.h***********************/
/*******************Begin oc_client_state.h*****************/
/*
* NOTE: currently We only expose callbacks and enum types from oc_client_state.h
* This is why we are not currently using an independent swig interface file. It
* would just create an empty Java class. If any functions are exposed this should
* be moved to its own interface file. (i.e. oc_ri_alloc_client_cb,
* oc_ri_get_client_cb, etc.)
*/
/* TODO check if any of these ignored functions and data types are needed */
%rename(OCQos) oc_qos_t;
%rename(OCClientResponse) oc_client_response_t;
......
/* File oc_endpoint.i */
%module OCEndpointUtil
%include "iotivity.swg"
%pragma(java) jniclasscode=%{
static {
try {
System.loadLibrary("iotivity-lite-jni");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. \n" + e);
System.exit(1);
}
}
%}
%{
#include "oc_endpoint.h"
%}
/*******************Begin oc_endpoint.h*********************/
%rename(OCEndpoint) oc_endpoint_t;
// transport flags are pulled from hand generated class as `int` not `enum`
%ignore transport_flags;
//%rename (OCTransportFlags) transport_flags;
%rename(DevAddr) dev_addr;
//if uncommented the following apply lines will cause the output to be byte[] vs short[]
//%apply signed char[ANY] { uint8_t address[4] };
//%apply signed char[ANY] { uint8_t address[16] };
%rename(OCIPv6Addr) oc_ipv6_addr_t;
%rename(OCIPv4Addr) oc_ipv4_addr_t;
%rename(OCLEAddr) oc_le_addr_t;
%rename(addrLocal) addr_local;
%rename(OCFVersion) ocf_version_t;
%rename(interfaceIndex) interface_index;
// look into exposing oc_make_ipv4_endpoint and oc_make_ipv6_endpoint
%rename(newEndpoint) oc_new_endpoint;
%rename(freeEndpoint) oc_free_endpoint;
%rename(setDi) oc_endpoint_set_di;
%apply oc_string_t *OUTPUT { oc_string_t *endpointStrOut };
%rename(toString) oc_endpoint_to_string;
int oc_endpoint_to_string(oc_endpoint_t *endpoint, oc_string_t *endpointStrOut);
%apply oc_string_t *INPUT { oc_string_t *endpoint_str };
%apply oc_string_t *OUTPUT { oc_string_t *uri };
%rename(stringToEndpoint) oc_string_to_endpoint;
%rename(ipv6EndpointIsLinkLocal) oc_ipv6_endpoint_is_link_local;
%rename(compare) oc_endpoint_compare;
%rename(compareAddress) oc_endpoint_compare_address;
%include "oc_endpoint.h"
/*******************End oc_endpoint.h***********************/
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment