Skip to content

Commit ae99988

Browse files
author
oulinbao
committed
publish jdcloud-cli 1.2.7
1 parent 3063ca6 commit ae99988

6 files changed

Lines changed: 89 additions & 26 deletions

File tree

jdcloud_cli/controllers/services/iotcore.py

Lines changed: 54 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ def thing_type_list(self):
117117
(['--headers'], dict(help="""(json) 用户自定义Header,举例:'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
118118
],
119119
formatter_class=RawTextHelpFormatter,
120-
help=''' 查询物类型列表 ''',
120+
help=''' 查询物类型详情 ''',
121121
description='''
122-
查询物类型列表
122+
查询物类型详情
123123
124124
示例: jdc iotcore thing-type-describe --instance-id xxx
125125
''',
@@ -156,20 +156,20 @@ def thing_type_describe(self):
156156
description='''
157157
根据模型ID查看物模型完整信息。
158158
159-
示例: jdc iotcore discribe-thing-model --instance-id xxx --thing-model-id xxx
159+
示例: jdc iotcore describe-thing-model --instance-id xxx --thing-model-id xxx
160160
''',
161161
)
162-
def discribe_thing_model(self):
162+
def describe_thing_model(self):
163163
client_factory = ClientFactory('iotcore')
164164
client = client_factory.get(self.app)
165165
if client is None:
166166
return
167167

168168
try:
169-
from jdcloud_sdk.services.iotcore.apis.DiscribeThingModelRequest import DiscribeThingModelRequest
169+
from jdcloud_sdk.services.iotcore.apis.DescribeThingModelRequest import DescribeThingModelRequest
170170
params_dict = collect_user_args(self.app)
171171
headers = collect_user_headers(self.app)
172-
req = DiscribeThingModelRequest(params_dict, headers)
172+
req = DescribeThingModelRequest(params_dict, headers)
173173
resp = client.send(req)
174174
Printer.print_result(resp)
175175
except ImportError:
@@ -611,6 +611,8 @@ def add_device_links(self):
611611
(['--order'], dict(help="""(string) 排序关键字--name,type,productKey,status--最多支持一个字段 """, dest='order', required=False)),
612612
(['--direction'], dict(help="""(string) 顺序,升序降序--asc,desc """, dest='direction', required=False)),
613613
(['--parent-id'], dict(help="""(string) 父设备Id """, dest='parentId', required=False)),
614+
(['--order-id'], dict(help="""(int) 订单号 """, dest='orderId', type=int, required=False)),
615+
(['--device-collector-type'], dict(help="""(string) 设备采集器类型 """, dest='deviceCollectorType', required=False)),
614616
(['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例:--input-json \'{"field":"value"}\';\n文件格式举例:--input-json file:///xxxx.json', dest='input_json', required=False)),
615617
(['--headers'], dict(help="""(json) 用户自定义Header,举例:'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
616618
],
@@ -824,8 +826,8 @@ def elevator_operating_status(self):
824826
arguments=[
825827
(['--instance-id'], dict(help="""(string) Hub实例Id """, dest='instanceId', required=True)),
826828
(['--region-id'], dict(help="""(string) 区域Id """, dest='regionId', required=False)),
827-
(['--identifier'], dict(help="""(string) 当前的链接码 """, dest='identifier', required=False)),
828-
(['--protocol'], dict(help="""(string) 当前的协议类型 """, dest='protocol', required=False)),
829+
(['--identifier'], dict(help="""(string) 当前的链接码 """, dest='identifier', required=True)),
830+
(['--protocol'], dict(help="""(string) 当前的协议类型:; 语音播报控制器-输入端子,0X00000~X0007:inputTerminal; 语音播报控制器-播放信息,0X00024~X0027:playInfo; LR001-516-5B边缘数据采集器-传感器管理:sensor; LR001-516-5B边缘数据采集器-采集器属性:collectorProperty; LR001-516-5B边缘数据采集器-电梯属性:elevatorProperty; """, dest='protocol', required=True)),
829831
(['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例:--input-json \'{"field":"value"}\';\n文件格式举例:--input-json file:///xxxx.json', dest='input_json', required=False)),
830832
(['--headers'], dict(help="""(json) 用户自定义Header,举例:'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
831833
],
@@ -834,7 +836,7 @@ def elevator_operating_status(self):
834836
description='''
835837
获取协议信息。
836838
837-
示例: jdc iotcore collector-read-message --instance-id xxx
839+
示例: jdc iotcore collector-read-message --instance-id xxx --identifier xxx --protocol xxx
838840
''',
839841
)
840842
def collector_read_message(self):
@@ -859,9 +861,45 @@ def collector_read_message(self):
859861
arguments=[
860862
(['--instance-id'], dict(help="""(string) Hub实例Id """, dest='instanceId', required=True)),
861863
(['--region-id'], dict(help="""(string) 区域Id """, dest='regionId', required=False)),
862-
(['--identifier'], dict(help="""(string) 当前的链接码 """, dest='identifier', required=False)),
863-
(['--protocol'], dict(help="""(string) 当前的协议类型 """, dest='protocol', required=False)),
864-
(['--data'], dict(help="""(object) 当前待写入的数据 """, dest='data', required=False)),
864+
(['--identifier'], dict(help="""(string) 连接码 """, dest='identifier', required=True)),
865+
(['--address-of-first-register'], dict(help="""(int) 起始地址,如40301 """, dest='addressOfFirstRegister', type=int, required=True)),
866+
(['--number-of-registers'], dict(help="""(int) 寄存器数量 """, dest='numberOfRegisters', type=int, required=True)),
867+
(['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例:--input-json \'{"field":"value"}\';\n文件格式举例:--input-json file:///xxxx.json', dest='input_json', required=False)),
868+
(['--headers'], dict(help="""(json) 用户自定义Header,举例:'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
869+
],
870+
formatter_class=RawTextHelpFormatter,
871+
help=''' (0x03)读保持寄存器 ''',
872+
description='''
873+
(0x03)读保持寄存器。
874+
875+
示例: jdc iotcore read-holding-registers --instance-id xxx --identifier xxx --address-of-first-register 0 --number-of-registers 0
876+
''',
877+
)
878+
def read_holding_registers(self):
879+
client_factory = ClientFactory('iotcore')
880+
client = client_factory.get(self.app)
881+
if client is None:
882+
return
883+
884+
try:
885+
from jdcloud_sdk.services.iotcore.apis.ReadHoldingRegistersRequest import ReadHoldingRegistersRequest
886+
params_dict = collect_user_args(self.app)
887+
headers = collect_user_headers(self.app)
888+
req = ReadHoldingRegistersRequest(params_dict, headers)
889+
resp = client.send(req)
890+
Printer.print_result(resp)
891+
except ImportError:
892+
print('{"error":"This api is not supported, please use the newer version"}')
893+
except Exception as e:
894+
print(e)
895+
896+
@expose(
897+
arguments=[
898+
(['--instance-id'], dict(help="""(string) Hub实例Id """, dest='instanceId', required=True)),
899+
(['--region-id'], dict(help="""(string) 区域Id """, dest='regionId', required=False)),
900+
(['--identifier'], dict(help="""(string) 当前的链接码 """, dest='identifier', required=True)),
901+
(['--protocol'], dict(help="""(string) 当前的协议类型,非必填项; """, dest='protocol', required=False)),
902+
(['--data'], dict(help="""(object) 当前待写入的数据; 如指定播放设备,寄存地址:13对应16进制0x0D,寄存器值:2; {; "13":2; }; 如播放控制,寄存地址:14对应16进制0x0E,寄存器值:1; {; "14": 1; }; 如音量设置,寄存地址:15对应16进制0x0F,寄存器值:10,取值范围0~30; {; "15": 10; }; 如指定文件夹和文件播放,寄存地址:16对应16进制0x10,寄存器值:1; 寄存器值为两字节,第一个字节为文件夹,第二个字节为文件名; 如0x01文件夹,0x03文件名,0x0103换算为10进制为259; {; "16": 259; }; 如组合播放,寄存器地址:17、18和19,寄存器值:257、258和259,寄存器值的算法和指定文件夹和文件播放是一致的,如259可换算为0x01文件夹,0x03文件名; {; "17": 257,; "18": 258,; "19": 259; }; 如播放广告,寄存地址:32对应16进制0x20,寄存器值:259,寄存器值的算法和指定文件夹和文件播放是一致的,如259可换算为0x01文件夹,0x03文件名; {; "32": 259; }; 如指定文件夹循环播放,寄存地址:33对应16进制0x21,寄存器值:256,寄存器值的算法,如256可换算为0x0100文件夹; {; "33": 256; }; 如指定文件夹随机播放,寄存地址:34对应16进制0x22,寄存器值:256,寄存器值的算法,如256可换算为0x0100文件夹; {; "34": 256; }; 如指定曲目播放,寄存地址:35对应16进制0x23,寄存器值:13,歌曲选择范围为0~3000; {; "35": 13; }; """, dest='data', required=True)),
865903
(['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例:--input-json \'{"field":"value"}\';\n文件格式举例:--input-json file:///xxxx.json', dest='input_json', required=False)),
866904
(['--headers'], dict(help="""(json) 用户自定义Header,举例:'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
867905
],
@@ -870,7 +908,7 @@ def collector_read_message(self):
870908
description='''
871909
写入采集器数据。
872910
873-
示例: jdc iotcore collector-write-message --instance-id xxx
911+
示例: jdc iotcore collector-write-message --instance-id xxx --identifier xxx --data '{"":""}'
874912
''',
875913
)
876914
def collector_write_message(self):
@@ -987,6 +1025,8 @@ def add_loo_device(self):
9871025
(['--order'], dict(help="""(string) 排序关键字--name,type,productKey,status--最多支持一个字段 """, dest='order', required=False)),
9881026
(['--direction'], dict(help="""(string) 顺序,升序降序--asc,desc """, dest='direction', required=False)),
9891027
(['--parent-id'], dict(help="""(string) 父设备Id """, dest='parentId', required=False)),
1028+
(['--order-id'], dict(help="""(int) 订单号 """, dest='orderId', type=int, required=False)),
1029+
(['--device-collector-type'], dict(help="""(string) 设备采集器类型 """, dest='deviceCollectorType', required=False)),
9901030
(['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例:--input-json \'{"field":"value"}\';\n文件格式举例:--input-json file:///xxxx.json', dest='input_json', required=False)),
9911031
(['--headers'], dict(help="""(json) 用户自定义Header,举例:'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
9921032
],
@@ -1626,7 +1666,7 @@ def describe_product_topic(self):
16261666

16271667
@expose(
16281668
arguments=[
1629-
(['--api'], dict(help="""(string) api name """, choices=['device-query','thing-type-list','thing-type-describe','discribe-thing-model','device-register','download-certificate','delete-device','device-property-set','invoke-function','event-list','function-list','invoke-thing-topic','describe-thing-shadow','update-thing-shadow','invoke-thing-service','add-device-links','query-device-page','update-device','add-device','query-device-detail','remove-device','elevator-operating-status','collector-read-message','collector-write-message','update-loo-device','add-loo-device','loongray-query-page','remove-loongray-device','describe-product-with-admin','update-product-with-admin','delete-product-with-admin','list-products-with-admin','create-admin-product','list-products','create-product','describe-product','update-product','delete-product','list-product-abilities','import-thing-model','export-thing-model','describe-product-topics','create-product-topic','describe-product-topic',], required=True)),
1669+
(['--api'], dict(help="""(string) api name """, choices=['device-query','thing-type-list','thing-type-describe','describe-thing-model','device-register','download-certificate','delete-device','device-property-set','invoke-function','event-list','function-list','invoke-thing-topic','describe-thing-shadow','update-thing-shadow','invoke-thing-service','add-device-links','query-device-page','update-device','add-device','query-device-detail','remove-device','elevator-operating-status','collector-read-message','read-holding-registers','collector-write-message','update-loo-device','add-loo-device','loongray-query-page','remove-loongray-device','describe-product-with-admin','update-product-with-admin','delete-product-with-admin','list-products-with-admin','create-admin-product','list-products','create-product','describe-product','update-product','delete-product','list-product-abilities','import-thing-model','export-thing-model','describe-product-topics','create-product-topic','describe-product-topic',], required=True)),
16301670
],
16311671
formatter_class=RawTextHelpFormatter,
16321672
help=''' 生成单个API接口的json骨架空字符串 ''',

jdcloud_cli/resources/jdc.rc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ _jdc_complete()
178178

179179
"iotcore")
180180
COMPREPLY=( $(compgen \
181-
-W "-v --version -h --help generate-skeleton device-query thing-type-list thing-type-describe discribe-thing-model device-register download-certificate delete-device device-property-set invoke-function event-list function-list invoke-thing-topic describe-thing-shadow update-thing-shadow invoke-thing-service add-device-links query-device-page update-device add-device query-device-detail remove-device elevator-operating-status collector-read-message collector-write-message update-loo-device add-loo-device loongray-query-page remove-loongray-device describe-product-with-admin update-product-with-admin delete-product-with-admin list-products-with-admin create-admin-product list-products create-product describe-product update-product delete-product list-product-abilities import-thing-model export-thing-model describe-product-topics create-product-topic describe-product-topic " -- $cur) )
181+
-W "-v --version -h --help generate-skeleton device-query thing-type-list thing-type-describe describe-thing-model device-register download-certificate delete-device device-property-set invoke-function event-list function-list invoke-thing-topic describe-thing-shadow update-thing-shadow invoke-thing-service add-device-links query-device-page update-device add-device query-device-detail remove-device elevator-operating-status collector-read-message read-holding-registers collector-write-message update-loo-device add-loo-device loongray-query-page remove-loongray-device describe-product-with-admin update-product-with-admin delete-product-with-admin list-products-with-admin create-admin-product list-products create-product describe-product update-product delete-product list-product-abilities import-thing-model export-thing-model describe-product-topics create-product-topic describe-product-topic " -- $cur) )
182182
;;
183183

184184
"pod")
@@ -3852,7 +3852,7 @@ _jdc_complete()
38523852
COMPREPLY=( $(compgen \
38533853
-W "-h --help --headers --input-json --region-id --instance-id --device-meta-id " -- $cur) )
38543854
;;
3855-
"discribe-thing-model")
3855+
"describe-thing-model")
38563856
COMPREPLY=( $(compgen \
38573857
-W "-h --help --headers --input-json --region-id --instance-id --thing-model-id --thing-model-version " -- $cur) )
38583858
;;
@@ -3906,7 +3906,7 @@ _jdc_complete()
39063906
;;
39073907
"query-device-page")
39083908
COMPREPLY=( $(compgen \
3909-
-W "-h --help --headers --input-json --instance-id --region-id --device-name --status --product-key --device-type --now-page --page-size --order --direction --parent-id " -- $cur) )
3909+
-W "-h --help --headers --input-json --instance-id --region-id --device-name --status --product-key --device-type --now-page --page-size --order --direction --parent-id --order-id --device-collector-type " -- $cur) )
39103910
;;
39113911
"update-device")
39123912
COMPREPLY=( $(compgen \
@@ -3932,6 +3932,10 @@ _jdc_complete()
39323932
COMPREPLY=( $(compgen \
39333933
-W "-h --help --headers --input-json --instance-id --region-id --identifier --protocol " -- $cur) )
39343934
;;
3935+
"read-holding-registers")
3936+
COMPREPLY=( $(compgen \
3937+
-W "-h --help --headers --input-json --instance-id --region-id --identifier --address-of-first-register --number-of-registers " -- $cur) )
3938+
;;
39353939
"collector-write-message")
39363940
COMPREPLY=( $(compgen \
39373941
-W "-h --help --headers --input-json --instance-id --region-id --identifier --protocol --data " -- $cur) )
@@ -3946,7 +3950,7 @@ _jdc_complete()
39463950
;;
39473951
"loongray-query-page")
39483952
COMPREPLY=( $(compgen \
3949-
-W "-h --help --headers --input-json --instance-id --region-id --device-name --status --product-key --device-type --now-page --page-size --order --direction --parent-id " -- $cur) )
3953+
-W "-h --help --headers --input-json --instance-id --region-id --device-name --status --product-key --device-type --now-page --page-size --order --direction --parent-id --order-id --device-collector-type " -- $cur) )
39503954
;;
39513955
"remove-loongray-device")
39523956
COMPREPLY=( $(compgen \

jdcloud_cli/resources/skeletons/iotcore.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"regionId":"",
1919
"instanceId":""
2020
},
21-
"discribe-thing-model":{
21+
"describe-thing-model":{
2222
"thingModelId":"",
2323
"thingModelVersion":"",
2424
"regionId":"",
@@ -55,7 +55,6 @@
5555
"status":"",
5656
"thingModelId":"",
5757
"thingModelVersion":"",
58-
"thingType":"",
5958
"thingTypeCode":"",
6059
"thingTypeName":"",
6160
"uniqueId":"",
@@ -164,6 +163,8 @@
164163
"order":"",
165164
"direction":"",
166165
"parentId":"",
166+
"orderId":"",
167+
"deviceCollectorType":"",
167168
"instanceId":"",
168169
"regionId":""
169170
},
@@ -208,6 +209,13 @@
208209
"instanceId":"",
209210
"regionId":""
210211
},
212+
"read-holding-registers":{
213+
"identifier":"",
214+
"addressOfFirstRegister":"",
215+
"numberOfRegisters":"",
216+
"instanceId":"",
217+
"regionId":""
218+
},
211219
"collector-write-message":{
212220
"identifier":"",
213221
"protocol":"",
@@ -250,6 +258,8 @@
250258
"order":"",
251259
"direction":"",
252260
"parentId":"",
261+
"orderId":"",
262+
"deviceCollectorType":"",
253263
"instanceId":"",
254264
"regionId":""
255265
},

jdcloud_cli/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
VERSION = '1.2.6'
17+
VERSION = '1.2.7'

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from jdcloud_cli.version import VERSION
2323

2424
install_requires = ['websocket-client', 'configparser==4.0.2', 'requests', 'more-itertools==5.0.0',
25-
'argcomplete', 'argparse', 'jdcloud_sdk==1.6.42', 'pyyaml', 'jinja2==2.11.2', 'MarkupSafe==1.1.1', 'zipp==0.6.0']
25+
'argcomplete', 'argparse', 'jdcloud_sdk==1.6.62', 'pyyaml', 'jinja2==2.11.2', 'MarkupSafe==1.1.1', 'zipp==0.6.0']
2626

2727

2828
setup(

0 commit comments

Comments
 (0)