initial import(release):plugin 07/187407/6
authorjohnny nam <johnny@dignsys.com>
Thu, 23 Aug 2018 02:41:00 +0000 (11:41 +0900)
committerscott park <scott.park@dignsys.com>
Wed, 12 Sep 2018 15:46:57 +0000 (00:46 +0900)
Change-Id: I9c999748859c8dcc865a12137be949908f4277cc
Signed-off-by: scott park <scott.park@dignsys.com>
18 files changed:
plugin/catalog.json [new file with mode: 0644]
plugin/device-profile.json [new file with mode: 0644]
plugin/manifest/ui.json [new file with mode: 0644]
plugin/plugin/css/fonts.css [new file with mode: 0644]
plugin/plugin/css/sensor-soundLevel.css [new file with mode: 0644]
plugin/plugin/css/style.css [new file with mode: 0644]
plugin/plugin/icon.png [new file with mode: 0644]
plugin/plugin/index.html [new file with mode: 0644]
plugin/plugin/js/capability_illuminanceMeasurement.js [new file with mode: 0644]
plugin/plugin/js/capability_switch.js [new file with mode: 0644]
plugin/plugin/js/index-o.js [new file with mode: 0644]
plugin/plugin/js/index.js [new file with mode: 0644]
plugin/plugin/manifest.xml [new file with mode: 0644]
plugin/plugin/res/bar-icon.png [new file with mode: 0644]
plugin/plugin/res/board_ic_arrow_left.png [new file with mode: 0644]
plugin/plugin/res/ic_power.svg [new file with mode: 0644]
plugin/plugin/res/option_ic_more.svg [new file with mode: 0644]
plugin/plugin/res/spk-icon.png [new file with mode: 0644]

diff --git a/plugin/catalog.json b/plugin/catalog.json
new file mode 100644 (file)
index 0000000..4b79902
--- /dev/null
@@ -0,0 +1,21 @@
+{
+  "items": [
+    {
+      "name": "soundLevelChecker",
+      "appType": "setupApp",
+      "versions": [
+        {
+          "appData": {
+            "setupAppData": {
+              "type": "ocf",
+              "ocf": {
+                "mnId": "",
+                "setupId": "001"
+              }
+            }
+          }
+        }
+      ]
+    }
+  ]
+}
diff --git a/plugin/device-profile.json b/plugin/device-profile.json
new file mode 100644 (file)
index 0000000..2ee3a01
--- /dev/null
@@ -0,0 +1,21 @@
+{
+  "name": "soundLevelChecker",
+  "components": [
+    {
+      "id": "main",
+      "capabilities": [
+        {
+          "id": "illuminanceMeasurement"
+        },
+        {
+          "id": "switch"
+        }
+      ]
+    }
+  ],
+  "metadata": {
+    "mnmn": "",
+    "vid": "",
+    "deviceType": ""
+  }
+}
diff --git a/plugin/manifest/ui.json b/plugin/manifest/ui.json
new file mode 100644 (file)
index 0000000..5192ab6
--- /dev/null
@@ -0,0 +1,246 @@
+{
+  "n": "LightSensor",
+  "version": "0.0.1",
+  "vid": "",
+  "mnmn": "",
+  "language": [
+    {
+      "version": "0.0.1",
+      "poCodes": [
+        {
+          "label": "Illuminance",
+          "po": "___PO_CODE_ILLUMINANCEMEASUREMENT_ILLUMINANCE"
+        },
+        {
+          "po": "___PO_CODE_POWERSWITCH_ON",
+          "label": "On"
+        },
+        {
+          "po": "___PO_CODE_POWERSWITCH_OFF",
+          "label": "Off"
+        },
+        {
+          "po": "___PO_CODE_POWERSWITCH",
+          "label": "Power"
+        }
+      ],
+      "locale": "en_US",
+      "mnmn": "",
+      "vid": ""
+    }
+  ],
+  "ma": [
+    {
+      "name": "PowerSwitch",
+      "type": "main",
+      "order": 1,
+      "link": {
+        "href": "/capability/switch/main/0",
+        "if": "oic.if.a",
+        "rt": "x.com.st.powerswitch"
+      },
+      "iconUrl": {
+        "vector": "",
+        "small": "",
+        "large": "",
+        "mid": "icon://ic_function_power_switch"
+      },
+      "property": "power",
+      "controlType": "ToggleSwitch",
+      "alternatives": [
+        {
+          "key": "on",
+          "value": "___PO_CODE_POWERSWITCH_ON"
+        },
+        {
+          "key": "off",
+          "value": "___PO_CODE_POWERSWITCH_OFF",
+          "type": "inactive"
+        }
+      ],
+      "step": 0,
+      "label": {
+        "label": "___PO_CODE_POWERSWITCH"
+      },
+      "emphasis": false
+    }
+  ],
+  "ms": [
+    {
+      "name": "PowerSwitch",
+      "type": "device",
+      "order": 1,
+      "label": {
+        "label": "<var1>",
+        "arguments": [
+          {
+            "n": "var1",
+            "href": "/capability/switch/main/0",
+            "property": "power",
+            "valueType": null,
+            "alternatives": [
+              {
+                "key": "on",
+                "value": "___PO_CODE_POWERSWITCH_ON"
+              },
+              {
+                "key": "off",
+                "value": "___PO_CODE_POWERSWITCH_OFF",
+                "type": "inactive"
+              }
+            ]
+          }
+        ]
+      },
+      "emphasis": false
+    }
+  ],
+  "dpInfo": [
+    {
+      "os": "android",
+      "dpType": "vendorPlugIn",
+      "dpUri": "wwst://soundLevel"
+    },
+    {
+      "os": "ios",
+      "dpType": "vendorPlugIn",
+      "dpUri": "wwst://soundLevel"
+    }
+  ],
+  "dpResources": [
+    {
+      "ruleAction": false,
+      "controllable": false,
+      "link": {
+        "rt": "oic.r.sensor.illuminance",
+        "href": "/capability/illuminanceMeasurement/main/0",
+        "if": "oic.if.r"
+      },
+      "step": 0,
+      "controlType": "List",
+      "name": "Illuminance Measurement",
+      "label": {
+        "label": "___PO_CODE_ILLUMINANCEMEASUREMENT_ILLUMINANCE",
+        "n": "ST Illuminance Measurement"
+      },
+      "emphasis": false,
+      "ruleEvent": false,
+      "iconUrl": {
+        "mid": "icon://ic_function_illuminance_measurement",
+        "large": "",
+        "small": "",
+        "vector": ""
+      },
+      "order": 1,
+      "property": "illuminance"
+    },
+    {
+      "name": "PowerSwitch",
+      "controllable": true,
+      "order": 2,
+      "link": {
+        "href": "/capability/switch/main/0",
+        "if": "oic.if.a",
+        "rt": "x.com.st.powerswitch"
+      },
+      "iconUrl": {
+        "vector": "",
+        "small": "",
+        "large": "",
+        "mid": "icon://ic_function_power_switch"
+      },
+      "property": "power",
+      "controlType": "ToggleSwitch",
+      "alternatives": [
+        {
+          "key": "on",
+          "value": "___PO_CODE_POWERSWITCH_ON"
+        },
+        {
+          "key": "off",
+          "value": "___PO_CODE_POWERSWITCH_OFF",
+          "type": "inactive"
+        }
+      ],
+      "step": 0,
+      "label": {
+        "label": "___PO_CODE_POWERSWITCH"
+      },
+      "emphasis": true,
+      "ruleEvent": false,
+      "ruleAction": true
+    },
+    {
+      "name": "PowerSwitch",
+      "controllable": true,
+      "order": 3,
+      "link": {
+        "href": "/capability/switch/main/0",
+        "if": "oic.if.a",
+        "rt": "x.com.st.powerswitch"
+      },
+      "iconUrl": {
+        "vector": "",
+        "small": "",
+        "large": "",
+        "mid": "icon://ic_function_power_switch"
+      },
+      "property": "power",
+      "controlType": "ToggleSwitch",
+      "alternatives": [
+        {
+          "key": "on",
+          "value": "___PO_CODE_POWERSWITCH_ON"
+        },
+        {
+          "key": "off",
+          "value": "___PO_CODE_POWERSWITCH_OFF",
+          "type": "inactive"
+        }
+      ],
+      "step": 0,
+      "label": {
+        "label": "___PO_CODE_POWERSWITCH"
+      },
+      "emphasis": true,
+      "ruleEvent": false,
+      "ruleAction": false
+    },
+    {
+      "name": "PowerSwitch",
+      "controllable": true,
+      "order": 4,
+      "link": {
+        "href": "/capability/switch/main/0",
+        "if": "oic.if.a",
+        "rt": "x.com.st.powerswitch"
+      },
+      "iconUrl": {
+        "vector": "",
+        "small": "",
+        "large": "",
+        "mid": "icon://ic_function_power_switch"
+      },
+      "property": "power",
+      "controlType": "ToggleSwitch",
+      "alternatives": [
+        {
+          "key": "on",
+          "value": "___PO_CODE_POWERSWITCH_ON"
+        },
+        {
+          "key": "off",
+          "value": "___PO_CODE_POWERSWITCH_OFF",
+          "type": "inactive"
+        }
+      ],
+      "step": 0,
+      "label": {
+        "label": "___PO_CODE_POWERSWITCH"
+      },
+      "emphasis": true,
+      "ruleEvent": true,
+      "ruleAction": false
+    }
+  ]
+}
\ No newline at end of file
diff --git a/plugin/plugin/css/fonts.css b/plugin/plugin/css/fonts.css
new file mode 100644 (file)
index 0000000..dacbf3c
--- /dev/null
@@ -0,0 +1,23 @@
+@CHARSET "UTF-8";
+
+.roboto-regular
+{
+    font-family: 'sec-roboto-light', Fallback, sans-serif;
+}
+
+.roboto-medium
+{
+    font-family: 'sec-roboto-light', Fallback, sans-serif;
+    font-weight: bold;
+}
+
+.roboto-condensed-regular
+{
+    font-family: 'sec-roboto-condensed', Fallback, sans-serif;
+}
+
+.roboto-condensed-bold
+{
+    font-family: 'sec-roboto-condensed', Fallback, sans-serif;
+    font-weight: bold;
+}
diff --git a/plugin/plugin/css/sensor-soundLevel.css b/plugin/plugin/css/sensor-soundLevel.css
new file mode 100644 (file)
index 0000000..3ac6c67
--- /dev/null
@@ -0,0 +1,81 @@
+.measure_container {
+       margin: 20px 0px;
+       text-align: center;
+       padding-top: 10px;
+       width: 285px;
+       margin-left: auto;
+       margin-right: auto; }
+
+.soundLevel_value_wrap {
+       width: 100%;
+//     padding: 10px 0px;
+       height: 60px;
+       display: inline-block;
+       //background-color: #3695dd;
+background-color: transparent;
+       color: white;
+       border: none;
+}
+.soundLevel_value_item {
+       text-align: left;
+       font-size: 42px;
+       color: black;
+}
+
+#sensor_unit {
+       font-size: 24px;
+       text-align: left;
+       vertical-align: medium;
+       line-height: 23px;
+       }
+
+.soundLevel_value {
+       //padding: 6px;
+}
+
+.status-container {
+       margin-top: 7px;
+       padding: 8px 0px;
+}
+
+.level_bar {
+  border-radius: 15px;
+  height: 30px;
+  width: 280px;
+  color: #3695dd;
+  margin: 5px 0px;
+}
+#level_bar5 {background-color: #ff0000; }
+#level_bar4 {background-color: #db007b; }
+#level_bar3 {background-color: #b802cc; }
+#level_bar2 {background-color: #6805ff; }
+#level_bar1 {background-color: #003fff; }
+
+.icon-container { width: 280px; padding: 5px 5px;}
+.icon-class { width: 150px; height: auto; }
+
+span { display: inline-block; vertical-align: middle; }
+
+.border_up { border-top: rgba(0,0,0,0.3) solid 2px; }
+.border_dn { border-bottom: rgba(0,0,0,0.3) solid 2px; }
+.underline { border-bottom: rgba(0,0,0,0.3) solid 2px; }
+.underline80 {
+       border-bottom: 1px solid #fafafa;
+       text-align: center;
+       width: 70%;
+       margin-left: auto;
+       margin-right: auto; }
+
+.black_back{ background-color: black; color: white; }
+.white_back{ background-color: white; }
+.grey_back{ background-color: grey; }
+.green_back{ background-color: #9aff00; }
+
+.blue_back{ background-color: blue; }
+.green_back{ background-color: green; }
+.cyan_back{ background-color: #3da8e1; }
+.yellow_back{ background-color: yellow; }
+.orange_back{ background-color: orange; }
+.red_back{ background-color: red; }
+
+
diff --git a/plugin/plugin/css/style.css b/plugin/plugin/css/style.css
new file mode 100644 (file)
index 0000000..0608372
--- /dev/null
@@ -0,0 +1,377 @@
+@charset "utf-8";
+@import url("fonts.css");
+body {
+    /*position: fixed;*/
+    width:100%;
+    height:100%;
+    top: 0px;
+    bottom: 0px;
+    left: 0px;
+    right: 0px;
+    background-color: white;
+    margin: 0;
+    padding: 0;
+    display:flex;
+    flex-direction: column;
+}
+
+.status_sub_bar {
+  text-align: center;
+  font-weight: midium;
+  font-size: 15px;
+  color: #252525;
+  padding: 5px 0;
+//  opacity:0.9;
+}
+
+/* .plugin-container { flex: 1; overflow:auto; } */
+
+#action_bar {
+    border-bottom: rgba(0,0,0,0.07) solid 1px;
+    display:flex;
+    background-color: #fafafa;
+}
+
+#header_bar {
+    min-height: 50px;
+    display:flex;
+    margin-left: auto;
+    margin-right: 10px;
+}
+
+#action_bar,
+#action_bar_back_button,
+#action_bar_title,
+#action_bar_menu {
+    min-height: 48px;
+/*    background-color: #fafafa;*/
+}
+
+#action_bar_more {
+    width: 56px;
+    display:flex;
+    align-items: center;
+    justify-content: center;
+    cursor: pointer;
+    margin: 15px 0 15px 15px;
+    /*background-color: red;*/
+}
+
+#action_bar_more:before {
+    content: "";
+    background-image: url("../res/option_ic_more.svg");
+    background-size: contain;
+    background-repeat: no-repeat;
+    background-position: center;
+    width: 100%;
+    height: 18px;
+    display: block;
+}
+
+#action_bar_back_button {
+    width: 56px;
+    display:flex;
+    align-items: center;
+    justify-content: center;
+    cursor: pointer;
+    -webkit-tap-highlight-color: transparent;
+}
+
+#action_bar_menu {
+    width: 48px;
+       visibility:hidden;
+}
+
+#action_bar_title {
+    text-overflow: ellipsis;
+    white-space: nowrap;
+    flex:1;
+    margin-left : 15px;
+}
+
+#action_bar_title_main {
+    font-size:23px;
+    color: #252525;
+    font-stretch: condensed;
+}
+
+#action_bar_title_sub {
+    font-size:13px;
+    color: #252525;
+    opacity: 0.6;
+    font-stretch: condensed;
+}
+/*
+#loading {
+    display:flex;
+    flex-direction: column;
+}
+
+#loading .img {
+    width: 60px;
+    height: 60px;
+    animation: spin 1s linear infinite;
+}
+*/
+@keyframes spin {
+    0% { transform: rotate(0deg); }
+    100% { transform: rotate(360deg); }
+}
+
+.dot {
+    fill: #499ebd;
+}
+
+#icon_back .back_arrow {
+    fill: none;
+    stroke: #499ebd;
+    stroke-width: 7;
+}
+
+#icon_back {
+    max-width:24px;
+    max-height:24px;
+}
+
+#icon_menu_box {
+    display:flex;
+    align-items: center;
+    justify-content: center;
+}
+
+#icon_menu {
+    max-height:24px;
+    cursor: pointer;
+    -webkit-tap-highlight-color: transparent;
+}
+
+#action_bar_menu ul {
+    position: absolute;
+    right: 5px;
+    padding: 0px;
+    margin: 0px;
+    background-color: #fafafa;
+    max-height: 0;
+    transition: max-height 0.15s ease-out;
+    overflow: hidden;
+    border-radius: 5px;
+    z-index: 2;
+    position:absolute;
+    top:10px;
+}
+
+#action_bar_menu ul li {
+    min-width: 150px;
+    display: flex;
+    align-items: center;
+    white-space: nowrap;
+}
+
+#action_bar_menu ul li a {
+    display: inline-block;
+    margin: auto;
+    padding: 10px;
+    text-decoration: none;
+    color: black;
+    -webkit-tap-highlight-color: transparent;
+}
+
+#action_bar_menu ul li:hover {
+    background: #eee;
+}
+
+#action_bar_menu ul li:first-child {
+    border-radius: 5px 5px 0px 0px;
+    border-top: 1px #bbb solid;
+    border-left: 1px #bbb solid;
+    border-right: 1px #bbb solid;
+}
+
+#action_bar_menu ul li:last-child {
+    border-radius: 0px 0px 5px 5px;
+    border-bottom: 1px #bbb solid;
+    border-left: 1px #bbb solid;
+    border-right: 1px #bbb solid;
+}
+
+#action_bar_menu ul li:only-child {
+    border-radius: 5px;
+    border: 1px #bbb solid;
+}
+
+#action_bar_menu ul li {
+    border-left: 1px #bbb solid;
+    border-right: 1px #bbb solid;
+}
+
+#action_bar_menu.active ul {
+    max-height: 1000px;
+    transition: max-height 0.25s ease-in;
+}
+
+.button {
+    border-radius: 5px;
+    border-color: #d4d4d4;
+    border-style: solid;
+    border-width: 1px;
+    display: inline;
+    padding: 8px;
+}
+
+#power_icon_back_circle {
+  border-radius: 50%;
+  background: #3695dd;
+  width: 35px;
+  height: 35px;
+  margin: 10px 20px 0 auto;
+  display:flex;
+  align-items: center;
+}
+
+.svg-class {
+  width: 100%;
+  height: 100px;
+}
+
+#svg-status-id {
+  width: 100%;
+  height: 100%;
+}
+
+#combo_area {
+  display: block;
+  align-items: center;
+  justify-content: center;
+  margin: 5px 0px;
+}
+
+.mode_bar {
+  border-radius: 17px;
+  height: 30px;
+  width: 200px;
+  border: 2px solid #3695dd;
+}
+
+.mode_bar_text {
+  color: #3695dd;
+  font-size: 17px;
+  text-align-last:center;
+}
+
+.status-container {
+       text-align:center;
+       margin-bottom:0px;
+}
+
+.status_item_title {
+  text-align: center;
+  font-weight: regular;
+  font-size: 15px;
+  color: #252525;
+  opacity:0.8;
+}
+
+.status_item_content {
+  text-align: center;
+  font-weight: midium;
+  font-size: 15px;
+  color: #252525;
+}
+
+.function_container{
+  margin: 0 0 0 5%;
+  padding: 10px;
+  border-bottom: rgba(0,0,0,0.07) solid 1px;
+}
+
+.function_item{
+  height:75px;
+  width:100%;
+  color: white;
+}
+
+.item_icon {
+       width:30px;
+       height:30px;
+       display:inline-block;
+}
+
+.item_body {
+       width:150px;
+       height:40px;
+       display: inline-block;
+}
+
+.function_item_singleline{
+       margin: 0;
+       font-size: 0.8rem;
+       line-height: 1rem;
+       color: #252525;
+       margin-left: .8rem;
+       float: left;
+       padding-top: 1.275rem;
+       white-space: nowrap;
+       max-width: 12.4rem;
+       display:inline;
+}
+.function_item_multiline{
+       padding-top: 0.8rem;
+       margin-left: .8rem;;
+       float: left;
+       display:inline;
+}
+
+.function_item_multiline_1{
+       margin: 0;
+       font-size: 0.8rem;
+       line-height: 0.85rem;
+       color: #252525;
+  opacity:0.9;
+}
+
+.function_item_multiline_2{
+       margin: 0;
+       color: #3695dd;
+       font-size: 0.7rem;
+       line-height: 0.7rem;
+       padding-top: 0.25rem;
+}
+
+.row-custom {
+  content: "";
+  clear: both;
+  display: block;
+  height: inherit;
+}
+
+.left-col {
+  float: left;
+  width: 100%;
+  background-color: #fafafa;
+}
+
+.right-col {
+  float: left;
+  width: 100%;
+}
+
+@media only screen and (orientation: landscape) and (min-height: 360px){
+  .left-col {
+    width: 50%;
+    height: inherit;
+  }
+
+  .right-col {
+    width: 50%;
+  }
+
+.function_container{
+  margin-left: 0;
+  }
+}
+
+@media only screen and (min-width: 768px) {
+  .left-col {
+    height: inherit;
+  }
+}
diff --git a/plugin/plugin/icon.png b/plugin/plugin/icon.png
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/plugin/plugin/index.html b/plugin/plugin/index.html
new file mode 100644 (file)
index 0000000..827db0c
--- /dev/null
@@ -0,0 +1,65 @@
+<html lang="ko">
+       <head>
+               <title>Sound Level Checker</title>
+               <meta charset="utf-8">
+               <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+               <!-- Stylesheet-->
+               <link rel="stylesheet" type="text/css" href="css/style.css"/>
+               <link rel="stylesheet" type="text/css" href="css/sensor-soundLevel.css"/>
+               <!-- SAMSUNG CONNECT API -->
+               <script type="text/javascript" src="lib/SCPluginApi.js"></script>
+               <script type="text/javascript" src="js/capability_switch.js"></script>
+               <script type="text/javascript" src="js/capability_illuminanceMeasurement.js"></script>
+               <script type="text/javascript" src="js/index.js"></script>
+       </head>
+       <body>
+
+               <!-- Action bar-->
+               <div id="action_bar">
+                       <span id="action_bar_back_button" onclick="backAction()">
+                               <img src="res/board_ic_arrow_left.png" style="width: 100%; height:auto;" id="icon_back"/>
+                       </span>
+                       <span id="action_bar_title">
+                               <div id="action_bar_title_sub" class="roboto-condensed-bold">SCHOOL - CLASS ROOM</div>
+                               <div id="action_bar_title_main" class="roboto-condensed-bold">Sound Level</div>
+                       </span>
+                       <span id="action_bar_more">
+                       </span>
+               </div>
+
+               <div class="row-custom">
+                       <div class="left-col">
+                               <!-- Header-->
+                               <div id="header_bar">
+                                       <div id="power_icon_back_circle" onclick="onPowerBtnClicked()">
+                                       <img class="svg-class"src="res/ic_power.svg">
+                               </div>
+                       </div>
+                       <div id="combo_area" align="center">
+                               <div class="mode_bar mode_bar_text roboto-condensed-bold" style="line-height:34px">Loudness</div>
+                       </div>
+                       <div class="measure_container">
+                               <!-- sensor value display area -->
+                               <div class="soundLevel_value_wrap roboto-regular">
+                                       <div class="soundLevel_value">
+                                               <span class="soundLevel_value_item roboto-condensed-bold" id="soundLevel_value">70</span>
+                                               <span class="soundLevel_value_item roboto-regular" id="sensor_unit">&nbsp;dBA</span>
+                                       </div>
+                               </div>
+                               <img class="icon-class" id="svg_night" src="res/bar-icon.png">
+                               <div class="roboto-condensed" id="audioLevel_area" align="center">
+                                       <div id="level_bar5" class="level_bar"></div>
+                                       <div id="level_bar4" class="level_bar"></div>
+                                       <div id="level_bar3" class="level_bar"></div>
+                                       <div id="level_bar2" class="level_bar"></div>
+                                       <div id="level_bar1" class="level_bar"></div>
+                               </div>
+                               <!-- status description -->
+                               <div class="icon-container">
+                                       <img class="icon-class" id="svg_night" src="res/spk-icon.png">
+                               </div>
+                       </div>
+               </div>
+
+       </body>
+</html>
diff --git a/plugin/plugin/js/capability_illuminanceMeasurement.js b/plugin/plugin/js/capability_illuminanceMeasurement.js
new file mode 100644 (file)
index 0000000..0c3013a
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2015 - 2017 Samsung Electronics Co., Ltd 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.
+ */
+
+var capabilityIlluminanceMeasurement = {
+       'href' : "/capability/illuminanceMeasurement/main/0",
+       'illuminance_value' : 0,
+
+       'update' : function() {
+               ocfDevice.getRemoteRepresentation(this.href, this.onRepresentCallback);
+       },
+
+       'onRepresentCallback' : function(result, deviceHandle, uri, rcsJsonString) {
+               scplugin.log.debug(className, arguments.callee.name, result);
+               scplugin.log.debug(className, arguments.callee.name, uri);
+
+               if (result == "OCF_OK" || result == "OCF_RESOURCE_CHANGED" || result == "OCF_RES_ALREADY_SUBSCRIBED") {
+                       this.soundLevel_value = rcsJsonString["illuminance"];
+                       document.getElementById("soundLevel_value").innerHTML = this.soundLevel_value;
+
+                       var def_width = 280;
+                       this.soundLevel_value = this.soundLevel_value - 30;
+
+               if (this.soundLevel_value < 0 ) this.soundLevel_value = 0;
+
+               if (this.soundLevel_value > 100 )
+                       document.getElementById("level_bar5").style.width = 280;
+               else
+                       document.getElementById("level_bar5").style.width = parseInt(def_width / 100 * this.soundLevel_value);
+
+               if (this.soundLevel_value > 75 )
+                       document.getElementById("level_bar4").style.width = 280;
+               else
+                       document.getElementById("level_bar4").style.width = parseInt(def_width / 75 * this.soundLevel_value);
+
+               if (this.soundLevel_value > 55)
+                       document.getElementById("level_bar3").style.width = 280;
+               else
+                       document.getElementById("level_bar3").style.width = parseInt(def_width / 55 * this.soundLevel_value);
+
+               if (this.soundLevel_value > 40)
+                       document.getElementById("level_bar2").style.width = 280;
+               else
+                       document.getElementById("level_bar2").style.width = parseInt(def_width / 40 * this.soundLevel_value);
+
+               if (this.soundLevel_value > 30)
+                       document.getElementById("level_bar1").style.width = 280;
+               else
+                       document.getElementById("level_bar1").style.width = parseInt(def_width / 30 * this.soundLevel_value);
+
+                       //alert("soundLevel_value : " + this.soundLevel_value);
+               }
+       }
+}
diff --git a/plugin/plugin/js/capability_switch.js b/plugin/plugin/js/capability_switch.js
new file mode 100644 (file)
index 0000000..ffe04b3
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2015 - 2017 Samsung Electronics Co., Ltd 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.
+ */
+
+var capabilitySwitch = {
+       'href' : "/capability/switch/main/0",
+       'powerState' : "on",
+
+       'update' : function() {
+               ocfDevice.getRemoteRepresentation(this.href, this.onRepresentCallback);
+       },
+
+       'onRepresentCallback' : function(result, deviceHandle, uri, rcsJsonString) {
+               scplugin.log.debug(className, arguments.callee.name, result);
+               scplugin.log.debug(className, arguments.callee.name, uri);
+
+               if (result == "OCF_OK" || result == "OCF_RESOURCE_CHANGED" || result == "OCF_RES_ALREADY_SUBSCRIBED") {
+                       capabilitySwitch.powerState = rcsJsonString["power"];
+
+                       var image = document.getElementById("power_icon_back_circle");
+                       if (capabilitySwitch.powerState == "on") {
+                               image.style.background="#3695dd";
+                   image.style.opacity="1";
+                       } else {
+                               image.style.background="#252525";
+                   image.style.opacity="0.2";
+                       }
+               }
+       },
+
+       'set' : function(state) {
+               scplugin.log.debug(className, arguments.callee.name, "power : " + state);
+               var setRcsJson = {};
+               setRcsJson["power"] = state;
+               ocfDevice.setRemoteRepresentation(this.href, setRcsJson, this.onRepresentCallback);
+       },
+
+       'powerToggle' : function() {
+               if (this.powerState == "on") {
+                       this.set("off");
+               } else {
+                       this.set("on");
+               }
+       }
+}
diff --git a/plugin/plugin/js/index-o.js b/plugin/plugin/js/index-o.js
new file mode 100644 (file)
index 0000000..4d5240f
--- /dev/null
@@ -0,0 +1,141 @@
+
+/*
+ * Copyright (c) 2015 - 2017 Samsung Electronics Co., Ltd 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.
+ */
+
+var ocfDevice;
+var className = "illuminanceMeter";
+var capabilities = [capabilitySwitch, capabilityIlluminanceMeasurement];
+
+window.onload = function () {
+       console.log("version : 0.0.1");
+       init();
+
+       document.body.addEventListener('click', function () {
+               closeListBox();
+       })
+};
+
+function init() {
+       console.log("-----------init-----------");
+       scplugin.manager.getOCFDevices(getOCFDeviceCB);
+}
+
+function getOCFDeviceCB(devices) {
+       console.log("getOCFDeviceCB : " + devices.length);
+
+       for (var i in devices) {
+               console.log("deviceHandle: " + devices[i].deviceHandle);
+               console.log("deviceName: " + devices[i].deviceName);
+               console.log("deviceType: " + devices[i].deviceType);
+               console.log("metadata: " + devices[i].metadata);
+       }
+
+       setMainDevice(devices[0]);
+       ocfDevice.subscribe(onRepresentCallback);
+
+       for (var i = 0; i < capabilities.length; i++) {
+               capabilities[i].update();
+       }
+}
+
+function onRepresentCallback(result, deviceHandle, uri, rcsJsonString) {
+    for (var i = 0; i < capabilities.length; i++) {
+        if ( capabilities[i].href == uri) {
+            capabilities[i].onRepresentCallback(result, deviceHandle, uri, rcsJsonString);
+        }
+    }
+}
+
+function setMainDevice(device) {
+       scplugin.log.debug(className, arguments.callee.name, "set ocf device : " + device.deviceName);
+       ocfDevice = device;
+}
+
+function backAction() {
+  scplugin.manager.close();
+}
+
+function onPowerBtnClicked() {
+       capabilitySwitch.powerToggle();
+}
+
+function closeListBox(event) {
+       // var x1 = event.offsetLeft;
+       // var y1 = event.offsetTop;
+       // var x2 = event.offsetWidth;
+       // var y2 = event.offsetHeight;
+       // var x = event.onmouseout.arguments["0"].clientX;
+       // var y = event.onmouseout.arguments["0"].clientY;
+       // if(x < x1 || x > x1+x2)
+       //      capabilityFanspeed.closeListbox();
+       // else if(y < y1 || y > y1+y2)
+       if (document.getElementById("listbox").classList.contains('show')) {
+               capabilityFanspeed.closeListbox();
+       }
+}
+
+function changeLevelWidth() {
+               //      var level_box = document.getElementById("level_bar0");
+
+                       var def_width = 280;
+//                     var value_bar0 = parseInt(Math.random() * 256);
+                       var value_bar0 = parseInt(def_width * 256);
+
+       //              level_box.style.width = value_bar0;
+                               document.getElementById("level_bar0").style.width = value_bar0;
+}
+
+function changeLevelWidth1() {
+
+               //      var illuminance_value = document.getElementById("illuminance_value").vlaue;
+                       var illuminance_value = 15;
+                       var def_width = 280;
+
+               if (illuminance_value > 140 )
+                       document.getElementById("level_bar5").style.width = 280;
+               else
+                       document.getElementById("level_bar5").style.width = parseInt(def_width / 140 * illuminance_value);
+
+               if (illuminance_value > 70 )
+                       document.getElementById("level_bar4").style.width = 280;
+               else
+                       document.getElementById("level_bar4").style.width = parseInt(def_width / 70 * illuminance_value);
+
+               if (illuminance_value > 40)
+                       document.getElementById("level_bar3").style.width = 280;
+               else
+                       document.getElementById("level_bar3").style.width = parseInt(def_width / 40 * illuminance_value);
+
+               if (illuminance_value > 20)
+                       document.getElementById("level_bar2").style.width = 280;
+               else
+                       document.getElementById("level_bar2").style.width = parseInt(def_width / 20 * illuminance_value);
+
+               if (illuminance_value > 10)
+                       document.getElementById("level_bar1").style.width = 280;
+               else
+                       document.getElementById("level_bar1").style.width = parseInt(def_width / 10 * illuminance_value);
+
+}
+
+/*
+function changeLevelWidth() {
+    var levelValue = document.getElementById("illuminance_value");
+
+    var lb3 = document.getElementById("level_bar3");
+    lb3.style.width = levelValue / 8 * 28;
+}
+*/
diff --git a/plugin/plugin/js/index.js b/plugin/plugin/js/index.js
new file mode 100644 (file)
index 0000000..a5a982f
--- /dev/null
@@ -0,0 +1,89 @@
+
+/*
+ * Copyright (c) 2015 - 2017 Samsung Electronics Co., Ltd 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.
+ */
+
+var ocfDevice;
+var className = "SoundLevelChecker";
+var capabilities = [capabilitySwitch, capabilityIlluminanceMeasurement];
+
+window.onload = function () {
+       console.log("version : 0.0.1");
+       init();
+
+       document.body.addEventListener('click', function () {
+               closeListBox();
+       })
+};
+
+function init() {
+       console.log("-----------init-----------");
+       scplugin.manager.getOCFDevices(getOCFDeviceCB);
+}
+
+function getOCFDeviceCB(devices) {
+       console.log("getOCFDeviceCB : " + devices.length);
+
+       for (var i in devices) {
+               console.log("deviceHandle: " + devices[i].deviceHandle);
+               console.log("deviceName: " + devices[i].deviceName);
+               console.log("deviceType: " + devices[i].deviceType);
+               console.log("metadata: " + devices[i].metadata);
+       }
+
+       setMainDevice(devices[0]);
+       ocfDevice.subscribe(onRepresentCallback);
+
+       for (var i = 0; i < capabilities.length; i++) {
+               capabilities[i].update();
+       }
+}
+
+function onRepresentCallback(result, deviceHandle, uri, rcsJsonString) {
+    for (var i = 0; i < capabilities.length; i++) {
+        if ( capabilities[i].href == uri) {
+            capabilities[i].onRepresentCallback(result, deviceHandle, uri, rcsJsonString);
+        }
+    }
+}
+
+function setMainDevice(device) {
+       scplugin.log.debug(className, arguments.callee.name, "set ocf device : " + device.deviceName);
+       ocfDevice = device;
+}
+
+function backAction() {
+  scplugin.manager.close();
+}
+
+function onPowerBtnClicked() {
+       capabilitySwitch.powerToggle();
+}
+
+function closeListBox(event) {
+       // var x1 = event.offsetLeft;
+       // var y1 = event.offsetTop;
+       // var x2 = event.offsetWidth;
+       // var y2 = event.offsetHeight;
+       // var x = event.onmouseout.arguments["0"].clientX;
+       // var y = event.onmouseout.arguments["0"].clientY;
+       // if(x < x1 || x > x1+x2)
+       //      capabilityFanspeed.closeListbox();
+       // else if(y < y1 || y > y1+y2)
+       if (document.getElementById("listbox").classList.contains('show')) {
+               capabilityFanspeed.closeListbox();
+       }
+}
+
diff --git a/plugin/plugin/manifest.xml b/plugin/plugin/manifest.xml
new file mode 100644 (file)
index 0000000..65c4509
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+  <manifest xmlns="http://samsung.com/ns/plugin"
+      manifestVersionCode="0"
+      package="soundLevel"
+      versionCode="1"
+      versionName="0.0.1"
+      minPluginSdkVersion="1.0.0">
+
+    <plugin label="default.plugin" icon="icon.png" >
+       <device type="none"
+         subType="none"
+         manufacturer="default.manufacturer"
+         manufacturerID="default.manufacturer.id" />
+    </plugin>
+    <privilegeLevel level="public"/>
+  </manifest>
diff --git a/plugin/plugin/res/bar-icon.png b/plugin/plugin/res/bar-icon.png
new file mode 100644 (file)
index 0000000..7d75b4f
Binary files /dev/null and b/plugin/plugin/res/bar-icon.png differ
diff --git a/plugin/plugin/res/board_ic_arrow_left.png b/plugin/plugin/res/board_ic_arrow_left.png
new file mode 100644 (file)
index 0000000..4c6118e
Binary files /dev/null and b/plugin/plugin/res/board_ic_arrow_left.png differ
diff --git a/plugin/plugin/res/ic_power.svg b/plugin/plugin/res/ic_power.svg
new file mode 100644 (file)
index 0000000..91f8202
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+        width="172px" height="172px" viewBox="0 0 172 172" enable-background="new 0 0 172 172" xml:space="preserve">
+<g>
+       <g>
+               <rect style="fill:#FFFFFF;" x="82.607" y="41.205" width="6.775" height="35.889"/>
+               <path style="fill:#FFFFFF;" d="M85.995,130.537c-24.247,0-43.973-19.745-43.973-44.014c0-17.017,9.964-32.673,25.385-39.886l2.87,6.137
+                       c-13.048,6.103-21.48,19.351-21.48,33.749c0,20.534,16.688,37.238,37.198,37.238c20.511,0,37.199-16.704,37.199-37.238
+                       c0-14.399-8.432-27.648-21.48-33.749l2.87-6.137c15.421,7.211,25.385,22.868,25.385,39.886
+                       C129.968,110.792,110.241,130.537,85.995,130.537z"/>
+       </g>
+</g>
+</svg>
diff --git a/plugin/plugin/res/option_ic_more.svg b/plugin/plugin/res/option_ic_more.svg
new file mode 100644 (file)
index 0000000..3ea40c9
--- /dev/null
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+width="408px" height="408px" viewBox="0 0 408 408" style="enable-background:new 0 0 408 408;" xml:space="preserve" fill="#46a5ed">
+       <g>
+               <g id="more-vert">
+                       <path d="M204,102c28.05,0,51-22.95,51-51S232.05,0,204,0s-51,22.95-51,51S175.95,102,204,102z M204,153c-28.05,0-51,22.95-51,51
+                               s22.95,51,51,51s51-22.95,51-51S232.05,153,204,153z M204,306c-28.05,0-51,22.95-51,51s22.95,51,51,51s51-22.95,51-51
+                               S232.05,306,204,306z"/>
+               </g>
+       </g>
+</svg>
diff --git a/plugin/plugin/res/spk-icon.png b/plugin/plugin/res/spk-icon.png
new file mode 100644 (file)
index 0000000..ef4815b
Binary files /dev/null and b/plugin/plugin/res/spk-icon.png differ