CK-InoDrive-API 1.0.1__tar.gz → 1.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/CK_InoDrive_API.egg-info/PKG-INFO +18 -4
  2. ck_inodrive_api-1.0.3/CK_InoDrive_API.egg-info/requires.txt +4 -0
  3. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/CkInoDriveAPI/__init__.py +1 -2
  4. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/CkInoDriveAPI/defines.py +20 -10
  5. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/CkInoDriveAPI/discoverLan.py +22 -10
  6. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/CkInoDriveAPI/file.py +103 -19
  7. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/CkInoDriveAPI/inoDrive.py +12 -9
  8. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/CkInoDriveAPI/sysControl.py +17 -1
  9. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/CkInoDriveAPI/userApp.py +146 -50
  10. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/CkInoDriveAPI/utils.py +44 -11
  11. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/CkInoDriveAPI/wsHandle.py +120 -62
  12. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/PKG-INFO +18 -4
  13. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/README.txt +113 -36
  14. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/setup.py +5 -3
  15. ck_inodrive_api-1.0.1/CK_InoDrive_API.egg-info/requires.txt +0 -3
  16. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/CK_InoDrive_API.egg-info/SOURCES.txt +0 -0
  17. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/CK_InoDrive_API.egg-info/dependency_links.txt +0 -0
  18. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/CK_InoDrive_API.egg-info/top_level.txt +0 -0
  19. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/CkInoDriveAPI/IO.py +0 -0
  20. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/CkInoDriveAPI/_version.py +0 -0
  21. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/CkInoDriveAPI/callback.py +0 -0
  22. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/CkInoDriveAPI/ck_ca.crt +0 -0
  23. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/CkInoDriveAPI/discoverWs.py +0 -0
  24. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/LICENSE.txt +0 -0
  25. {ck_inodrive_api-1.0.1 → ck_inodrive_api-1.0.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.4
2
2
  Name: CK-InoDrive-API
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: InoDrive API Library
5
5
  Home-page: https://cardinalkinetic.com
6
6
  Author: Cardinal Kinetic
@@ -15,12 +15,26 @@ Classifier: Topic :: Scientific/Engineering
15
15
  Classifier: Programming Language :: Python :: 3
16
16
  Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.14
18
19
  Description-Content-Type: text/markdown
19
20
  License-File: LICENSE.txt
20
21
  License-File: README.txt
21
- Requires-Dist: websocket-client==1.8.0
22
+ Requires-Dist: websocket-client==1.9.2
22
23
  Requires-Dist: ifaddr==0.2.0
23
- Requires-Dist: msgpack==1.1.0
24
+ Requires-Dist: msgpack==1.2.4
25
+ Requires-Dist: getmac==0.9.6
26
+ Dynamic: author
27
+ Dynamic: author-email
28
+ Dynamic: classifier
29
+ Dynamic: description
30
+ Dynamic: description-content-type
31
+ Dynamic: home-page
32
+ Dynamic: keywords
33
+ Dynamic: license
34
+ Dynamic: license-file
35
+ Dynamic: project-url
36
+ Dynamic: requires-dist
37
+ Dynamic: summary
24
38
 
25
39
  #### **Installation**
26
40
 
@@ -0,0 +1,4 @@
1
+ websocket-client==1.9.2
2
+ ifaddr==0.2.0
3
+ msgpack==1.2.4
4
+ getmac==0.9.6
@@ -2,5 +2,4 @@ from .inoDrive import InoDrive
2
2
  from .discoverLan import id_discover_lan
3
3
 
4
4
  discover = id_discover_lan
5
- __version__ = '1.0.1'
6
- __version__ = '1.0.1'
5
+ __version__ = '1.0.3'
@@ -83,6 +83,7 @@ class _MsgPack(object):
83
83
  GET_METRICS = 0x12
84
84
  LIST_VARIABLES = 0x16
85
85
  ACCESS_VARIABLES = 0x17
86
+ RPC_SET_FLAG = 0x18
86
87
 
87
88
  SET_INPUT_POLARITY = 0x20
88
89
  SET_OUTPUTS = 0x21
@@ -98,6 +99,18 @@ class _MsgPackErrors(object):
98
99
  NOT_IMPLEMENTED = 0x5
99
100
  NOT_ALLOWED = 0x6
100
101
 
102
+ class _RPCDefines(object):
103
+ PEER_READY = 0x0
104
+ PEER_NOT_READY = 0x1
105
+
106
+ class _ConsoleMsgTypes(object):
107
+ TYPES = {
108
+ 0: "trace",
109
+ 1: "info",
110
+ 2: "notice",
111
+ 3: "warning",
112
+ 4: "error"
113
+ }
101
114
 
102
115
  class _OPState(object):
103
116
  STATES = {
@@ -146,15 +159,11 @@ class _CkDefines(object):
146
159
  MSG_PACK = _MsgPack()
147
160
  MSG_PACK_ERRORS = _MsgPackErrors()
148
161
 
149
- API_VAR_ACCESS = {
150
- 'none': 0,
151
- 'read': 1,
152
- 'write': 2,
153
- 'readWrite': 3,
154
- 0: "none",
155
- 1: "read",
156
- 2: "write",
157
- 3: "readWrite",
162
+ API_VAR_FLAGS = {
163
+ 'accessRead': 1 << 0,
164
+ 'accessWrite': 1 << 1,
165
+ 'accessFull': 1 << 2,
166
+ 'nonVolatile': 1 << 7,
158
167
  }
159
168
  API_C_TYPES = {
160
169
  'bool': {'type': 0, 'size': 1},
@@ -172,7 +181,6 @@ class _CkDefines(object):
172
181
  'counter': {'type': 12, 'size': 0},
173
182
  }
174
183
 
175
-
176
184
  # MessageTypes = _MsgDefines()
177
185
  #
178
186
  #
@@ -446,3 +454,5 @@ class _CkDefines(object):
446
454
 
447
455
  CK = _CkDefines()
448
456
  OP_STATE = _OPState()
457
+ consoleMsgTypes = _ConsoleMsgTypes()
458
+ RPC_FLAGS = _RPCDefines()
@@ -14,6 +14,7 @@ SMEEX_UDP_WELL_KNOWN_PORT = 17737
14
14
  def _get_network_interfaces_using_ifaddr(one_ip_per_adapter=False):
15
15
  logging.info("List interfaces with ifaddr...")
16
16
  netif_ip_list = []
17
+
17
18
  try:
18
19
  import ifaddr
19
20
  except Exception as ex:
@@ -21,17 +22,25 @@ def _get_network_interfaces_using_ifaddr(one_ip_per_adapter=False):
21
22
  logging.error("Error, module 'ifaddr' not installed.")
22
23
  return None
23
24
 
25
+ try:
26
+ import getmac
27
+ except Exception as ex:
28
+ print("Error, module 'getmac' not installed.")
29
+ logging.error("Error, module 'getmac' not installed.")
30
+ return None
31
+
24
32
  adapters = ifaddr.get_adapters()
25
33
  logging.info("Found %d interfaces" % len(adapters))
26
34
  for adapter in adapters:
27
35
  ipv4_address_found = False
28
36
  print("IPs of network adapter ", adapter.nice_name)
29
37
  for ip in adapter.ips:
30
- if ip.ip.count('.') != 3:
38
+ if ip.ip.count(".") != 3:
31
39
  continue
32
40
  ipv4_address_found = True
33
41
  logging.info("--> " + str(ip.ip) + "/" + str(ip.network_prefix))
34
- result = (adapter, ip.ip)
42
+ mac = getmac.get_mac_address(interface=ip.nice_name)
43
+ result = (adapter, ip.ip, mac)
35
44
  netif_ip_list.append(result)
36
45
  if one_ip_per_adapter:
37
46
  break
@@ -42,8 +51,10 @@ def _get_network_interfaces_using_ifaddr(one_ip_per_adapter=False):
42
51
  return netif_ip_list
43
52
 
44
53
 
45
- def _discover_modules_on_netif(netif_ip_tuple, num_attempts=1, per_attempt_timeout=0.5, ma_sleep_min=0.2, ma_sleep_max=0.5):
46
- """ Discover modules on the network interface with the specified IP address."""
54
+ def _discover_modules_on_netif(
55
+ netif_ip_tuple, num_attempts=1, per_attempt_timeout=0.5, ma_sleep_min=0.2, ma_sleep_max=0.5
56
+ ):
57
+ """Discover modules on the network interface with the specified IP address."""
47
58
  modules_found = {}
48
59
 
49
60
  # Apply a sensible minimum to the timeout
@@ -60,7 +71,7 @@ def _discover_modules_on_netif(netif_ip_tuple, num_attempts=1, per_attempt_timeo
60
71
  local_listen_port = 0
61
72
  # I could not get consistently good results with properly calculated size, so just use a big number.
62
73
  # Plan for around 300 bytes MINIMUM per module, especially on a CPU constrained system.
63
- recv_buf_size = (1000 * 500) # 500k/0.1s-OK, 100k/0.1s-OK
74
+ recv_buf_size = 1000 * 500 # 500k/0.1s-OK, 100k/0.1s-OK
64
75
  # Just a safety limit to prevent run-away memory allocation. We should never see 1000 responses, let alone more
65
76
  # Do not set this too low though because on Windows, if all modules respond with broadcasts, our internal list
66
77
  # will hold all responses twice.
@@ -101,7 +112,7 @@ def _discover_modules_on_netif(netif_ip_tuple, num_attempts=1, per_attempt_timeo
101
112
  # Bind to the wildcard address and the same port number as the first socket.
102
113
  # Under Linux, this allows us to collect responses sent to 255.255.255.255 which we would not get
103
114
  # through the original socket.
104
- bcast_sock.bind(('', local_listen_port))
115
+ bcast_sock.bind(("", local_listen_port))
105
116
  except Exception as exc:
106
117
  logging.error(type(exc).__name__)
107
118
  # Logger.log(logging.DEBUG, exc.__class__.__name__)
@@ -126,9 +137,9 @@ def _discover_modules_on_netif(netif_ip_tuple, num_attempts=1, per_attempt_timeo
126
137
  svc_name = "Identity"
127
138
  svc_name_len = min(16, len(svc_name))
128
139
  padding = 16 - svc_name_len
129
- payload = struct.pack(">BII", 0x05, my_session_id, 0) + bytes("Identity", 'ascii') + bytearray(padding)
140
+ payload = struct.pack(">BII", 0x05, my_session_id, 0) + bytes("Identity", "ascii") + bytearray(padding)
130
141
  # Send it to 255.255.255.255
131
- send_sock.sendto(payload, ('<broadcast>', SMEEX_UDP_WELL_KNOWN_PORT))
142
+ send_sock.sendto(payload, ("<broadcast>", SMEEX_UDP_WELL_KNOWN_PORT))
132
143
 
133
144
  internal_list_full = False
134
145
  while not internal_list_full:
@@ -178,8 +189,9 @@ def _discover_modules_on_netif(netif_ip_tuple, num_attempts=1, per_attempt_timeo
178
189
  sn = None
179
190
 
180
191
  if module_object is not None:
181
- module_object['netif'] = netif_ip_tuple[0]
182
- sn = module_object['sn']
192
+ module_object["netif"] = netif_ip_tuple[0]
193
+ module_object["netifMac"] = netif_ip_tuple[2]
194
+ sn = module_object["sn"]
183
195
 
184
196
  except struct.error:
185
197
  continue
@@ -1,13 +1,48 @@
1
1
  import json
2
+ import base64
2
3
  import logging
3
4
 
4
5
  from .defines import CK
5
6
  from .utils import Utils
6
7
 
8
+ GZIP_EXTENSIONS = [
9
+ ".html",
10
+ ".htm ",
11
+ ".xhtml",
12
+ ".xml",
13
+ ".svg ",
14
+ ".txt",
15
+ ".css",
16
+ ".js",
17
+ ".json",
18
+ ".md",
19
+ ".jpg",
20
+ ".jpeg",
21
+ ".png",
22
+ ".gif",
23
+ ".webp",
24
+ ".avif",
25
+ ".bmp",
26
+ ".ico",
27
+ ".pdf",
28
+ ".mp4",
29
+ ".webm",
30
+ ".ogg",
31
+ ".ogv",
32
+ ".oga",
33
+ ".mp3",
34
+ ".wav",
35
+ ".m4a",
36
+ ".ttf",
37
+ ".woff2",
38
+ ]
7
39
 
8
40
  class File(object):
9
41
  def __init__(self, **kwargs):
10
42
  self._get_connection_handle = kwargs.get('getConnectionHandle')
43
+ self._gzip_compress = kwargs.get('gZipCompress')
44
+ self._gzip_decompress = kwargs.get('gZipDecompress')
45
+
11
46
 
12
47
  @property
13
48
  def _connection_handle(self):
@@ -16,7 +51,7 @@ class File(object):
16
51
  def dispose(self):
17
52
  return
18
53
 
19
- def read(self, files=None, transfer_type=None):
54
+ def read(self, files=None, transfer_type=None, props={}):
20
55
  try:
21
56
  if files is None:
22
57
  logging.error(f"Files is None...")
@@ -58,12 +93,16 @@ class File(object):
58
93
  # Add file path TLV to the message
59
94
  msg += Utils.get_tlv(CK.TYPE.STRING, file_path)
60
95
 
61
- response = self._connection_handle.request(msg)
96
+ response = self._connection_handle.request(msg, props)
62
97
  if response.get('error'):
63
98
  logging.error('File read error...')
64
99
  return None
65
100
 
66
101
  file_content = response['items'][0]['data']
102
+
103
+ if self._is_gzip(file_path, file_content):
104
+ file_content = self._gzip_decompress(file_content)
105
+
67
106
  if content == 'json' or content == 'string':
68
107
  file_content = file_content.decode('utf-8')
69
108
  if content == 'json':
@@ -80,10 +119,12 @@ class File(object):
80
119
 
81
120
  return None
82
121
 
83
- def write(self, files=None, transfer_type=None):
122
+ def write(self, files=None, transfer_type=None, props={}):
84
123
  try:
124
+ no_compression = props.get('noCompression', False)
125
+
85
126
  if files is None:
86
- logging.error(f"Files not provided...")
127
+ logging.error("Files not provided...")
87
128
  return False
88
129
 
89
130
  if type(files) is not list:
@@ -104,7 +145,7 @@ class File(object):
104
145
  if file_path[0] == '.':
105
146
  file_path = file_path[1:]
106
147
 
107
- if file_path[0] != '/':
148
+ if transfer_type != CK.FILE.WEBPAGE_TRANSFER and file_path[0] != '/':
108
149
  file_path = f"/{file_path}"
109
150
 
110
151
  file_path = file_path.replace('\\', '/')
@@ -118,9 +159,17 @@ class File(object):
118
159
  file_content = bytes(file_content, 'utf-8')
119
160
 
120
161
  if file_content is None or type(file_content) is not bytes:
121
- logging.error(f"File content is not bytes...")
162
+ logging.error(f"File data is not bytes...")
122
163
  return False
123
164
 
165
+ compressed = None
166
+ if not no_compression and self._can_be_gzip(file_path):
167
+ # Gzip content
168
+ compressed = self._gzip_compress(file_content)
169
+
170
+ if compressed is not None and (len(compressed) < len(file_content)):
171
+ file_content = compressed
172
+
124
173
  msg = b''
125
174
  # file transfer first
126
175
  msg += Utils.get_tlv(transfer_type, CK.COMMAND.FILE_WRITE)
@@ -130,7 +179,7 @@ class File(object):
130
179
  msg += Utils.get_tlv(CK.TYPE.BLOB, file_content)
131
180
 
132
181
  # Send request and wait for response
133
- resp = self._connection_handle.request(msg)
182
+ resp = self._connection_handle.request(msg, props)
134
183
 
135
184
  if resp.get('error'):
136
185
  logging.error(f"File [{file_path}] write error: {resp.get('error')}")
@@ -142,10 +191,10 @@ class File(object):
142
191
 
143
192
  return False
144
193
 
145
- def delete_uapp(self):
194
+ def delete_uapp(self, props={}):
146
195
  try:
147
196
  # Send request and wait for response
148
- resp = self._connection_handle.request(Utils.get_tlv(CK.SPECIAL.DELETE_UAPP))
197
+ resp = self._connection_handle.request(Utils.get_tlv(CK.SPECIAL.DELETE_UAPP), props)
149
198
 
150
199
  if resp.get('error'):
151
200
  logging.error(f"Deleting User Application failed...")
@@ -157,36 +206,71 @@ class File(object):
157
206
 
158
207
  return False
159
208
 
160
- def upload_user_app(self, content=None):
209
+ def upload_user_app(self, content=None, props={}):
161
210
  try:
162
- return self.write([{'path': "/uapp/application.idsol", 'content': content}], CK.FILE.UAPP_TRANSFER)
211
+ if type(content) is str:
212
+ content = base64.b64decode(content)
213
+
214
+ return self.write([{'path': "/uapp/application.idsol", 'content': content}], CK.FILE.UAPP_TRANSFER, props)
163
215
  except Exception as ex:
164
216
  logging.exception(ex)
165
217
 
166
- def upload_firmware(self, content=None):
218
+ def upload_firmware(self, content=None, props={}):
167
219
  try:
168
- return self.write([{'path': "/firmware/firmware.ckfw", 'content': content}], CK.FILE.FIRMWARE_TRANSFER)
220
+ if type(content) is str:
221
+ content = base64.b64decode(content)
222
+
223
+ return self.write([{'path': "/firmware/firmware.ckfw", 'content': content}], CK.FILE.FIRMWARE_TRANSFER, props)
169
224
  except Exception as ex:
170
225
  logging.exception(ex)
171
226
 
172
- def upload_webpage(self, content=None):
227
+ def upload_web_content(self, file_name=None, content=None, props={}):
173
228
  try:
174
- return self.write([{'path': "web.bfb", 'content': content}], CK.FILE.WEBPAGE_TRANSFER)
229
+ if type(content) is str:
230
+ content = base64.b64decode(content)
231
+
232
+ if type(file_name) is not str:
233
+ file_name = "web.bfb"
234
+
235
+ return self.write([{'path': file_name, 'content': content}], CK.FILE.WEBPAGE_TRANSFER, props)
175
236
  except Exception as ex:
176
237
  logging.exception(ex)
177
238
 
178
- def read_module_config(self):
239
+ def read_module_config(self, props={}):
179
240
  try:
180
- return self.read({'path': '/config/module_cfg.json', 'content': 'json'})
241
+ return self.read({'path': '/config/module_cfg.json', 'content': 'json'}, props)
181
242
  except Exception as ex:
182
243
  logging.exception(ex)
183
244
 
184
- def write_module_config(self, content=None):
245
+ def write_module_config(self, content=None, props={}):
185
246
  try:
186
247
  if type(content) is not dict:
187
248
  logging.error('Content type is not dictionary')
188
249
  return False
189
250
 
190
- return self.write({'path': '/config/module_cfg.json', 'content': content})
251
+ return self.write({'path': '/config/module_cfg.json', 'content': content}, CK.FILE.TRANSFER, props)
191
252
  except Exception as ex:
192
253
  logging.exception(ex)
254
+
255
+ def _get_extension(self, file_path):
256
+ clean_path = file_path.split("?")[0].split("#")[0]
257
+ last_dot = clean_path.rfind(".")
258
+ last_slash = max(clean_path.rfind("/"), clean_path.rfind("\\"))
259
+
260
+ if last_dot == -1 or last_dot < last_slash:
261
+ return ""
262
+
263
+ return clean_path[last_dot:]
264
+
265
+ def _can_be_gzip(self, file_path):
266
+ extension = self._get_extension(file_path)
267
+ return extension in GZIP_EXTENSIONS
268
+
269
+ def _is_gzip(self, file_path, file_data):
270
+ if type(file_data) is not bytes:
271
+ return False
272
+
273
+ if self._can_be_gzip(file_path) and file_data[0] == 0x1f and file_data[1] == 0x8b and file_data[2] and 0x08:
274
+ return True
275
+
276
+ return False
@@ -1,5 +1,8 @@
1
1
  import logging
2
2
  import weakref
3
+ import sys
4
+ import gzip
5
+
3
6
  from ._version import get_version_number
4
7
  from .callback import Callback
5
8
 
@@ -15,10 +18,12 @@ class InoDrive(object):
15
18
  version = None
16
19
  _kwargs = None
17
20
  _connection_handle_instance = None
21
+ _os = None
18
22
 
19
23
  def __init__(self, **kwargs):
20
24
  self.version = get_version_number()
21
25
  self._kwargs = kwargs
26
+
22
27
  logging.debug('Create InoDrive instance...')
23
28
  self._auto_connect = kwargs.get('autoConnect', False)
24
29
 
@@ -37,7 +42,7 @@ class InoDrive(object):
37
42
  # ==============================================================================================================
38
43
  # MODULES BEGIN
39
44
  # ==============================================================================================================
40
- self.File = File(**kwargs, getConnectionHandle=self._get_connection_handle, callback=self._callback)
45
+ self.File = File(**kwargs, gZipCompress=self._gzip_compress, gZipDecompress=self._gzip_decompress, getConnectionHandle=self._get_connection_handle, callback=self._callback)
41
46
  self.Discover = DiscoverWs(**kwargs, getConnectionHandle=self._get_connection_handle, callback=self._callback)
42
47
  self.IO = IO(**kwargs, getConnectionHandle=self._get_connection_handle, callback=self._callback)
43
48
  self.UserApp = UserApp(**kwargs, getConnectionHandle=self._get_connection_handle, callback=self._callback)
@@ -49,11 +54,6 @@ class InoDrive(object):
49
54
  # ==============================================================================================================
50
55
  # CONNECTION
51
56
  # ==============================================================================================================
52
- if "useFallback" in self._kwargs:
53
- self._use_fallback = False if self._kwargs["useFallback"] == False else True
54
- else:
55
- self._use_fallback = True
56
-
57
57
  if "secureConnection" in self._kwargs:
58
58
  self._secure_connection = False if self._kwargs["secureConnection"] == False else True
59
59
  else:
@@ -107,9 +107,6 @@ class InoDrive(object):
107
107
  logging.exception(ex)
108
108
  if connection_handle:
109
109
  connection_handle = connection_handle.dispose()
110
-
111
- if not self._use_fallback:
112
- return
113
110
  else:
114
111
  connection_handle = InoDriveWS(**self._kwargs, callback=self._callback, secure=False)
115
112
  self._connection_handle_instance = connection_handle
@@ -145,3 +142,9 @@ class InoDrive(object):
145
142
  def _get_connection_handle(self):
146
143
  if self._connection_handle_instance is not None:
147
144
  return self._connection_handle_instance
145
+
146
+ def _gzip_decompress(self, data):
147
+ return gzip.decompress(data)
148
+
149
+ def _gzip_compress(self, data):
150
+ return gzip.compress(data)
@@ -1,6 +1,6 @@
1
1
  import logging
2
2
 
3
- from .defines import CK
3
+ from .defines import CK, RPC_FLAGS
4
4
  from .utils import Utils
5
5
 
6
6
 
@@ -102,3 +102,19 @@ class SysControl(object):
102
102
  logging.exception(ex)
103
103
 
104
104
  return None
105
+
106
+ def set_ready(self):
107
+ try:
108
+ response = self._connection_handle.msg_pack_request([CK.MSG_PACK.RPC_SET_FLAG, RPC_FLAGS.PEER_READY])
109
+ except Exception as ex:
110
+ logging.exception(ex)
111
+
112
+ return None
113
+
114
+ def clear_ready(self):
115
+ try:
116
+ response = self._connection_handle.msg_pack_request([CK.MSG_PACK.RPC_SET_FLAG, RPC_FLAGS.PEER_NOT_READY])
117
+ except Exception as ex:
118
+ logging.exception(ex)
119
+
120
+ return None