oc_endpoint.i 1.99 KB
Newer Older
1 2 3
/* File oc_endpoint.i */
%module OCEndpointUtil

George Nash's avatar
George Nash committed
4 5
%include "stdint.i"
%include "arrays_java.i"
6 7
%include "iotivity.swg"

George Nash's avatar
George Nash committed
8 9
%import "oc_uuid.i"

10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
%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;
George Nash's avatar
George Nash committed
27 28
// must use the oc_endpoint_set_di function to set di.
%immutable oc_endpoint_t::di;
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
// 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;
George Nash's avatar
George Nash committed
46
/* TODO check the to_string function output */
47 48 49 50 51
%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 };
George Nash's avatar
George Nash committed
52
/* TODO check the string_to_endpoint function output */
53 54 55 56 57 58
%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***********************/