Skip to content

Commit 66ad362

Browse files
committed
Merge remote-tracking branch 'internal/develop_rel_1_5_11' into develop
* internal/develop_rel_1_5_11: Sync-up with iot-core 1.5.11 update caps_colorControl.c file update url for developer-mode caps_helper:enable 'change state' option for button capability modify usage style of setup.py/build.py
2 parents b65bd59 + b7a0c63 commit 66ad362

File tree

5 files changed

+61
-54
lines changed

5 files changed

+61
-54
lines changed

apps/capability_sample/caps_button.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,9 @@ static void caps_button_set_button_value(caps_button_data_t *caps_data, const ch
122122
static void caps_button_attr_button_send(caps_button_data_t *caps_data)
123123
{
124124
int sequence_no = -1;
125+
IOT_EVENT *attr = NULL;
126+
iot_cap_val_t value;
127+
iot_cap_attr_option_t attr_option = { 0 };
125128

126129
if (!caps_data || !caps_data->handle) {
127130
printf("fail to get handle\n");
@@ -132,12 +135,16 @@ static void caps_button_attr_button_send(caps_button_data_t *caps_data)
132135
return;
133136
}
134137

135-
ST_CAP_SEND_ATTR_STRING(caps_data->handle,
136-
(char *)caps_helper_button.attr_button.name,
137-
caps_data->button_value,
138-
NULL,
139-
NULL,
140-
sequence_no);
138+
value.type = IOT_CAP_VAL_TYPE_STRING;
139+
value.string = caps_data->button_value;
140+
141+
attr_option.state_change = true;
142+
143+
attr = st_cap_create_attr_with_option(caps_data->handle, (char *)caps_helper_button.attr_button.name, &value, NULL, NULL, &attr_option);
144+
if (attr != NULL){
145+
sequence_no = st_cap_send_attr(&attr, 1);
146+
st_cap_free_attr(attr);
147+
}
141148

142149
if (sequence_no < 0)
143150
printf("fail to send button value\n");
@@ -146,7 +153,6 @@ static void caps_button_attr_button_send(caps_button_data_t *caps_data)
146153

147154
}
148155

149-
150156
static int caps_button_get_numberOfButtons_value(caps_button_data_t *caps_data)
151157
{
152158
if (!caps_data) {

build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ def print_usage():
2323

2424
try:
2525
usage_buf = ""
26-
for bsp_dir in os.listdir(os.path.join(STDK_REF_PATH, "bsp")):
27-
if (os.path.isdir(os.path.join(STDK_REF_PATH, "bsp", bsp_dir))
26+
for bsp_dir in os.listdir(os.path.join(STDK_REF_PATH, "apps")):
27+
if (os.path.isdir(os.path.join(STDK_REF_PATH, "apps", bsp_dir))
2828
and os.path.isdir(os.path.join(STDK_REF_PATH, "apps", bsp_dir))):
2929
app_list = ""
3030
for dir in os.listdir(os.path.join(STDK_REF_PATH, "apps", bsp_dir)):

doc/getting_started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ The SmartThings App should be used to control an IoT device that is running with
516516
517517
1. **Enable developer mode**
518518
You need to enable the ***Developer Mode*** in the SmartThings app before start testing.
519-
Please refer [here](https://smartthings.developer.samsung.com/docs/testing/developer-mode.htm) for more details.
519+
Please refer [here](https://smartthings.developer.samsung.com/docs/testing/developer-mode.html) for more details.
520520
![developer mode](./res/developer_mode.png)
521521
522522
2. **Add device**

setup.py

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import sys
77

88
REPLACE_LIST = [
9-
["from", "to"]
9+
["from", "to"]
1010
]
1111

1212
STDK_REF_PATH = os.path.dirname(os.path.abspath(__file__))
@@ -17,70 +17,71 @@
1717

1818

1919
def print_usage():
20-
print("")
21-
print("Usage: python setup.py [BSP_NAME]")
22-
print("--------------------------------------------------")
23-
for dir in os.listdir(os.path.join(STDK_REF_PATH, "bsp")):
24-
if (os.path.isdir(os.path.join(STDK_REF_PATH, "bsp", dir))
25-
and os.path.isdir(os.path.join(STDK_REF_PATH, "tools", dir))):
26-
print(" ex) python setup.py " + dir)
27-
print("")
20+
print("")
21+
print("Usage: python setup.py [BSP_NAME]")
22+
print("--------------------------------------------------")
23+
for dir in os.listdir(os.path.join(STDK_REF_PATH, "tools")):
24+
dirpath = os.path.join(STDK_REF_PATH, "tools", dir)
25+
if (os.path.exists(os.path.join(dirpath, "setup_"+ dir + ".py")) or
26+
os.path.exists(os.path.join(dirpath, "setup_"+ dir + ".sh"))):
27+
print(" ex) python setup.py " + dir)
28+
print("")
2829

2930

3031
def find_setup_script(bsp_name):
31-
if os.path.exists(os.path.join("tools", bsp_name, "setup_" + bsp_name + ".py")):
32-
return "python " + os.path.join("tools", bsp_name, "setup_" + bsp_name + ".py")
33-
if "SHELL" in os.environ:
34-
if os.path.exists(os.path.join("tools", bsp_name, "setup_" + bsp_name + ".sh")):
35-
return os.path.join("tools", bsp_name, "setup_" + bsp_name + ".sh")
36-
print("Fail to find setup script")
37-
print_usage()
38-
exit(1)
32+
if os.path.exists(os.path.join("tools", bsp_name, "setup_" + bsp_name + ".py")):
33+
return "python " + os.path.join("tools", bsp_name, "setup_" + bsp_name + ".py")
34+
if "SHELL" in os.environ:
35+
if os.path.exists(os.path.join("tools", bsp_name, "setup_" + bsp_name + ".sh")):
36+
return os.path.join("tools", bsp_name, "setup_" + bsp_name + ".sh")
37+
print("Fail to find setup script")
38+
print_usage()
39+
exit(1)
3940

4041
def update_submodule(path):
41-
cwd = os.getcwd()
42-
try:
43-
print("Update submodule " + path)
44-
os.system("git submodule sync " + path)
45-
os.system("git submodule init " + path)
46-
os.system("git submodule update " + path)
47-
os.chdir(path)
48-
os.system("git reset --hard HEAD")
49-
except:
50-
print("Failed to update submodule " + path)
51-
os.chdir(cwd)
42+
cwd = os.getcwd()
43+
try:
44+
print("Update submodule " + path)
45+
os.system("git submodule sync " + path)
46+
os.system("git submodule init " + path)
47+
os.system("git submodule update " + path)
48+
os.chdir(path)
49+
os.system("git reset --hard HEAD")
50+
except:
51+
print("Failed to update submodule " + path)
52+
os.chdir(cwd)
5253

5354
update_submodule(STDK_CORE_PATH)
5455

5556
if len(sys.argv) == 1:
56-
print_usage()
57-
exit(1)
57+
print_usage()
58+
exit(1)
5859

5960
BSP_NAME = sys.argv[1]
6061
EXTRA_ARGS = sys.argv[2:]
6162

6263
for item in REPLACE_LIST:
63-
if BSP_NAME == item[0]:
64-
BSP_NAME = item[1]
64+
if BSP_NAME == item[0]:
65+
BSP_NAME = item[1]
6566

6667
setup_script = find_setup_script(BSP_NAME)
6768

6869
BSP_PATH = os.path.join(STDK_REF_PATH, "bsp", BSP_NAME)
6970
if BSP_PATH and os.path.isdir(BSP_PATH):
70-
update_submodule(BSP_PATH)
71+
update_submodule(BSP_PATH)
7172

7273
setup_cmd = setup_script + " " + BSP_NAME
7374
for args in EXTRA_ARGS:
74-
setup_cmd = setup_cmd + " " + args
75+
setup_cmd = setup_cmd + " " + args
7576
ret_val = os.system(setup_cmd)
7677
if ret_val:
77-
print_usage()
78-
exit(1)
78+
print_usage()
79+
exit(1)
7980
else:
80-
print("")
81-
print("======================================================================")
82-
print("")
83-
print("To use SmartThings Device SDK build script, run following command:")
84-
print("")
85-
print(" python build.py " + BSP_NAME + " [APP_NAME]")
86-
print("")
81+
print("")
82+
print("======================================================================")
83+
print("")
84+
print("To use SmartThings Device SDK build script, run following command:")
85+
print("")
86+
print(" python build.py " + BSP_NAME + " [APP_NAME]")
87+
print("")

0 commit comments

Comments
 (0)