본문 바로가기

카테고리 없음

iotivitiy OCF Client & Server 빌드 명령어

반응형


https://wiki.iotivity.org/iotivity_cloud_-_programming_guide

https://wiki.iotivity.org/build_iotivity_with_ubuntu_build_machine


sudo apt-get update

sudo apt-get install scons

sudo apt-get install ssh build-essential g++ git-core doxygen valgrind

sudo apt-get install libglib2.0-dev unzip uuid-dev python-dev autotools-dev libicu-dev libbz2-dev

sudo apt-get install libboost-all-dev libboost-program-options-dev libboost-thread-dev uuid-dev libssl-dev libtool libglib2.0-dev libsqlite3-dev

  sudo apt-get install libcurl4-openssl-dev
*   sudo ldconfig

sudo apt-get install libjson-glib-dev

sudo apt-get install json-glib-1.0

sudo apt-get install sqlite3 libsqlite3-dev


>sudo apt-get install libboost-all-dev


> scons WITH_TCP=yes TARGET_TRANSPORT=IP WITH_CLOUD=yes WITH_MQ=PUB,SUB SECURED=0

https://www.howtoforge.com/tutorial/install-mongodb-on-ubuntu-16.04/

https://devops.profitbricks.com/tutorials/install-and-configure-apache-kafka-on-ubuntu-1604-1/

sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock

git clone https://github.com/01org/tinycbor.git extlibs/tinycbor/tinycbor -b v0.4.1

git clone https://github.com/ARMmbed/mbedtls.git extlibs/mbedtls/mbedtls -b mbedtls-2.4.0

 

Iotivity OCF reference server 빌드

https://wiki.iotivity.org/iotivity_api_test_guide?s[]=cloud



sudo apt-get install libboost-dev libboost-program-options-dev libexpat1-dev libboost-thread-dev uuid-dev libssl-dev scons libglib2.0-dev

sudo apt-get install
json-glib-1.0 libjson-glib-dev

sudo apt-get install sqlite3 libsqlite3-dev

sudo apt-get install autoconf libtool



scons cloud WITH_TCP=yes RELEASE=yes TARGET_TRANSPORT=IP BUILD_SAMPLE=OFF WITH_CLOUD=yes SECURED=0


./bin/zookeeper-server-start.sh config/zookeeper.properties
./bin/kafka-server-start.sh config/ocf-server.properties



1. https://wiki.iotivity.org/build_iotivity_with_ubuntu_build_machine
2. eclipse code formatter : https://wiki.iotivity.org/iotivity_coding_standards


Account Server 
  go to "target" folder
    $ java -jar CloudAccount-0.0.1-SNAPSHOT.jar arg1(AccountServer CoAP Server Port) arg2(MongoDB IP Address) arg3(MongoDB Port) arg4(TLS mode required)
    e.g. java -jar CloudAccount-0.0.1-SNAPSHOT.jar 5685 127.0.0.1 27017 0

        - If you want to operate on TLS mode, "CLOUD_CERT_FILE(iotivitycloud.crt)" and "CLOUD_KEY_FILE(iotivitycloud.key)" files
          should be placed in the "target" folder.

        - If you want to provide a certificate of another server in the payload of a sign-up response (when the certificate is needed for a client to connect to the server), a "ROOT_CERT_FILE(rootca.crt)" file should be placed in the "target" folder.

    - Before you run a Accout server, You need to set up following steps.
          1) Install MongoDB
          2) Install Github certificates for github.com and *.github.com.


Please download: file from http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html: Java Cryptography Extension
         1.Extract files from zip.
         2.Place local_policy.jar and US_export_policy.jar files in/usr/lib/jvm/PATH_TO_JDK/jre/lib/security


Cloud Interface

java -jar CloudInterface-0.0.1-SNAPSHOT.jar

arg1(CI CoAP Server Port) arg2(RD CoAP Server IP) arg3(RD CoAP Server Port) arg4(Account Server IP) arg5(Account Server Port) arg6(MQBroker IP) arg7(MQBroker Port) arg8(CI Http-CoAP proxy server port, '0' if unnecessary) arg9(CI CoAP websocket server port, '0' if unnecessary) arg10(TLS mode <0|1> required) arg11(web log IP, optional) and arg12(web log port, optional)

e.g. java -jar CloudInterface-0.0.1-SNAPSHOT.jar 5683 127.0.0.1 5684 127.0.0.1 5685 127.0.0.1 5686 80 8080 0


    - Before running a CI server, you should run a RD server, Account server and MQBroker first.
    - If you want to operate on TLS mode, "CLOUD_CERT_FILE(iotivitycloud.crt)", "CLOUD_KEY_FILE(iotivitycloud.key)" and ROOT_CERT_FILE(rootca.crt) files should be placed in the "target" folder.


Resource Directory

$ java -jar CloudResourceDirectory-0.0.1-SNAPSHOT.jar arg1(RD CoAP Server Port) arg2(MongoDB IP Address) arg3(MongoDB Port) arg4(TLS mode required)

java -jar CloudResourceDirectory-0.0.1-SNAPSHOT.jar 5684 127.0.0.1 27017 0

- If you want to operate on TLS mode, "CLOUD_CERT_FILE(iotivitycloud.crt)", "CLOUD_KEY_FILE(iotivitycloud.key)" and ROOT_CERT_FILE(rootca.crt) files should be placed in the "target" folder.





 == controlle log ==

    In Server Airconditioner entity handler:
        requestFlag : Request
            requestType : GET
            query params:
                if:oic.if.ll
    In Server Binaryswitch entity handler:
        requestFlag : Request
            requestType : GET
            query params:
        requestFlag : Observer
    In Server Binaryswitch entity handler:
        requestFlag : Request
            requestType : POST
                value: 1
            query params:
                if:oic.if.baseline
                rt:oic.r.switch.binary
    In Server Binaryswitch entity handler:
        requestFlag : Request
            requestType : POST
                value: 0
            query params:
                if:oic.if.baseline
                rt:oic.r.switch.binary
1
    In Server Binaryswitch entity handler:
        requestFlag : Request
            requestType : POST
                value: 0
            query params:
                if:oic.if.baseline
                rt:oic.r.switch.binary






    In Server Binaryswitch entity handler:
        requestFlag : Request
            requestType : POST
                value: 1
            query params:
                if:oic.if.baseline
                rt:oic.r.switch.binary

0
                value: 0
1
                value: 1
    In Server Binaryswitch entity handler:
        requestFlag : Request
            requestType : GET
            query params:
        requestFlag : Observer
q


==controller log==

    uid:    d44beec4-17f5-4752-8804-40ae9662b1ec
Login/out response received code: 4
    expiresin:    -1
Finding airconditioner  result: 0
Found device called!
Device found: /oic/route/31efea90-7e37-c7c5-1d70-a66639beeaa2/oic/d
DI: 31efea90-7e37-c7c5-1d70-a66639beeaa2
RT: oic.wk.d
RT: oic.d.airconditioner
PUT 1/0 to turn on/off air conditioner, q to terminate
Airconditioner found
Aircondition resource found: /oic/route/31efea90-7e37-c7c5-1d70-a66639beeaa2/oic/d
RT: oic.wk.d
RT: oic.d.airconditioner
Aircondition resource found: /oic/route/31efea90-7e37-c7c5-1d70-a66639beeaa2/oic/p
RT: oic.wk.p
Aircondition resource found: /oic/route/31efea90-7e37-c7c5-1d70-a66639beeaa2/aircon/0
RT: x.org.iotivity.ac
Found Airconditioner
Aircondition resource found: /oic/route/31efea90-7e37-c7c5-1d70-a66639beeaa2/firmware
RT: x.org.iotivity.firmware
Observe registration action is successful
OBSERVE RESULT:
    prslist:    [OC::OCRepresentation ]
    di:    31efea90-7e37-c7c5-1d70-a66639beeaa2
    state:    on
Resource get: 0
URI: /oic/route/31efea90-7e37-c7c5-1d70-a66639beeaa2/aircon/0
RT: x.org.iotivity.ac
URI: /oic/route/31efea90-7e37-c7c5-1d70-a66639beeaa2/power/0
RT: oic.r.switch.binary
value : true
URI: /oic/route/31efea90-7e37-c7c5-1d70-a66639beeaa2/temperature/0
RT: oic.r.temperature
range :
temperature : 0
units :
Constructing binary switch
RT: oic.r.switch.binary
Observing /oic/route/31efea90-7e37-c7c5-1d70-a66639beeaa2/power/0
RT: oic.r.temperature
Observe registration action is successful
OBSERVE RESULT:
    value:    true
1
OBSERVE RESULT:
    value:    true
POST response: 4
    value:    true
0
OBSERVE RESULT:
    value:    false
POST response: 4
    value:    false
f
Firmware update not found
0
OBSERVE RESULT:
    value:    false
POST response: 4
    value:    false
1
OBSERVE RESULT:
    value:    true
POST response: 4
    value:    true





OBSERVE RESULT:
    value:    false
OBSERVE RESULT:
    value:    true
q



반응형