sl5api 0.0.2__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.
@@ -0,0 +1,216 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ # Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ # poetry.lock
109
+ # poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ # pdm.lock
116
+ # pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ # pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # Redis
135
+ *.rdb
136
+ *.aof
137
+ *.pid
138
+
139
+ # RabbitMQ
140
+ mnesia/
141
+ rabbitmq/
142
+ rabbitmq-data/
143
+
144
+ # ActiveMQ
145
+ activemq-data/
146
+
147
+ # SageMath parsed files
148
+ *.sage.py
149
+
150
+ # Environments
151
+ .env
152
+ .envrc
153
+ .venv
154
+ env/
155
+ venv/
156
+ ENV/
157
+ env.bak/
158
+ venv.bak/
159
+
160
+ # Spyder project settings
161
+ .spyderproject
162
+ .spyproject
163
+
164
+ # Rope project settings
165
+ .ropeproject
166
+
167
+ # mkdocs documentation
168
+ /site
169
+
170
+ # mypy
171
+ .mypy_cache/
172
+ .dmypy.json
173
+ dmypy.json
174
+
175
+ # Pyre type checker
176
+ .pyre/
177
+
178
+ # pytype static type analyzer
179
+ .pytype/
180
+
181
+ # Cython debug symbols
182
+ cython_debug/
183
+
184
+ # PyCharm
185
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
186
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
187
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
188
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
189
+ # .idea/
190
+
191
+ # Abstra
192
+ # Abstra is an AI-powered process automation framework.
193
+ # Ignore directories containing user credentials, local state, and settings.
194
+ # Learn more at https://abstra.io/docs
195
+ .abstra/
196
+
197
+ # Visual Studio Code
198
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
199
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
200
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
201
+ # you could uncomment the following to ignore the entire vscode folder
202
+ # .vscode/
203
+
204
+ # Ruff stuff:
205
+ .ruff_cache/
206
+
207
+ # PyPI configuration file
208
+ .pypirc
209
+
210
+ # Marimo
211
+ marimo/_static/
212
+ marimo/_lsp/
213
+ __marimo__/
214
+
215
+ # Streamlit
216
+ .streamlit/secrets.toml
@@ -0,0 +1,15 @@
1
+ {
2
+ // Use IntelliSense to learn about possible attributes.
3
+ // Hover to view descriptions of existing attributes.
4
+ // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5
+ "version": "0.2.0",
6
+ "configurations": [
7
+ {
8
+ "name": "Python Debugger: Current File",
9
+ "type": "debugpy",
10
+ "request": "launch",
11
+ "program": "main.py",
12
+ "console": "integratedTerminal"
13
+ }
14
+ ]
15
+ }
sl5api-0.0.2/LICENSE ADDED
@@ -0,0 +1,7 @@
1
+ Copyright 2026 SimpLight LLC
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
sl5api-0.0.2/PKG-INFO ADDED
@@ -0,0 +1,17 @@
1
+ Metadata-Version: 2.4
2
+ Name: sl5api
3
+ Version: 0.0.2
4
+ Summary: SimpLight SCADA v5 gRPC api
5
+ Author-email: SimpLight <simp@simplight.ru>
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Classifier: Operating System :: OS Independent
9
+ Classifier: Programming Language :: Python :: 3
10
+ Requires-Python: >=3.9
11
+ Requires-Dist: grpcio>=1.76.0
12
+ Requires-Dist: protobuf>=6.33.2
13
+ Description-Content-Type: text/markdown
14
+
15
+ # SimpLight SCADA v5 gRPC API
16
+
17
+ Use this package to work with SimpLight SCADA v5. The package implements a scripting API that is available in system scripts in Lua language.
sl5api-0.0.2/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # SimpLight SCADA v5 gRPC API
2
+
3
+ Use this package to work with SimpLight SCADA v5. The package implements a scripting API that is available in system scripts in Lua language.
sl5api-0.0.2/gen.sh ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+
3
+ python -m grpc_tools.protoc \
4
+ -I ./protos \
5
+ --python_out=./src/sl5api/pb --pyi_out=./src/sl5api/pb \
6
+ --grpc_python_out=./src/sl5api/pb \
7
+ ./protos/*.proto
@@ -0,0 +1,52 @@
1
+ syntax = "proto3";
2
+
3
+ package sl5_grpc.pb;
4
+
5
+ import "google/protobuf/timestamp.proto";
6
+
7
+ option go_package = "server/app/server/api/grpc/pb";
8
+
9
+ // TagService
10
+ service TagService {
11
+ // Позволяет прочитать указанные теги
12
+ rpc ReadValues(TagReadValueRequest) returns (TagReadValueReply) {}
13
+
14
+ // Позволяет записать значения и качество в теги
15
+ rpc WriteValues(TagWriteValueRequest) returns (TagWriteValueReply) {}
16
+ }
17
+
18
+ message TagReadValueRequest {
19
+ repeated string names = 1;
20
+ }
21
+
22
+ message TagReadValueReply {
23
+ repeated SLValue values = 1;
24
+ }
25
+
26
+ // Представляет значение SimpLight используемое в api
27
+ message SLValue {
28
+ oneof kind {
29
+ double double_value = 1;
30
+ string string_value = 2;
31
+ bool bool_value = 3;
32
+ int32 int32_value = 4;
33
+ int64 int64_value = 5;
34
+ uint32 uint32_value = 6;
35
+ uint64 uint64_value = 7;
36
+ google.protobuf.Timestamp time_value = 8;
37
+ }
38
+ }
39
+
40
+ message TagWriteValueRequest {
41
+ repeated WriteValue wvs = 1;
42
+ }
43
+
44
+ message WriteValue {
45
+ string tag_name = 1;
46
+ SLValue value = 2;
47
+ uint32 quality = 3;
48
+ }
49
+
50
+ message TagWriteValueReply {
51
+
52
+ }
@@ -0,0 +1,22 @@
1
+ [build-system]
2
+ requires = ["hatchling >= 1.26"]
3
+ build-backend = "hatchling.build"
4
+ [project]
5
+ name = "sl5api"
6
+ version = "0.0.2"
7
+ dependencies = [
8
+ "grpcio>=1.76.0",
9
+ "protobuf>=6.33.2",
10
+ ]
11
+ authors = [
12
+ { name="SimpLight", email="simp@simplight.ru" },
13
+ ]
14
+ description = "SimpLight SCADA v5 gRPC api"
15
+ readme = "README.md"
16
+ requires-python = ">=3.9"
17
+ classifiers = [
18
+ "Programming Language :: Python :: 3",
19
+ "Operating System :: OS Independent",
20
+ ]
21
+ license = "MIT"
22
+ license-files = ["LICEN[CS]E*"]
File without changes
@@ -0,0 +1,128 @@
1
+ import grpc
2
+ from .rootcert import ROOT_CERTIFICATE
3
+ from datetime import datetime, timezone
4
+ from typing import Any
5
+ from .pb import sl5_api_pb2
6
+ from .pb import sl5_api_pb2_grpc
7
+
8
+ class Config:
9
+ target: str = 'localhost:23505'
10
+ token: str
11
+
12
+ def __init__(self, target: str, token: str):
13
+ self.target = target
14
+ self.token = token
15
+
16
+ class Client:
17
+ channel: grpc.aio.Channel
18
+ tag_stub: sl5_api_pb2_grpc.TagServiceStub
19
+
20
+ def __init__(self, config: Config):
21
+
22
+ call_credentials = grpc.access_token_call_credentials(config.token)
23
+
24
+ channel_credentials = grpc.ssl_channel_credentials(
25
+ root_certificates=ROOT_CERTIFICATE,
26
+ )
27
+
28
+ composite_credentials = grpc.composite_channel_credentials(
29
+ channel_credentials,
30
+ call_credentials,
31
+ )
32
+
33
+ self.channel = grpc.aio.secure_channel(config.target, composite_credentials)
34
+ self.tag_stub = sl5_api_pb2_grpc.TagServiceStub(self.channel)
35
+
36
+ async def __aenter__(self):
37
+ return self
38
+
39
+ async def __aexit__(self, exc_type, exc_val, exc_tb):
40
+ await self.close(None)
41
+
42
+ async def close(self, grace: float | None):
43
+ await self.channel.close(grace)
44
+
45
+ async def read_value(self, tag_name: str) -> Any:
46
+ """
47
+ Args:
48
+ tag_name (str): Название тега в вистеме
49
+
50
+ Returns:
51
+ Any: Значение тега
52
+
53
+ Raises:
54
+ grpc.aio._call.AioRpcError: Ошибка со стороны сервера
55
+ """
56
+
57
+ req = sl5_api_pb2.TagReadValueRequest(names=[tag_name])
58
+ res = await self.tag_stub.ReadValues(req)
59
+ pb_value = res.values[0]
60
+ any_value = pbvalue_to_any(pb_value)
61
+ return any_value
62
+
63
+ async def write_value(self, tag_name: str, new_value: Any, new_quality: int) -> None:
64
+ pb_value = any_to_pbvalue(new_value)
65
+ wv = sl5_api_pb2.WriteValue(
66
+ tag_name=tag_name,
67
+ quality=new_quality,
68
+ value=pb_value,
69
+ )
70
+ req = sl5_api_pb2.TagWriteValueRequest(wvs=[wv])
71
+ await self.tag_stub.WriteValues(req)
72
+
73
+ def pbvalue_to_any(src: sl5_api_pb2.SLValue) -> Any:
74
+ kind = src.WhichOneof("kind")
75
+ match kind:
76
+ case "double_value":
77
+ return src.double_value
78
+
79
+ case "string_value":
80
+ return src.string_value
81
+
82
+ case "bool_value":
83
+ return src.bool_value
84
+
85
+ case "int32_value":
86
+ return src.int32_value
87
+
88
+ case "int64_value":
89
+ return src.int64_value
90
+
91
+ case "uint32_value":
92
+ return src.uint32_value
93
+
94
+ case "uint64_value":
95
+ return src.uint64_value
96
+
97
+ case "time_value":
98
+ v = src.time_value.ToDatetime(tzinfo=timezone.utc)
99
+ # map v to localtime timezone
100
+ v = v.astimezone(tz=None)
101
+ return v
102
+ case _:
103
+ raise Exception(f"unsupported type {kind}")
104
+
105
+ def any_to_pbvalue(src: Any) -> sl5_api_pb2.SLValue:
106
+
107
+ if isinstance(src, bool):
108
+ return sl5_api_pb2.SLValue(bool_value=src)
109
+
110
+ if isinstance(src, datetime):
111
+ v = src.astimezone(tz=timezone.utc)
112
+ return sl5_api_pb2.SLValue(time_value=v)
113
+
114
+ match src:
115
+ case int(v):
116
+ dst = sl5_api_pb2.SLValue(int64_value=v)
117
+
118
+ case float(v):
119
+ dst = sl5_api_pb2.SLValue(double_value=v)
120
+
121
+ case str(v):
122
+ dst = sl5_api_pb2.SLValue(string_value=v)
123
+
124
+ case _:
125
+ raise ValueError(f"cannot cast {type(src)} to SLValue")
126
+
127
+ return dst
128
+
@@ -0,0 +1,50 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # NO CHECKED-IN PROTOBUF GENCODE
4
+ # source: sl5_api.proto
5
+ # Protobuf Python Version: 6.31.1
6
+ """Generated protocol buffer code."""
7
+ from google.protobuf import descriptor as _descriptor
8
+ from google.protobuf import descriptor_pool as _descriptor_pool
9
+ from google.protobuf import runtime_version as _runtime_version
10
+ from google.protobuf import symbol_database as _symbol_database
11
+ from google.protobuf.internal import builder as _builder
12
+ _runtime_version.ValidateProtobufRuntimeVersion(
13
+ _runtime_version.Domain.PUBLIC,
14
+ 6,
15
+ 31,
16
+ 1,
17
+ '',
18
+ 'sl5_api.proto'
19
+ )
20
+ # @@protoc_insertion_point(imports)
21
+
22
+ _sym_db = _symbol_database.Default()
23
+
24
+
25
+ from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
26
+
27
+
28
+ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\rsl5_api.proto\x12\x0bsl5_grpc.pb\x1a\x1fgoogle/protobuf/timestamp.proto\"$\n\x13TagReadValueRequest\x12\r\n\x05names\x18\x01 \x03(\t\"9\n\x11TagReadValueReply\x12$\n\x06values\x18\x01 \x03(\x0b\x32\x14.sl5_grpc.pb.SLValue\"\xe7\x01\n\x07SLValue\x12\x16\n\x0c\x64ouble_value\x18\x01 \x01(\x01H\x00\x12\x16\n\x0cstring_value\x18\x02 \x01(\tH\x00\x12\x14\n\nbool_value\x18\x03 \x01(\x08H\x00\x12\x15\n\x0bint32_value\x18\x04 \x01(\x05H\x00\x12\x15\n\x0bint64_value\x18\x05 \x01(\x03H\x00\x12\x16\n\x0cuint32_value\x18\x06 \x01(\rH\x00\x12\x16\n\x0cuint64_value\x18\x07 \x01(\x04H\x00\x12\x30\n\ntime_value\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.TimestampH\x00\x42\x06\n\x04kind\"<\n\x14TagWriteValueRequest\x12$\n\x03wvs\x18\x01 \x03(\x0b\x32\x17.sl5_grpc.pb.WriteValue\"T\n\nWriteValue\x12\x10\n\x08tag_name\x18\x01 \x01(\t\x12#\n\x05value\x18\x02 \x01(\x0b\x32\x14.sl5_grpc.pb.SLValue\x12\x0f\n\x07quality\x18\x03 \x01(\r\"\x14\n\x12TagWriteValueReply2\xb3\x01\n\nTagService\x12P\n\nReadValues\x12 .sl5_grpc.pb.TagReadValueRequest\x1a\x1e.sl5_grpc.pb.TagReadValueReply\"\x00\x12S\n\x0bWriteValues\x12!.sl5_grpc.pb.TagWriteValueRequest\x1a\x1f.sl5_grpc.pb.TagWriteValueReply\"\x00\x42\x1fZ\x1dserver/app/server/api/grpc/pbb\x06proto3')
29
+
30
+ _globals = globals()
31
+ _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
32
+ _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'sl5_api_pb2', _globals)
33
+ if not _descriptor._USE_C_DESCRIPTORS:
34
+ _globals['DESCRIPTOR']._loaded_options = None
35
+ _globals['DESCRIPTOR']._serialized_options = b'Z\035server/app/server/api/grpc/pb'
36
+ _globals['_TAGREADVALUEREQUEST']._serialized_start=63
37
+ _globals['_TAGREADVALUEREQUEST']._serialized_end=99
38
+ _globals['_TAGREADVALUEREPLY']._serialized_start=101
39
+ _globals['_TAGREADVALUEREPLY']._serialized_end=158
40
+ _globals['_SLVALUE']._serialized_start=161
41
+ _globals['_SLVALUE']._serialized_end=392
42
+ _globals['_TAGWRITEVALUEREQUEST']._serialized_start=394
43
+ _globals['_TAGWRITEVALUEREQUEST']._serialized_end=454
44
+ _globals['_WRITEVALUE']._serialized_start=456
45
+ _globals['_WRITEVALUE']._serialized_end=540
46
+ _globals['_TAGWRITEVALUEREPLY']._serialized_start=542
47
+ _globals['_TAGWRITEVALUEREPLY']._serialized_end=562
48
+ _globals['_TAGSERVICE']._serialized_start=565
49
+ _globals['_TAGSERVICE']._serialized_end=744
50
+ # @@protoc_insertion_point(module_scope)
@@ -0,0 +1,62 @@
1
+ import datetime
2
+
3
+ from google.protobuf import timestamp_pb2 as _timestamp_pb2
4
+ from google.protobuf.internal import containers as _containers
5
+ from google.protobuf import descriptor as _descriptor
6
+ from google.protobuf import message as _message
7
+ from collections.abc import Iterable as _Iterable, Mapping as _Mapping
8
+ from typing import ClassVar as _ClassVar, Optional as _Optional, Union as _Union
9
+
10
+ DESCRIPTOR: _descriptor.FileDescriptor
11
+
12
+ class TagReadValueRequest(_message.Message):
13
+ __slots__ = ("names",)
14
+ NAMES_FIELD_NUMBER: _ClassVar[int]
15
+ names: _containers.RepeatedScalarFieldContainer[str]
16
+ def __init__(self, names: _Optional[_Iterable[str]] = ...) -> None: ...
17
+
18
+ class TagReadValueReply(_message.Message):
19
+ __slots__ = ("values",)
20
+ VALUES_FIELD_NUMBER: _ClassVar[int]
21
+ values: _containers.RepeatedCompositeFieldContainer[SLValue]
22
+ def __init__(self, values: _Optional[_Iterable[_Union[SLValue, _Mapping]]] = ...) -> None: ...
23
+
24
+ class SLValue(_message.Message):
25
+ __slots__ = ("double_value", "string_value", "bool_value", "int32_value", "int64_value", "uint32_value", "uint64_value", "time_value")
26
+ DOUBLE_VALUE_FIELD_NUMBER: _ClassVar[int]
27
+ STRING_VALUE_FIELD_NUMBER: _ClassVar[int]
28
+ BOOL_VALUE_FIELD_NUMBER: _ClassVar[int]
29
+ INT32_VALUE_FIELD_NUMBER: _ClassVar[int]
30
+ INT64_VALUE_FIELD_NUMBER: _ClassVar[int]
31
+ UINT32_VALUE_FIELD_NUMBER: _ClassVar[int]
32
+ UINT64_VALUE_FIELD_NUMBER: _ClassVar[int]
33
+ TIME_VALUE_FIELD_NUMBER: _ClassVar[int]
34
+ double_value: float
35
+ string_value: str
36
+ bool_value: bool
37
+ int32_value: int
38
+ int64_value: int
39
+ uint32_value: int
40
+ uint64_value: int
41
+ time_value: _timestamp_pb2.Timestamp
42
+ def __init__(self, double_value: _Optional[float] = ..., string_value: _Optional[str] = ..., bool_value: bool = ..., int32_value: _Optional[int] = ..., int64_value: _Optional[int] = ..., uint32_value: _Optional[int] = ..., uint64_value: _Optional[int] = ..., time_value: _Optional[_Union[datetime.datetime, _timestamp_pb2.Timestamp, _Mapping]] = ...) -> None: ...
43
+
44
+ class TagWriteValueRequest(_message.Message):
45
+ __slots__ = ("wvs",)
46
+ WVS_FIELD_NUMBER: _ClassVar[int]
47
+ wvs: _containers.RepeatedCompositeFieldContainer[WriteValue]
48
+ def __init__(self, wvs: _Optional[_Iterable[_Union[WriteValue, _Mapping]]] = ...) -> None: ...
49
+
50
+ class WriteValue(_message.Message):
51
+ __slots__ = ("tag_name", "value", "quality")
52
+ TAG_NAME_FIELD_NUMBER: _ClassVar[int]
53
+ VALUE_FIELD_NUMBER: _ClassVar[int]
54
+ QUALITY_FIELD_NUMBER: _ClassVar[int]
55
+ tag_name: str
56
+ value: SLValue
57
+ quality: int
58
+ def __init__(self, tag_name: _Optional[str] = ..., value: _Optional[_Union[SLValue, _Mapping]] = ..., quality: _Optional[int] = ...) -> None: ...
59
+
60
+ class TagWriteValueReply(_message.Message):
61
+ __slots__ = ()
62
+ def __init__(self) -> None: ...
@@ -0,0 +1,145 @@
1
+ # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
2
+ """Client and server classes corresponding to protobuf-defined services."""
3
+ import grpc
4
+ import warnings
5
+
6
+ import sl5_api_pb2 as sl5__api__pb2
7
+
8
+ GRPC_GENERATED_VERSION = '1.76.0'
9
+ GRPC_VERSION = grpc.__version__
10
+ _version_not_supported = False
11
+
12
+ try:
13
+ from grpc._utilities import first_version_is_lower
14
+ _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
15
+ except ImportError:
16
+ _version_not_supported = True
17
+
18
+ if _version_not_supported:
19
+ raise RuntimeError(
20
+ f'The grpc package installed is at version {GRPC_VERSION},'
21
+ + ' but the generated code in sl5_api_pb2_grpc.py depends on'
22
+ + f' grpcio>={GRPC_GENERATED_VERSION}.'
23
+ + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
24
+ + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
25
+ )
26
+
27
+
28
+ class TagServiceStub(object):
29
+ """TagService
30
+ """
31
+
32
+ def __init__(self, channel):
33
+ """Constructor.
34
+
35
+ Args:
36
+ channel: A grpc.Channel.
37
+ """
38
+ self.ReadValues = channel.unary_unary(
39
+ '/sl5_grpc.pb.TagService/ReadValues',
40
+ request_serializer=sl5__api__pb2.TagReadValueRequest.SerializeToString,
41
+ response_deserializer=sl5__api__pb2.TagReadValueReply.FromString,
42
+ _registered_method=True)
43
+ self.WriteValues = channel.unary_unary(
44
+ '/sl5_grpc.pb.TagService/WriteValues',
45
+ request_serializer=sl5__api__pb2.TagWriteValueRequest.SerializeToString,
46
+ response_deserializer=sl5__api__pb2.TagWriteValueReply.FromString,
47
+ _registered_method=True)
48
+
49
+
50
+ class TagServiceServicer(object):
51
+ """TagService
52
+ """
53
+
54
+ def ReadValues(self, request, context):
55
+ """Позволяет прочитать указанные теги
56
+ """
57
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
58
+ context.set_details('Method not implemented!')
59
+ raise NotImplementedError('Method not implemented!')
60
+
61
+ def WriteValues(self, request, context):
62
+ """Позволяет записать значения и качество в теги
63
+ """
64
+ context.set_code(grpc.StatusCode.UNIMPLEMENTED)
65
+ context.set_details('Method not implemented!')
66
+ raise NotImplementedError('Method not implemented!')
67
+
68
+
69
+ def add_TagServiceServicer_to_server(servicer, server):
70
+ rpc_method_handlers = {
71
+ 'ReadValues': grpc.unary_unary_rpc_method_handler(
72
+ servicer.ReadValues,
73
+ request_deserializer=sl5__api__pb2.TagReadValueRequest.FromString,
74
+ response_serializer=sl5__api__pb2.TagReadValueReply.SerializeToString,
75
+ ),
76
+ 'WriteValues': grpc.unary_unary_rpc_method_handler(
77
+ servicer.WriteValues,
78
+ request_deserializer=sl5__api__pb2.TagWriteValueRequest.FromString,
79
+ response_serializer=sl5__api__pb2.TagWriteValueReply.SerializeToString,
80
+ ),
81
+ }
82
+ generic_handler = grpc.method_handlers_generic_handler(
83
+ 'sl5_grpc.pb.TagService', rpc_method_handlers)
84
+ server.add_generic_rpc_handlers((generic_handler,))
85
+ server.add_registered_method_handlers('sl5_grpc.pb.TagService', rpc_method_handlers)
86
+
87
+
88
+ # This class is part of an EXPERIMENTAL API.
89
+ class TagService(object):
90
+ """TagService
91
+ """
92
+
93
+ @staticmethod
94
+ def ReadValues(request,
95
+ target,
96
+ options=(),
97
+ channel_credentials=None,
98
+ call_credentials=None,
99
+ insecure=False,
100
+ compression=None,
101
+ wait_for_ready=None,
102
+ timeout=None,
103
+ metadata=None):
104
+ return grpc.experimental.unary_unary(
105
+ request,
106
+ target,
107
+ '/sl5_grpc.pb.TagService/ReadValues',
108
+ sl5__api__pb2.TagReadValueRequest.SerializeToString,
109
+ sl5__api__pb2.TagReadValueReply.FromString,
110
+ options,
111
+ channel_credentials,
112
+ insecure,
113
+ call_credentials,
114
+ compression,
115
+ wait_for_ready,
116
+ timeout,
117
+ metadata,
118
+ _registered_method=True)
119
+
120
+ @staticmethod
121
+ def WriteValues(request,
122
+ target,
123
+ options=(),
124
+ channel_credentials=None,
125
+ call_credentials=None,
126
+ insecure=False,
127
+ compression=None,
128
+ wait_for_ready=None,
129
+ timeout=None,
130
+ metadata=None):
131
+ return grpc.experimental.unary_unary(
132
+ request,
133
+ target,
134
+ '/sl5_grpc.pb.TagService/WriteValues',
135
+ sl5__api__pb2.TagWriteValueRequest.SerializeToString,
136
+ sl5__api__pb2.TagWriteValueReply.FromString,
137
+ options,
138
+ channel_credentials,
139
+ insecure,
140
+ call_credentials,
141
+ compression,
142
+ wait_for_ready,
143
+ timeout,
144
+ metadata,
145
+ _registered_method=True)
@@ -0,0 +1,25 @@
1
+
2
+ ROOT_CERTIFICATE = """
3
+ -----BEGIN CERTIFICATE-----
4
+ MIIDkzCCAnugAwIBAgIUSJFCdUz+HRePK/JoxrZPSA0RbIgwDQYJKoZIhvcNAQEL
5
+ BQAwWTELMAkGA1UEBhMCUlUxGjAYBgNVBAcMEVN2ZXJkbG92c2sgcmVnaW9uMRYw
6
+ FAYDVQQDDA1TaW1wTGlnaHQgTExDMRYwFAYDVQQKDA1TaW1wTGlnaHQgTExDMB4X
7
+ DTI0MTEwNDA4MjAzNFoXDTQ0MDEwNDA4MjAzNFowWTELMAkGA1UEBhMCUlUxGjAY
8
+ BgNVBAcMEVN2ZXJkbG92c2sgcmVnaW9uMRYwFAYDVQQDDA1TaW1wTGlnaHQgTExD
9
+ MRYwFAYDVQQKDA1TaW1wTGlnaHQgTExDMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
10
+ MIIBCgKCAQEAq6P0dlBPBUJ+zF6zt9PnSTv9TNgm7zceweDq+Yien8itNgTZI79D
11
+ KpkGFHKOaUSBUlXHQuvALBcr+BOguQb/Lc6oJp+vLZm8PqLMIl3PDzzj3dbMwTzR
12
+ 5P+od+WtmQeZxIN7KPD1yMl/ZgeXpN/py77gLAgB8MGLNsBnSDpe9mlhkBShNr1K
13
+ 2+2TPvJhfH+UcjFNHd+qkm3tYv+Qo8D2rmKj5dPAfZs0I4snDD5JcmMvc045n/eF
14
+ sy8joqZlHV6BZm522Epgt9oQFHj6bIP4XsENpBhWK8Rx2HLu5uksXATcHDHkMBT4
15
+ bGvjgoGHHG+PLZMSMuv7jhzOE3Tvog8NUQIDAQABo1MwUTAdBgNVHQ4EFgQUMeog
16
+ t4jvLGOG+nTy1LI0Sowo30UwHwYDVR0jBBgwFoAUMeogt4jvLGOG+nTy1LI0Sowo
17
+ 30UwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAMHZm/vIUVV+w
18
+ oq7oQGjN+WKoIgY8hUIwVKZsjjg+aPJwAuyMhY36DHdQRVZyQPBCgyQOs39ivDrL
19
+ HgjSmfTSl8rOai5LEoFfSssnkufuRi6Kj7uzXpEhzaMDtOnE/oPXSINdeEGJXc5U
20
+ mxKw9rDxtKsVIdbOJWDIiT9A5Owt5Y2cEnOWLQ4xWMJpP+2nTjl0qgEWJvJo7eJw
21
+ TknawKxpy0eFCqCy9sSalnVk/4FYpiXHyAHlWVsKBcVm1vlnAZAERuNP5oszWqaF
22
+ n6cUcTPW/NL7E9HGZuAyzI5DcUmEPpmq/SlTVo8fZzpD2tGloRi12gJvn3Hk00hs
23
+ KnXlTxGZSA==
24
+ -----END CERTIFICATE-----
25
+ """.encode("utf-8")