+++ /dev/null
-###############################################################################
-# Copyright 2018 Samsung Electronics All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-###############################################################################
-#!/bin/bash
-
-#Should Run in Python2
-
-export GOPATH=$PWD
-
-#when public
-IOTIVITY="iotivity"
-build_script="build_public_ocf.sh"
-#when samsung
-# IOTIVITY = "IoTivity"
-# build_script = "build_samsung_ocf.sh"
-
-build_ocf="sh ./src/discovery/$build_script"
-
-echo -e "\n\033[33m"Check IoTivity Presence"\033[0m"
-dir_name="./src/discovery/$IOTIVITY"
-if test -d $dir_name
-then
-echo -e "\n\033[33m"Already exist IoTivity"\033[0m"
-else
-echo -e "\n\033[33m"Start building of IoTivity"\033[0m"
-eval "$build_ocf"
-fi
-
-echo -e "\n\033[33m"Start building of OCF discovery"\033[0m"
-
-CGO_CFLAGS="-g -O2 -I`echo $(pwd)`/src/discovery/$IOTIVITY/resource/csdk/include -I`echo $(pwd)`/src/discovery/$IOTIVITY/resource/c_common -I`echo $(pwd)`/src/discovery/$IOTIVITY/resource/csdk/stack/include -Wall" \
-CGO_LDFLAGS="-g -O2 -L`echo $(pwd)`/src/discovery/$IOTIVITY/out/linux/x86_64/release -loctbstack -lconnectivity_abstraction" \
-go build -o simplediscovery -a -installsuffix cgo -ldflags '-s' src/main/main.go
-
-echo -e "\n\033[33m"Succeed build of OCF discovery"\033[0m"
-
-export LD_LIBRARY_PATH="`echo $(pwd)`/src/discovery/$IOTIVITY/out/linux/x86_64/release"
--- /dev/null
+[
+ {
+ "Port": 46006,
+ "Endpoint": "192.168.1.37",
+ "Resources": [
+ {
+ "URI": "/oic/d",
+ "Types": [
+ "oic.wk.d",
+ "oic.d.airconditioner"
+ ]
+ },
+ {
+ "URI": "/introspection",
+ "Types": [
+ "oic.wk.introspection"
+ ]
+ },
+ {
+ "URI": "/temperatures/vs/0",
+ "Types": [
+ "x.com.samsung.da.temperatures"
+ ]
+ },
+ {
+ "URI": "/airflow/vs/0",
+ "Types": [
+ "x.com.samsung.da.wind"
+ ]
+ },
+ {
+ "URI": "/power/vs/0",
+ "Types": [
+ "x.com.samsung.da.operation"
+ ]
+ },
+ {
+ "URI": "/temperature/desired/0",
+ "Types": [
+ "oic.r.temperature"
+ ]
+ },
+ {
+ "URI": "/temperature/current/0",
+ "Types": [
+ "oic.r.temperature"
+ ]
+ },
+ {
+ "URI": "/mode/vs/0",
+ "Types": [
+ "x.com.samsung.da.mode"
+ ]
+ }
+ ]
+ },
+ {
+ "Port": 33636,
+ "Endpoint": "192.168.1.37",
+ "Resources": [
+ {
+ "URI": "/oic/d",
+ "Types": [
+ "oic.wk.d",
+ "oic.d.edge"
+ ]
+ },
+ {
+ "URI": "/introspection",
+ "Types": [
+ "oic.wk.introspection"
+ ]
+ }
+ ]
+ }
+]
\ No newline at end of file
cgo_discoverycallback(clientResponse);
- //keep open callback
return OC_STACK_KEEP_TRANSACTION;
}
return ret
}
-type Method int
-
const (
multicastDiscoveryURL = "coap://224.0.1.187:5683/oic/res"
DiscoveryOutputJSON = "discoveryOutput.json"
+ presenceSecond = 30
+)
+
+type DiscoveryType int
+
+const (
+ MULTICAST DiscoveryType = iota
+ UNICAST
)
var mutex = &sync.Mutex{}
}()
}
-//OCStop terminates oCProcess goroutine
+//Stop terminates oCProcess goroutine
func Stop() {
isExitedProcess <- true
}
}
}
-//OCStart do server-client init, set device/platform info, run oCProcess
+//Start do server-client init, set device/platform info, run oCProcess
func Start(platformInfo *OCPlatformInfo, deviceInfo *OCDeviceInfo) {
Init1(2, 0, 0)
deviceInfo = getDefaultDeviceInfo()
}
SetDeviceInfo(deviceInfo)
- runProcess()
-}
-type DiscoveryType int
+ C.OCStartPresence(C.uint32_t(presenceSecond))
-const (
- MULTICAST DiscoveryType = iota
- UNICAST
-)
+ runProcess()
+}
//Discovery discovers resources via multicast/unicast
func Discovery(discoveryType DiscoveryType, query string, ips ...string) {
-Subproject commit 112103fe0de49481c16e45f3943f096a5343dbd0
+Subproject commit 2d7a35274cb19a48b82edc1357ebe6da1e3e0f01
specVersion := "core.1.1.0"
dataModelVersions := "res.1.1.0,sh.1.1.0"
deviceName := "myDeviceName"
- types := "oic.d.tv,oic.d.edge"
+ types := "oic.d.edge"
deviceInfo.DeviceName = deviceName
deviceInfo.SpecVersion = specVersion
/*Multicast*/
discovery.Discovery(0, "", "")
/*Unicast*/
- // discovery.discovery(1,"","10.113.175.92")
+ // discovery.Discovery(1,"","10.113.175.92")
time.Sleep(10000 * time.Millisecond)