python-terminusgps 28.11.0__py3-none-any.whl → 29.0.0__py3-none-any.whl
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.
- {python_terminusgps-28.11.0.dist-info → python_terminusgps-29.0.0.dist-info}/METADATA +3 -1
- {python_terminusgps-28.11.0.dist-info → python_terminusgps-29.0.0.dist-info}/RECORD +18 -16
- terminusgps/mixins.py +1 -3
- terminusgps/opencv/__init__.py +0 -0
- terminusgps/opencv/barcode_scanner.py +7 -0
- terminusgps/validators.py +43 -0
- terminusgps/wialon/constants.py +48 -41
- terminusgps/wialon/flags.py +315 -0
- terminusgps/wialon/items/base.py +3 -3
- terminusgps/wialon/items/resource.py +2 -2
- terminusgps/wialon/items/retranslator.py +1 -1
- terminusgps/wialon/items/route.py +1 -1
- terminusgps/wialon/items/unit.py +6 -6
- terminusgps/wialon/items/unit_group.py +2 -2
- terminusgps/wialon/items/user.py +4 -4
- terminusgps/wialon/utils.py +7 -43
- {python_terminusgps-28.11.0.dist-info → python_terminusgps-29.0.0.dist-info}/WHEEL +0 -0
- {python_terminusgps-28.11.0.dist-info → python_terminusgps-29.0.0.dist-info}/licenses/COPYING +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-terminusgps
|
|
3
|
-
Version:
|
|
3
|
+
Version: 29.0.0
|
|
4
4
|
Summary: Provides abstractions/utilities for working with Wialon API, Authorize.NET API, AWS API, and more.
|
|
5
5
|
Project-URL: Documentation, https://app.terminusgps.com/docs/apps/python-terminusgps/index.html
|
|
6
6
|
Project-URL: Repository, https://github.com/terminusgps/python-terminusgps
|
|
@@ -17,5 +17,7 @@ Requires-Dist: authorizenet>=1.1.5
|
|
|
17
17
|
Requires-Dist: boto3>=1.34.144
|
|
18
18
|
Requires-Dist: django>=5.1.5
|
|
19
19
|
Requires-Dist: matplotlib>=3.10.1
|
|
20
|
+
Requires-Dist: opencv-python>=4.11.0.86
|
|
21
|
+
Requires-Dist: pandas>=2.2.3
|
|
20
22
|
Requires-Dist: python-wialon>=1.2.4
|
|
21
23
|
Requires-Dist: twilio>=9.4.5
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
terminusgps/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
terminusgps/mixins.py,sha256=
|
|
2
|
+
terminusgps/mixins.py,sha256=jzs_dH_YDmohH86I3uPnN-66C9OPVXaDPVdRHXA6vdk,940
|
|
3
3
|
terminusgps/settings.py,sha256=vY5yNjyMu-7Ya0bIPWUvrrSLERtxHGdkfeoY4Ul6cP0,613
|
|
4
|
-
terminusgps/validators.py,sha256=
|
|
4
|
+
terminusgps/validators.py,sha256=KxXw8NlN1-h1WN8RkWz_E8XI2imXb7dIQ6hVhhxctIg,3638
|
|
5
5
|
terminusgps/authorizenet/__init__.py,sha256=LiGLlWNNiqS7RSOP4Apabx-b9EBYyNbxRY_a0mvJoaE,466
|
|
6
6
|
terminusgps/authorizenet/auth.py,sha256=ICxPPzoUc64VbsIIemEWKrn8xjHGwbNdo2VbtaFCFss,1107
|
|
7
7
|
terminusgps/authorizenet/errors.py,sha256=HG5NwVxQCtOYidVl30y49PC0Ovw5VYdsy9wTgUFMw9M,949
|
|
@@ -15,24 +15,26 @@ terminusgps/authorizenet/profiles/subscriptions.py,sha256=N4_0kbBBJ0FtKdIydN8FLn
|
|
|
15
15
|
terminusgps/aws/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
terminusgps/aws/connect.py,sha256=TWf2bVz6LqSNQfVD7FKRn3K71VuLOwBj05Gs-9BsROg,693
|
|
17
17
|
terminusgps/aws/secrets.py,sha256=MxQEmmBLpMUQ2tYAsHdCYf-7RZ84LiogdKcTsACX5dw,361
|
|
18
|
+
terminusgps/opencv/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
19
|
+
terminusgps/opencv/barcode_scanner.py,sha256=VwebCfo-T0ORCdJ1YX46dVNt8HwwbtHQ-32m7tBbhH4,167
|
|
18
20
|
terminusgps/twilio/__init__.py,sha256=dYo41F2jft_eHDWSUtSpKGSRG1bewq_qClqilUJZkYM,33
|
|
19
21
|
terminusgps/twilio/caller.py,sha256=TiQ4f0TDDC35he1M1iSsBM2vutdGriwtV4pc17T--6I,3552
|
|
20
22
|
terminusgps/twilio/validators.py,sha256=nn7CCBTktNjcln6M4MR0ACxEsClgioSu89LRLgIiBZk,1112
|
|
21
23
|
terminusgps/wialon/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
-
terminusgps/wialon/constants.py,sha256=
|
|
23
|
-
terminusgps/wialon/flags.py,sha256=
|
|
24
|
+
terminusgps/wialon/constants.py,sha256=TgwQjUEQZXXDewepGCVCDIkL6RELI53GouM8qq2RM_M,1805
|
|
25
|
+
terminusgps/wialon/flags.py,sha256=O3oeJ5Thhv5ULnoEFNuvvWhqTf8xb6AtIwRci61UyJI,26098
|
|
24
26
|
terminusgps/wialon/logger.py,sha256=nUBsaLMaffSaAHGHAM6mFXDzix9hbNecVtA3INVtii8,968
|
|
25
27
|
terminusgps/wialon/session.py,sha256=THl88yfVBfRH8daKh1lmLSR8ro8TbyOokHx1Cev-En8,9638
|
|
26
|
-
terminusgps/wialon/utils.py,sha256=
|
|
28
|
+
terminusgps/wialon/utils.py,sha256=fGl41EItDxqq9JGDKoU50zfELjfab2XjVfIXy5RvRio,6343
|
|
27
29
|
terminusgps/wialon/items/__init__.py,sha256=3BVthghekMvhMQSzQgBMlD_phxmKSmp3Zvmo-z0O8Bs,211
|
|
28
|
-
terminusgps/wialon/items/base.py,sha256=
|
|
29
|
-
terminusgps/wialon/items/resource.py,sha256=
|
|
30
|
-
terminusgps/wialon/items/retranslator.py,sha256=
|
|
31
|
-
terminusgps/wialon/items/route.py,sha256=
|
|
32
|
-
terminusgps/wialon/items/unit.py,sha256=
|
|
33
|
-
terminusgps/wialon/items/unit_group.py,sha256=
|
|
34
|
-
terminusgps/wialon/items/user.py,sha256=
|
|
35
|
-
python_terminusgps-
|
|
36
|
-
python_terminusgps-
|
|
37
|
-
python_terminusgps-
|
|
38
|
-
python_terminusgps-
|
|
30
|
+
terminusgps/wialon/items/base.py,sha256=rwKaXd6vcHPNJ2cwBeeX8VYMJiDig_f4hFThAwkhwZk,7247
|
|
31
|
+
terminusgps/wialon/items/resource.py,sha256=wfUxACO4OdzT2IdCF9oBmU_7nYiH3Xvs6BripPD5IMI,14622
|
|
32
|
+
terminusgps/wialon/items/retranslator.py,sha256=sVEWrp8q1I-tO_rMTCH7TeQDDbZryIq8d9KVnhYyhH0,3795
|
|
33
|
+
terminusgps/wialon/items/route.py,sha256=amNPKZqgl8pEzKA_XJudnvBPzEsfHTmrC7uF15sZVI4,1216
|
|
34
|
+
terminusgps/wialon/items/unit.py,sha256=0IjfQSnJqVHVDheVA7x_upDjepsvMIFdE2invmtcXgc,9377
|
|
35
|
+
terminusgps/wialon/items/unit_group.py,sha256=QV2ZZgICaN3n6W1pFIyMLyNKB6KYBsLyKG64i-qXoOg,4113
|
|
36
|
+
terminusgps/wialon/items/user.py,sha256=N30wdejdG7LXrgafdKZH74YArGkX3xpZfTucn3m3aqM,7155
|
|
37
|
+
python_terminusgps-29.0.0.dist-info/METADATA,sha256=NErafOVNtPCzNAzrb-yTExNo2iJfDPjJ5mhRJio1R3M,1015
|
|
38
|
+
python_terminusgps-29.0.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
39
|
+
python_terminusgps-29.0.0.dist-info/licenses/COPYING,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
40
|
+
python_terminusgps-29.0.0.dist-info/RECORD,,
|
terminusgps/mixins.py
CHANGED
|
@@ -14,9 +14,7 @@ class HtmxTemplateResponseMixin(TemplateResponseMixin):
|
|
|
14
14
|
|
|
15
15
|
partial_template_name: str | None = None
|
|
16
16
|
"""
|
|
17
|
-
A partial template rendered by
|
|
18
|
-
|
|
19
|
-
.. _htmx: https://htmx.org/docs/
|
|
17
|
+
A partial template rendered by htmx.
|
|
20
18
|
|
|
21
19
|
:type: :py:obj:`str` | :py:obj:`None`
|
|
22
20
|
:value: :py:obj:`None`
|
|
File without changes
|
terminusgps/validators.py
CHANGED
|
@@ -3,6 +3,49 @@ import string
|
|
|
3
3
|
from django.core.exceptions import ValidationError
|
|
4
4
|
from django.utils.translation import gettext_lazy as _
|
|
5
5
|
|
|
6
|
+
from .wialon.session import WialonSession
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class WialonValidatorBase:
|
|
10
|
+
def __init__(self) -> None:
|
|
11
|
+
self.session: WialonSession = WialonSession()
|
|
12
|
+
self.session.login(self.session.token)
|
|
13
|
+
|
|
14
|
+
def __call__(self, value: str) -> None:
|
|
15
|
+
raise NotImplementedError("Subclasses must implement this method.")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class WialonImeiNumberValidator(WialonValidatorBase):
|
|
19
|
+
def __call__(self, value: str) -> None:
|
|
20
|
+
response = self.session.wialon_api.core_search_items(
|
|
21
|
+
**{
|
|
22
|
+
"spec": {
|
|
23
|
+
"itemsType": "avl_unit",
|
|
24
|
+
"propName": "sys_id,sys_unique_id",
|
|
25
|
+
"propValueMask": f"*,*{value}*",
|
|
26
|
+
"sortType": "sys_id,sys_unique_id",
|
|
27
|
+
},
|
|
28
|
+
"force": 0,
|
|
29
|
+
"flags": 1,
|
|
30
|
+
"from": 0,
|
|
31
|
+
"to": 0,
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
if response is None or not response.get("items"):
|
|
35
|
+
raise ValidationError(
|
|
36
|
+
_("IMEI #%(value)s was not found in Wialon."),
|
|
37
|
+
code="invalid",
|
|
38
|
+
params={"value": value},
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def validate_imei_number(value: str) -> None:
|
|
43
|
+
"""Raises :py:exec:`ValidationError` if the value is an invalid IMEI number."""
|
|
44
|
+
try:
|
|
45
|
+
WialonImeiNumberValidator()(value)
|
|
46
|
+
except ValidationError:
|
|
47
|
+
raise
|
|
48
|
+
|
|
6
49
|
|
|
7
50
|
def validate_vin_number(value: str) -> None:
|
|
8
51
|
"""Raises :py:exec:`ValidationError` if the value is an invalid VIN number."""
|
terminusgps/wialon/constants.py
CHANGED
|
@@ -1,50 +1,57 @@
|
|
|
1
|
-
|
|
1
|
+
import enum
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
from . import flags
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class WialonItemsType(enum.StrEnum):
|
|
7
|
+
HARDWARE = "avl_hw"
|
|
8
|
+
RESOURCE = "avl_resource"
|
|
9
|
+
RETRANSLATOR = "avl_retranslator"
|
|
10
|
+
ROUTE = "avl_route"
|
|
11
|
+
UNIT = "avl_unit"
|
|
12
|
+
UNIT_GROUP = "avl_unit_group"
|
|
13
|
+
USER = "user"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
ACCESSMASK_RESOURCE_BASIC: int = (
|
|
17
|
+
flags.AccessFlag.VIEW_ITEM_BASIC
|
|
18
|
+
| flags.AccessFlag.VIEW_CUSTOM_FIELDS
|
|
19
|
+
| flags.AccessFlag.MANAGE_CUSTOM_FIELDS
|
|
20
|
+
| flags.AccessFlag.VIEW_ADMIN_FIELDS
|
|
21
|
+
| flags.AccessFlag.RESOURCE_VIEW_NOTIFICATIONS
|
|
22
|
+
| flags.AccessFlag.RESOURCE_MANAGE_NOTIFICATIONS
|
|
23
|
+
| flags.AccessFlag.RESOURCE_VIEW_POIS
|
|
24
|
+
| flags.AccessFlag.RESOURCE_VIEW_GEOFENCES
|
|
25
|
+
| flags.AccessFlag.RESOURCE_MANAGE_GEOFENCES
|
|
26
|
+
| flags.AccessFlag.RESOURCE_VIEW_DRIVERS
|
|
27
|
+
| flags.AccessFlag.RESOURCE_MANAGE_DRIVERS
|
|
28
|
+
| flags.AccessFlag.RESOURCE_VIEW_ORDERS
|
|
29
|
+
| flags.AccessFlag.RESOURCE_VIEW_TRAILERS
|
|
19
30
|
)
|
|
20
31
|
"""Basic resource permissions"""
|
|
21
32
|
|
|
22
|
-
ACCESSMASK_UNIT_BASIC: int =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
flags.ACCESSFLAG_UNIT_EXPORT_MESSAGES,
|
|
37
|
-
]
|
|
33
|
+
ACCESSMASK_UNIT_BASIC: int = (
|
|
34
|
+
flags.AccessFlag.VIEW_ITEM_BASIC
|
|
35
|
+
| flags.AccessFlag.VIEW_ITEM_DETAILED
|
|
36
|
+
| flags.AccessFlag.RENAME_ITEM
|
|
37
|
+
| flags.AccessFlag.VIEW_CUSTOM_FIELDS
|
|
38
|
+
| flags.AccessFlag.MANAGE_CUSTOM_FIELDS
|
|
39
|
+
| flags.AccessFlag.MANAGE_ICON
|
|
40
|
+
| flags.AccessFlag.QUERY_REPORTS
|
|
41
|
+
| flags.AccessFlag.VIEW_ATTACHED_FILES
|
|
42
|
+
| flags.AccessFlag.UNIT_EXECUTE_COMMANDS
|
|
43
|
+
| flags.AccessFlag.UNIT_VIEW_SERVICE_INTERVALS
|
|
44
|
+
| flags.AccessFlag.UNIT_REGISTER_EVENTS
|
|
45
|
+
| flags.AccessFlag.UNIT_IMPORT_MESSAGES
|
|
46
|
+
| flags.AccessFlag.UNIT_EXPORT_MESSAGES
|
|
38
47
|
)
|
|
39
48
|
"""Basic unit permissions"""
|
|
40
49
|
|
|
41
|
-
ACCESSMASK_UNIT_MIGRATION: int =
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
flags.ACCESSFLAG_VIEW_ITEM_BASIC,
|
|
48
|
-
]
|
|
50
|
+
ACCESSMASK_UNIT_MIGRATION: int = (
|
|
51
|
+
flags.AccessFlag.DELETE_ITEM
|
|
52
|
+
| flags.AccessFlag.MANAGE_ITEM_ACCESS
|
|
53
|
+
| flags.AccessFlag.UNIT_DELETE_MESSAGES
|
|
54
|
+
| flags.AccessFlag.UNIT_MANAGE_CONNECTIVITY
|
|
55
|
+
| flags.AccessFlag.VIEW_ITEM_BASIC
|
|
49
56
|
)
|
|
50
57
|
"""Unit migration permissions"""
|
terminusgps/wialon/flags.py
CHANGED
|
@@ -1,3 +1,318 @@
|
|
|
1
|
+
import enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class AccessFlag(enum.Flag):
|
|
5
|
+
VIEW_ITEM_BASIC = 0x0001
|
|
6
|
+
"""View this item's basic properties"""
|
|
7
|
+
VIEW_ITEM_DETAILED = 0x0002
|
|
8
|
+
"""View this item's detailed properties"""
|
|
9
|
+
MANAGE_ITEM_ACCESS = 0x0004
|
|
10
|
+
"""Manage access to this item"""
|
|
11
|
+
DELETE_ITEM = 0x0008
|
|
12
|
+
"""Delete this item"""
|
|
13
|
+
RENAME_ITEM = 0x0010
|
|
14
|
+
"""Rename this item"""
|
|
15
|
+
VIEW_CUSTOM_FIELDS = 0x0020
|
|
16
|
+
"""View this item's custom fields"""
|
|
17
|
+
MANAGE_CUSTOM_FIELDS = 0x0040
|
|
18
|
+
"""Manage this item's custom fields"""
|
|
19
|
+
MANAGE_UNMENTIONED_FIELDS = 0x0080
|
|
20
|
+
"""Manage this item's unmentioned properties"""
|
|
21
|
+
MANAGE_ICON = 0x0100
|
|
22
|
+
"""Manage this item's icon"""
|
|
23
|
+
QUERY_REPORTS = 0x0200
|
|
24
|
+
"""Query this item's reports or messages"""
|
|
25
|
+
MANAGE_ACL = 0x0400
|
|
26
|
+
"""Manage this item's ACL propagated objects"""
|
|
27
|
+
MANAGE_ITEM_LOG = 0x0800
|
|
28
|
+
"""Manage this item's log"""
|
|
29
|
+
VIEW_ADMIN_FIELDS = 0x1000
|
|
30
|
+
"""View this item's administrative fields"""
|
|
31
|
+
MANAGE_ADMIN_FIELDS = 0x2000
|
|
32
|
+
"""Manage this item's administrative fields"""
|
|
33
|
+
VIEW_ATTACHED_FILES = 0x4000
|
|
34
|
+
"""View this item's attached files"""
|
|
35
|
+
MANAGE_ATTACHED_FILES = 0x8000
|
|
36
|
+
"""Manage this item's attached files"""
|
|
37
|
+
UNIT_MANAGE_CONNECTIVITY = 0x0000100000
|
|
38
|
+
"""Manage this unit/group's connectivity settings"""
|
|
39
|
+
UNIT_MANAGE_SENSORS = 0x0000200000
|
|
40
|
+
"""Manage this unit/group's sensors"""
|
|
41
|
+
UNIT_MANAGE_COUNTERS = 0x0000400000
|
|
42
|
+
"""Manage this unit/group's counters"""
|
|
43
|
+
UNIT_DELETE_MESSAGES = 0x0000800000
|
|
44
|
+
"""Delete this unit/group's messages"""
|
|
45
|
+
UNIT_EXECUTE_COMMANDS = 0x0001000000
|
|
46
|
+
"""Execute this unit/group's commands"""
|
|
47
|
+
UNIT_REGISTER_EVENTS = 0x0002000000
|
|
48
|
+
"""Register this unit/group's events"""
|
|
49
|
+
UNIT_VIEW_CONNECTIVITY = 0x0004000000
|
|
50
|
+
"""View this unit/group's connectivity settings"""
|
|
51
|
+
UNIT_VIEW_SERVICE_INTERVALS = 0x0010000000
|
|
52
|
+
"""View this unit/group's service intervals"""
|
|
53
|
+
UNIT_MANAGE_SERVICE_INTERVALS = 0x0020000000
|
|
54
|
+
"""Manage this unit/group's service intervals"""
|
|
55
|
+
UNIT_IMPORT_MESSAGES = 0x0040000000
|
|
56
|
+
"""Import this unit/group's messages"""
|
|
57
|
+
UNIT_EXPORT_MESSAGES = 0x0080000000
|
|
58
|
+
"""Export this unit/group's messages"""
|
|
59
|
+
UNIT_VIEW_COMMANDS = 0x0400000000
|
|
60
|
+
"""View this unit/group's commands"""
|
|
61
|
+
UNIT_MANAGE_COMMANDS = 0x0800000000
|
|
62
|
+
"""Manage this unit/group's commands"""
|
|
63
|
+
UNIT_MANAGE_TRIP_DETECTOR = 0x4000000000
|
|
64
|
+
"""Manage this unit/group's trip detector and fuel consumption"""
|
|
65
|
+
UNIT_MANAGE_ASSIGNMENTS = 0x8000000000
|
|
66
|
+
"""Manage this unit/group's job, notification, route, and retranslator assignments"""
|
|
67
|
+
USER_MANAGE_ACCESS_RIGHTS = 0x100000
|
|
68
|
+
"""Manage this user's access rights"""
|
|
69
|
+
USER_ACT_AS_OTHER = 0x200000
|
|
70
|
+
"""Can assume the identity of this user (login as)"""
|
|
71
|
+
USER_MANAGE_FLAGS = 0x400000
|
|
72
|
+
"""Manage this user's access flags"""
|
|
73
|
+
USER_VIEW_PUSH_MESSAGES = 0x800000
|
|
74
|
+
"""View this user's push messages"""
|
|
75
|
+
USER_MANAGE_PUSH_MESSAGES = 0x1000000
|
|
76
|
+
"""Manage this user's push messages"""
|
|
77
|
+
RETRANSLATOR_MANAGE_PROPERTIES = 0x100000
|
|
78
|
+
"""Manage this retranslator's properties (including start/stop)"""
|
|
79
|
+
RETRANSLATOR_MANAGE_UNITS = 0x2000000
|
|
80
|
+
"""Manage this retranslator's available units"""
|
|
81
|
+
RESOURCE_VIEW_NOTIFICATIONS = 0x0000000100000
|
|
82
|
+
"""View this resource's notifications"""
|
|
83
|
+
RESOURCE_MANAGE_NOTIFICATIONS = 0x0000000200000
|
|
84
|
+
"""Manage this resource's notifications"""
|
|
85
|
+
RESOURCE_VIEW_POIS = 0x0000000400000
|
|
86
|
+
"""View this resource's points of interest"""
|
|
87
|
+
RESOURCE_MANAGE_POIS = 0x0000000800000
|
|
88
|
+
"""Manage this resource's points of interest"""
|
|
89
|
+
RESOURCE_VIEW_GEOFENCES = 0x0000001000000
|
|
90
|
+
"""View this resource's geofences"""
|
|
91
|
+
RESOURCE_MANAGE_GEOFENCES = 0x0000002000000
|
|
92
|
+
"""Manage this resource's geofences"""
|
|
93
|
+
RESOURCE_VIEW_JOBS = 0x0000004000000
|
|
94
|
+
"""View this resource's jobs"""
|
|
95
|
+
RESOURCE_MANAGE_JOBS = 0x0000008000000
|
|
96
|
+
"""Manage this resource's jobs"""
|
|
97
|
+
RESOURCE_VIEW_REPORT_TEMPLATES = 0x0000010000000
|
|
98
|
+
"""View this resource's report templates"""
|
|
99
|
+
RESOURCE_MANAGE_REPORT_TEMPLATES = 0x0000020000000
|
|
100
|
+
"""Manage this resource's report templates"""
|
|
101
|
+
RESOURCE_VIEW_DRIVERS = 0x0000040000000
|
|
102
|
+
"""View this resource's drivers"""
|
|
103
|
+
RESOURCE_MANAGE_DRIVERS = 0x0000080000000
|
|
104
|
+
"""Manage this resource's drivers"""
|
|
105
|
+
RESOURCE_MANAGE_ACCOUNT = 0x0000100000000
|
|
106
|
+
"""Manage this resource's account"""
|
|
107
|
+
RESOURCE_VIEW_ORDERS = 0x0000200000000
|
|
108
|
+
"""View this resource's orders"""
|
|
109
|
+
RESOURCE_MANAGE_ORDERS = 0x0000400000000
|
|
110
|
+
"""Manage this resource's orders"""
|
|
111
|
+
RESOURCE_VIEW_TRAILERS = 0x0100000000000
|
|
112
|
+
"""View this resource's trailers"""
|
|
113
|
+
RESOURCE_MANAGE_TRAILERS = 0x0200000000000
|
|
114
|
+
"""Manage this resource's trailers"""
|
|
115
|
+
ROUTE_MANAGE_ROUTE = 0x0000000100000
|
|
116
|
+
"""Manage this route's properties"""
|
|
117
|
+
FULL_ACCESS = 0xFFFFFFFFFFFFFFF
|
|
118
|
+
"""Sets all possible access flags to an item"""
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class DataFlag(enum.Flag):
|
|
122
|
+
RESOURCE_BASE = 0x00000001
|
|
123
|
+
"""This resource's basic properties"""
|
|
124
|
+
RESOURCE_CUSTOM_PROPERTIES = 0x00000002
|
|
125
|
+
"""This resource's custom properties"""
|
|
126
|
+
RESOURCE_BILLING_PROPERTIES = 0x00000004
|
|
127
|
+
"""This resource's billing properties"""
|
|
128
|
+
RESOURCE_CUSTOM_FIELDS = 0x00000008
|
|
129
|
+
"""This resource's custom fields"""
|
|
130
|
+
RESOURCE_MESSAGES = 0x00000020
|
|
131
|
+
"""This resource's messages"""
|
|
132
|
+
RESOURCE_GUID = 0x00000040
|
|
133
|
+
"""This resource's GUID"""
|
|
134
|
+
RESOURCE_ADMIN_FIELDS = 0x00000080
|
|
135
|
+
"""This resources administrative fields"""
|
|
136
|
+
RESOURCE_DRIVERS = 0x00000100
|
|
137
|
+
"""This resource's drivers"""
|
|
138
|
+
RESOURCE_JOBS = 0x00000200
|
|
139
|
+
"""This resource's jobs"""
|
|
140
|
+
RESOURCE_NOTIFICATIONS = 0x00000400
|
|
141
|
+
"""This resource's notifications"""
|
|
142
|
+
RESOURCE_POIS = 0x00000800
|
|
143
|
+
"""This resouce's points of interest"""
|
|
144
|
+
RESOURCE_GEOFENCES = 0x00001000
|
|
145
|
+
"""This resource's geofences"""
|
|
146
|
+
RESOURCE_REPORT_TEMPLATES = 0x00002000
|
|
147
|
+
"""This resource's report templates"""
|
|
148
|
+
RESOURCE_DRIVER_ATTACHABLE_UNITS = 0x00004000
|
|
149
|
+
"""This resource's units allowed for driver attachment"""
|
|
150
|
+
RESOURCE_DRIVER_GROUPS = 0x00008000
|
|
151
|
+
"""This resource's driver groups"""
|
|
152
|
+
RESOURCE_TRAILERS = 0x00010000
|
|
153
|
+
"""This resource's trailers"""
|
|
154
|
+
RESOURCE_TRAILER_GROUPS = 0x00020000
|
|
155
|
+
"""This resource's trailer groups"""
|
|
156
|
+
RESOURCE_TRAILER_ATTACHABLE_UNITS = 0x00040000
|
|
157
|
+
"""This resource's units allowed for trailer attachment"""
|
|
158
|
+
RESOURCE_ORDERS = 0x00080000
|
|
159
|
+
"""This resource's orders"""
|
|
160
|
+
RESOURCE_GEOFENCE_GROUPS = 0x00100000
|
|
161
|
+
"""This resource's geofence groups"""
|
|
162
|
+
RESOURCE_TAGS = 0x00200000
|
|
163
|
+
"""This resource's tags (passengers)"""
|
|
164
|
+
RESOURCE_TAG_ATTACHABLE_UNITS = 0x00400000
|
|
165
|
+
"""This resource's units allowed for tag attachment"""
|
|
166
|
+
RESOURCE_TAG_GROUPS = 0x00800000
|
|
167
|
+
"""This resource's tag groups (passengers)"""
|
|
168
|
+
RESOURCE_ALL = 4611686018427387903
|
|
169
|
+
"""All possible resource data flags"""
|
|
170
|
+
RETRANSLATOR_BASE = 0x00000001
|
|
171
|
+
"""This retranslator's basic properties"""
|
|
172
|
+
RETRANSLATOR_CUSTOM_PROPERTIES = 0x00000002
|
|
173
|
+
"""This retranslator's custom properties"""
|
|
174
|
+
RETRANSLATOR_BILLING_PROPERTIES = 0x00000004
|
|
175
|
+
"""This retranslator's billing properties"""
|
|
176
|
+
RETRANSLATOR_GUID = 0x00000040
|
|
177
|
+
"""This retranslator's GUID"""
|
|
178
|
+
RETRANSLATOR_ADMIN_FIELDS = 0x00000080
|
|
179
|
+
"""This retranslator's admin fields"""
|
|
180
|
+
RETRANSLATOR_CONFIGURATION = 0x00000100
|
|
181
|
+
"""This retranslator's state and configuration"""
|
|
182
|
+
RETRANSLATOR_UNITS = 0x00000200
|
|
183
|
+
"""This retranslator's bound units"""
|
|
184
|
+
RETRANSLATOR_ALL = 4611686018427387903
|
|
185
|
+
"""All possible retranslator data flags"""
|
|
186
|
+
ROUTE_BASE = 0x00000001
|
|
187
|
+
"""This route's basic properties"""
|
|
188
|
+
ROUTE_CUSTOM_PROPERTIES = 0x00000002
|
|
189
|
+
"""This route's custom properties"""
|
|
190
|
+
ROUTE_BILLING_PROPERTIES = 0x00000004
|
|
191
|
+
"""This route's billing properties"""
|
|
192
|
+
ROUTE_GUID = 0x00000040
|
|
193
|
+
"""This route's GUID"""
|
|
194
|
+
ROUTE_ADMIN_FIELDS = 0x00000080
|
|
195
|
+
"""This route's administrative fields"""
|
|
196
|
+
ROUTE_CONFIGURATION = 0x00000100
|
|
197
|
+
"""This route's configuration"""
|
|
198
|
+
ROUTE_CHECKPOINTS = 0x00000200
|
|
199
|
+
"""This route's checkpoints"""
|
|
200
|
+
ROUTE_SCHEDULES = 0x00000400
|
|
201
|
+
"""This route's schedules"""
|
|
202
|
+
ROUTE_ROUNDS = 0x00000800
|
|
203
|
+
"""This route's rounds"""
|
|
204
|
+
ROUTE_ALL = 4611686018427387903
|
|
205
|
+
"""All possible route data flags"""
|
|
206
|
+
UNIT_BASE = 0x00000001
|
|
207
|
+
"""This unit's basic properties"""
|
|
208
|
+
UNIT_CUSTOM_PROPERTIES = 0x00000002
|
|
209
|
+
"""This unit's custom properties"""
|
|
210
|
+
UNIT_BILLING_PROPERTIES = 0x00000004
|
|
211
|
+
"""This unit's billing properties"""
|
|
212
|
+
UNIT_CUSTOM_FIELDS = 0x00000008
|
|
213
|
+
"""This unit's custom fields"""
|
|
214
|
+
UNIT_IMAGE = 0x00000010
|
|
215
|
+
"""This unit's image/icon"""
|
|
216
|
+
UNIT_MESSAGES = 0x00000020
|
|
217
|
+
"""This unit's messages"""
|
|
218
|
+
UNIT_GUID = 0x00000040
|
|
219
|
+
"""This unit's GUID"""
|
|
220
|
+
UNIT_ADMIN_FIELDS = 0x00000080
|
|
221
|
+
"""This unit's administrative fields"""
|
|
222
|
+
UNIT_ADVANCED_PROPERTIES = 0x00000100
|
|
223
|
+
"""This unit's advanced properties"""
|
|
224
|
+
UNIT_CURRENT_MOMENT_COMMANDS = 0x00000200
|
|
225
|
+
"""This unit's available for current moment commands"""
|
|
226
|
+
UNIT_LAST_MESSAGE = 0x00000400
|
|
227
|
+
"""This unit's last message and position"""
|
|
228
|
+
UNIT_SENSORS = 0x00001000
|
|
229
|
+
"""This unit's sensors"""
|
|
230
|
+
UNIT_COUNTERS = 0x00002000
|
|
231
|
+
"""This unit's counters"""
|
|
232
|
+
UNIT_MAINTENANCE = 0x00008000
|
|
233
|
+
"""This unit's maintenance"""
|
|
234
|
+
UNIT_REPORT_CONFIGURATION = 0x00020000
|
|
235
|
+
"""This unit's report configuration, trip detector, and fuel consumption"""
|
|
236
|
+
UNIT_AVAILABLE_COMMANDS = 0x00080000
|
|
237
|
+
"""This unit's available commands"""
|
|
238
|
+
UNIT_MESSAGE_PARAMETERS = 0x00100000
|
|
239
|
+
"""This unit's message parameters"""
|
|
240
|
+
UNIT_CONNECTION_STATUS = 0x00200000
|
|
241
|
+
"""This unit's connection status"""
|
|
242
|
+
UNIT_POSITION = 0x00400000
|
|
243
|
+
"""This unit's position"""
|
|
244
|
+
UNIT_PROFILE_FIELDS = 0x00800000
|
|
245
|
+
"""This unit's profile files"""
|
|
246
|
+
UNIT_ALL = 4611686018427387903
|
|
247
|
+
"""All possible unit data flags"""
|
|
248
|
+
GROUP_BASE = 0x00000001
|
|
249
|
+
"""This group's basic properties"""
|
|
250
|
+
GROUP_CUSTOM_PROPERTIES = 0x00000002
|
|
251
|
+
"""This group's custom properties"""
|
|
252
|
+
GROUP_BILLING_PROPERTIES = 0x00000004
|
|
253
|
+
"""This group's billing properties"""
|
|
254
|
+
GROUP_CUSTOM_FIELDS = 0x00000008
|
|
255
|
+
"""This group's custom fields"""
|
|
256
|
+
GROUP_IMAGE = 0x00000010
|
|
257
|
+
"""This group's image/icon"""
|
|
258
|
+
GROUP_GUID = 0x00000040
|
|
259
|
+
"""This group's GUID"""
|
|
260
|
+
GROUP_ADMIN_FIELDS = 0x00000080
|
|
261
|
+
"""This group's administrative fields"""
|
|
262
|
+
GROUP_ALL = 4611686018427387903
|
|
263
|
+
"""All possible group data flags"""
|
|
264
|
+
USER_BASE = 0x00000001
|
|
265
|
+
"""This user's basic properties"""
|
|
266
|
+
USER_CUSTOM_PROPERTIES = 0x00000002
|
|
267
|
+
"""This user's custom properties"""
|
|
268
|
+
USER_BILLING_PROPERTIES = 0x00000004
|
|
269
|
+
"""This user's billing properties"""
|
|
270
|
+
USER_CUSTOM_FIELDS = 0x00000008
|
|
271
|
+
"""This user's custom fields"""
|
|
272
|
+
USER_MESSAGES = 0x00000020
|
|
273
|
+
"""This user's messages"""
|
|
274
|
+
USER_GUID = 0x00000040
|
|
275
|
+
"""This user's GUID"""
|
|
276
|
+
USER_ADMIN_FIELDS = 0x00000080
|
|
277
|
+
"""This user's administrative fields"""
|
|
278
|
+
USER_OTHER_PROPERTIES = 0x00000100
|
|
279
|
+
"""This user's other properties"""
|
|
280
|
+
USER_NOTIFICATIONS = 0x00000200
|
|
281
|
+
"""This user's notifications"""
|
|
282
|
+
USER_ALL = 4611686018427387903
|
|
283
|
+
"""All possible user data flags"""
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
class SettingsFlag(enum.Flag):
|
|
287
|
+
USER_DISABLED = 0x01
|
|
288
|
+
"""This user is disabled"""
|
|
289
|
+
USER_CANNOT_CHANGE_PASSWORD = 0x02
|
|
290
|
+
"""This user cannot change their password"""
|
|
291
|
+
USER_CAN_CREATE_ITEMS = 0x04
|
|
292
|
+
"""This user can create objects"""
|
|
293
|
+
USER_CANNOT_CHANGE_SETTINGS = 0x10
|
|
294
|
+
"""This user cannot change settings"""
|
|
295
|
+
USER_CAN_SEND_SMS = 0x20
|
|
296
|
+
"""This user can send SMS messages"""
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
class TokenFlag(enum.Flag):
|
|
300
|
+
ONLINE_TRACKING = 0x100
|
|
301
|
+
"""Online tracking"""
|
|
302
|
+
VIEW_ACCESS = 0x200
|
|
303
|
+
"""View access to most data"""
|
|
304
|
+
MANAGE_NONSENSITIVE = 0x400
|
|
305
|
+
"""Modification of non-sensitive data"""
|
|
306
|
+
MANAGE_SENSITIVE = 0x800
|
|
307
|
+
"""Modification of sensitive data"""
|
|
308
|
+
MANAGE_CRITICAL = 0x1000
|
|
309
|
+
"""Modification of critical data, including message deletion"""
|
|
310
|
+
COMMUNICATION = 0x2000
|
|
311
|
+
"""Modification of communication data"""
|
|
312
|
+
MANAGE_ALL = -1
|
|
313
|
+
"""Unlimited operation as authorized user"""
|
|
314
|
+
|
|
315
|
+
|
|
1
316
|
# Access flags
|
|
2
317
|
## General - https://sdk.wialon.com/wiki/en/sidebar/remoteapi/apiref/core/check_items_billing#general
|
|
3
318
|
ACCESSFLAG_VIEW_ITEM_BASIC = 0x0001
|
terminusgps/wialon/items/base.py
CHANGED
|
@@ -22,7 +22,7 @@ class WialonBase:
|
|
|
22
22
|
def populate(self) -> None:
|
|
23
23
|
"""Retrieves and saves the latest data for the item from Wialon."""
|
|
24
24
|
response = self.session.wialon_api.core_search_item(
|
|
25
|
-
**{"id": str(self.id), "flags":
|
|
25
|
+
**{"id": str(self.id), "flags": flags.DataFlag.UNIT_BASE.value}
|
|
26
26
|
)
|
|
27
27
|
if response is not None:
|
|
28
28
|
item = response.get("item", {})
|
|
@@ -205,7 +205,7 @@ class WialonBase:
|
|
|
205
205
|
def cfields(self) -> dict[str, str]:
|
|
206
206
|
"""Custom fields for the Wialon object."""
|
|
207
207
|
response = self.session.wialon_api.core_search_item(
|
|
208
|
-
**{"id": self.id, "flags": flags.
|
|
208
|
+
**{"id": self.id, "flags": flags.DataFlag.UNIT_CUSTOM_FIELDS.value}
|
|
209
209
|
)
|
|
210
210
|
fields = response.get("item", {}).get("flds") if response is not None else {}
|
|
211
211
|
return {field["n"]: field["v"] for field in fields.values()} if fields else {}
|
|
@@ -214,7 +214,7 @@ class WialonBase:
|
|
|
214
214
|
def afields(self) -> dict[str, str]:
|
|
215
215
|
"""Admin fields for the Wialon object."""
|
|
216
216
|
response = self.session.wialon_api.core_search_item(
|
|
217
|
-
**{"id": self.id, "flags": flags.
|
|
217
|
+
**{"id": self.id, "flags": flags.DataFlag.UNIT_ADMIN_FIELDS.value}
|
|
218
218
|
)
|
|
219
219
|
fields = response.get("item", {}).get("aflds") if response is not None else {}
|
|
220
220
|
return {field["n"]: field["v"] for field in fields.values()} if fields else {}
|
|
@@ -30,7 +30,7 @@ class WialonResource(WialonBase):
|
|
|
30
30
|
**{
|
|
31
31
|
"creatorId": creator_id,
|
|
32
32
|
"name": name,
|
|
33
|
-
"dataFlags": flags.
|
|
33
|
+
"dataFlags": flags.DataFlag.UNIT_BASE.value,
|
|
34
34
|
"skipCreatorCheck": int(skip_creator_check),
|
|
35
35
|
}
|
|
36
36
|
)
|
|
@@ -81,7 +81,7 @@ class WialonResource(WialonBase):
|
|
|
81
81
|
|
|
82
82
|
"""
|
|
83
83
|
response = self.session.wialon_api.core_search_item(
|
|
84
|
-
**{"id": self.id, "flags": flags.
|
|
84
|
+
**{"id": self.id, "flags": flags.DataFlag.RESOURCE_BILLING_PROPERTIES.value}
|
|
85
85
|
)
|
|
86
86
|
return int(response.get("item", {}).get("bact")) == self.id
|
|
87
87
|
|
terminusgps/wialon/items/unit.py
CHANGED
|
@@ -33,7 +33,7 @@ class WialonUnit(WialonBase):
|
|
|
33
33
|
"creatorId": creator_id,
|
|
34
34
|
"name": name,
|
|
35
35
|
"hwTypeId": hw_type_id,
|
|
36
|
-
"dataFlags": flags.
|
|
36
|
+
"dataFlags": flags.DataFlag.UNIT_BASE,
|
|
37
37
|
}
|
|
38
38
|
)
|
|
39
39
|
return (
|
|
@@ -47,9 +47,9 @@ class WialonUnit(WialonBase):
|
|
|
47
47
|
response = self.session.wialon_api.core_search_item(
|
|
48
48
|
**{
|
|
49
49
|
"id": self.id,
|
|
50
|
-
"flags":
|
|
51
|
-
|
|
52
|
-
),
|
|
50
|
+
"flags": (
|
|
51
|
+
flags.DataFlag.UNIT_ADVANCED_PROPERTIES | flags.DataFlag.UNIT_IMAGE
|
|
52
|
+
).value,
|
|
53
53
|
}
|
|
54
54
|
)
|
|
55
55
|
if response:
|
|
@@ -60,7 +60,7 @@ class WialonUnit(WialonBase):
|
|
|
60
60
|
|
|
61
61
|
def get_position(self) -> dict | None:
|
|
62
62
|
return self.session.wialon_api.core_search_item(
|
|
63
|
-
**{"id": self.id, "flags": flags.
|
|
63
|
+
**{"id": self.id, "flags": flags.DataFlag.UNIT_POSITION.value}
|
|
64
64
|
)
|
|
65
65
|
|
|
66
66
|
@property
|
|
@@ -73,7 +73,7 @@ class WialonUnit(WialonBase):
|
|
|
73
73
|
"""Whether or not the unit exists in Wialon."""
|
|
74
74
|
return bool(
|
|
75
75
|
self.session.wialon_api.core_search_item(
|
|
76
|
-
**{"id": self.id, "flags": flags.
|
|
76
|
+
**{"id": self.id, "flags": flags.DataFlag.UNIT_BASE.value}
|
|
77
77
|
).get("item", False)
|
|
78
78
|
)
|
|
79
79
|
|
|
@@ -24,7 +24,7 @@ class WialonUnitGroup(WialonBase):
|
|
|
24
24
|
**{
|
|
25
25
|
"creatorId": creator_id,
|
|
26
26
|
"name": name,
|
|
27
|
-
"dataFlags": flags.
|
|
27
|
+
"dataFlags": flags.DataFlag.UNIT_BASE.value,
|
|
28
28
|
}
|
|
29
29
|
)
|
|
30
30
|
return (
|
|
@@ -111,7 +111,7 @@ class WialonUnitGroup(WialonBase):
|
|
|
111
111
|
"or_logic": 0,
|
|
112
112
|
},
|
|
113
113
|
"force": 1,
|
|
114
|
-
"flags": flags.
|
|
114
|
+
"flags": flags.DataFlag.UNIT_BASE.value,
|
|
115
115
|
"from": 0,
|
|
116
116
|
"to": 0,
|
|
117
117
|
}
|
terminusgps/wialon/items/user.py
CHANGED
|
@@ -26,10 +26,10 @@ class WialonUser(WialonBase):
|
|
|
26
26
|
|
|
27
27
|
response = self.session.wialon_api.core_create_user(
|
|
28
28
|
**{
|
|
29
|
-
"creatorId": creator_id,
|
|
29
|
+
"creatorId": str(creator_id),
|
|
30
30
|
"name": name,
|
|
31
31
|
"password": password,
|
|
32
|
-
"dataFlags": flags.
|
|
32
|
+
"dataFlags": str(flags.DataFlag.UNIT_BASE.value),
|
|
33
33
|
}
|
|
34
34
|
)
|
|
35
35
|
return (
|
|
@@ -110,7 +110,7 @@ class WialonUser(WialonBase):
|
|
|
110
110
|
:rtype: :py:obj:`None`
|
|
111
111
|
|
|
112
112
|
"""
|
|
113
|
-
self.add_cproperty(
|
|
113
|
+
self.add_cproperty("phone", quote_plus(phone))
|
|
114
114
|
|
|
115
115
|
def assign_email(self, email: str) -> None:
|
|
116
116
|
"""
|
|
@@ -123,7 +123,7 @@ class WialonUser(WialonBase):
|
|
|
123
123
|
:rtype: :py:obj:`None`
|
|
124
124
|
|
|
125
125
|
"""
|
|
126
|
-
self.add_cproperty(
|
|
126
|
+
self.add_cproperty("email", email)
|
|
127
127
|
|
|
128
128
|
def grant_access(
|
|
129
129
|
self, item: WialonBase, access_mask: int = constants.ACCESSMASK_UNIT_BASIC
|
terminusgps/wialon/utils.py
CHANGED
|
@@ -2,8 +2,7 @@ import secrets
|
|
|
2
2
|
import string
|
|
3
3
|
import typing
|
|
4
4
|
|
|
5
|
-
from terminusgps.wialon import
|
|
6
|
-
from terminusgps.wialon.items.base import WialonBase
|
|
5
|
+
from terminusgps.wialon import constants, flags
|
|
7
6
|
from terminusgps.wialon.session import WialonSession
|
|
8
7
|
|
|
9
8
|
|
|
@@ -90,7 +89,7 @@ def get_id_from_imei(imei: str, session: WialonSession) -> str | None:
|
|
|
90
89
|
"or_logic": 0,
|
|
91
90
|
},
|
|
92
91
|
"force": 0,
|
|
93
|
-
"flags": flags.
|
|
92
|
+
"flags": flags.DataFlag.UNIT_BASE.value,
|
|
94
93
|
"from": 0,
|
|
95
94
|
"to": 0,
|
|
96
95
|
}
|
|
@@ -100,45 +99,6 @@ def get_id_from_imei(imei: str, session: WialonSession) -> str | None:
|
|
|
100
99
|
return results["items"][0].get("id")
|
|
101
100
|
|
|
102
101
|
|
|
103
|
-
def get_id_from_iccid(iccid: str, session: WialonSession) -> str | None:
|
|
104
|
-
"""
|
|
105
|
-
DEPRECATED: Use :py:func:`~terminusgps.wialon.utils.get_id_from_imei`.
|
|
106
|
-
|
|
107
|
-
Takes a Wialon unit's IMEI # and returns its unit id, if it exists.
|
|
108
|
-
|
|
109
|
-
:param iccid: A unique id.
|
|
110
|
-
:type iccid: :py:obj:`str`
|
|
111
|
-
:param session: A valid Wialon API session.
|
|
112
|
-
:type session: :py:obj:`~terminusgps.wialon.session.WialonSession`
|
|
113
|
-
:raises WialonError: If something goes wrong during a Wialon API call.
|
|
114
|
-
:returns: A Wialon object id, if it was found.
|
|
115
|
-
:rtype: :py:obj:`str` | :py:obj:`None`
|
|
116
|
-
|
|
117
|
-
"""
|
|
118
|
-
return get_id_from_imei(imei=iccid, session=session)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
def get_wialon_cls(items_type: str) -> typing.Type[WialonBase] | None:
|
|
122
|
-
"""
|
|
123
|
-
Returns a Wialon object class based on ``items_type``.
|
|
124
|
-
|
|
125
|
-
Valid ``items_type`` are ``"user"``, ``"avl_unit"``, ``"avl_unit_group"`` and ``"avl_resource"``.
|
|
126
|
-
|
|
127
|
-
:param items_type: A Wialon object type.
|
|
128
|
-
:type items_type: :py:obj:`str`
|
|
129
|
-
:returns: A subclass of :py:obj:`~terminusgps.wialon.items.base.WialonBase`.
|
|
130
|
-
:rtype: :py:obj:`~terminusgps.wialon.items.base.WialonBase` | :py:obj:`None`
|
|
131
|
-
|
|
132
|
-
"""
|
|
133
|
-
items_map: dict[str, typing.Type[WialonBase]] = {
|
|
134
|
-
"user": items.WialonUser,
|
|
135
|
-
"avl_unit": items.WialonUnit,
|
|
136
|
-
"avl_unit_group": items.WialonUnitGroup,
|
|
137
|
-
"avl_resource": items.WialonResource,
|
|
138
|
-
}
|
|
139
|
-
return items_map.get(items_type)
|
|
140
|
-
|
|
141
|
-
|
|
142
102
|
def get_vin_info(vin_number: str, session: WialonSession) -> dict:
|
|
143
103
|
"""
|
|
144
104
|
Retrieves vehicle data from a VIN number.
|
|
@@ -164,7 +124,11 @@ def get_vin_info(vin_number: str, session: WialonSession) -> dict:
|
|
|
164
124
|
}
|
|
165
125
|
|
|
166
126
|
|
|
167
|
-
def is_unique(
|
|
127
|
+
def is_unique(
|
|
128
|
+
value: str,
|
|
129
|
+
session: WialonSession,
|
|
130
|
+
items_type: str = constants.WialonItemsType.UNIT.value,
|
|
131
|
+
) -> bool:
|
|
168
132
|
"""
|
|
169
133
|
Determines if the value is unique among Wialon objects of type 'items_type'.
|
|
170
134
|
|
|
File without changes
|
{python_terminusgps-28.11.0.dist-info → python_terminusgps-29.0.0.dist-info}/licenses/COPYING
RENAMED
|
File without changes
|