chg build path to absolute path
authordamon92 <damon92.lee@samsung.com>
Tue, 19 Mar 2019 01:44:56 +0000 (10:44 +0900)
committerdamon92 <damon92.lee@samsung.com>
Tue, 19 Mar 2019 01:44:56 +0000 (10:44 +0900)
src/discoverymgr/build.sh [deleted file]
src/discoverymgr/discoveryOutput.json [new file with mode: 0644]
src/discoverymgr/src/discovery/discovery.go
src/discoverymgr/src/discovery/iotivity
src/discoverymgr/src/main/main.go

diff --git a/src/discoverymgr/build.sh b/src/discoverymgr/build.sh
deleted file mode 100644 (file)
index e3cc662..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-###############################################################################
-# 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"
diff --git a/src/discoverymgr/discoveryOutput.json b/src/discoverymgr/discoveryOutput.json
new file mode 100644 (file)
index 0000000..c82d2dc
--- /dev/null
@@ -0,0 +1,76 @@
+[
+    {
+        "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
index 58f046e..f72627a 100644 (file)
@@ -124,7 +124,6 @@ static OCStackApplicationResult discoverycallback(void *context, OCDoHandle hand
 
     cgo_discoverycallback(clientResponse);
 
-    //keep open callback
     return OC_STACK_KEEP_TRANSACTION;
 }
 
@@ -296,11 +295,17 @@ func newEdgeJSON() *edgeJSON {
        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{}
@@ -443,7 +448,7 @@ func runProcess() {
        }()
 }
 
-//OCStop terminates oCProcess goroutine
+//Stop terminates oCProcess goroutine
 func Stop() {
        isExitedProcess <- true
 }
@@ -490,7 +495,7 @@ func Init2(mode OCMode, serverFlags OCTransportFlags, clientFlags OCTransportFla
        }
 }
 
-//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)
 
@@ -502,15 +507,11 @@ func Start(platformInfo *OCPlatformInfo, deviceInfo *OCDeviceInfo) {
                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) {
index 112103f..2d7a352 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 112103fe0de49481c16e45f3943f096a5343dbd0
+Subproject commit 2d7a35274cb19a48b82edc1357ebe6da1e3e0f01
index b0203cd..e56d4a6 100644 (file)
@@ -35,7 +35,7 @@ func setDeviceInfo() *discovery.OCDeviceInfo {
        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
@@ -55,7 +55,7 @@ func main() {
        /*Multicast*/
        discovery.Discovery(0, "", "")
        /*Unicast*/
-       // discovery.discovery(1,"","10.113.175.92")
+       // discovery.Discovery(1,"","10.113.175.92")
 
        time.Sleep(10000 * time.Millisecond)