FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
erpc/erpc_python/erpc/codec.py at main · EmbeddedRPC/erpc · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
EmbeddedRPC
/
erpc
Public
Notifications
You must be signed in to change notification settings
Fork
257
Star
951
Code
Issues
111
Pull requests
23
Actions
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
erpc
/
erpc_python
/
erpc
/
codec.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
160 lines (110 loc) · 3.89 KB
Breadcrumbs
erpc
/
erpc_python
/
erpc
/
codec.py
Copy path
File metadata and controls
160 lines (110 loc) · 3.89 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#!/usr/bin/env python
# Copyright (c) 2015-2016 Freescale Semiconductor, Inc.
# Copyright 2016-2025 NXP
#
# SPDX-License-Identifier: BSD-3-Clause
from
enum
import
Enum
from
typing
import
NamedTuple
class
MessageType
(
Enum
):
kInvocationMessage
=
0
kOnewayMessage
=
1
kReplyMessage
=
2
kNotificationMessage
=
3
MessageInfo
=
NamedTuple
(
'MessageInfo'
, [(
'type'
,
MessageType
), (
'service'
,
int
), (
'request'
,
int
), (
'sequence'
,
int
)])
class
CodecError
(
RuntimeError
):
pass
class
Codec
:
def
__init__
(
self
):
self
.
_buffer
=
bytearray
()
self
.
_cursor
=
0
@
property
def
buffer
(
self
)
->
bytearray
:
return
self
.
_buffer
@
buffer
.
setter
def
buffer
(
self
,
buf
:
bytearray
):
self
.
_buffer
=
buf
self
.
_cursor
=
0
def
reset
(
self
):
self
.
_buffer
=
bytearray
()
self
.
_cursor
=
0
def
start_write_message
(
self
,
msgInfo
:
MessageInfo
)
->
None
:
raise
NotImplementedError
()
def
write_bool
(
self
,
value
:
bool
)
->
None
:
raise
NotImplementedError
()
def
write_int8
(
self
,
value
:
int
)
->
None
:
raise
NotImplementedError
()
def
write_int16
(
self
,
value
:
int
)
->
None
:
raise
NotImplementedError
()
def
write_int32
(
self
,
value
:
int
)
->
None
:
raise
NotImplementedError
()
def
write_int64
(
self
,
value
:
int
)
->
None
:
raise
NotImplementedError
()
def
write_uint8
(
self
,
value
:
int
)
->
None
:
raise
NotImplementedError
()
def
write_uint16
(
self
,
value
:
int
)
->
None
:
raise
NotImplementedError
()
def
write_uint32
(
self
,
value
:
int
)
->
None
:
raise
NotImplementedError
()
def
write_uint64
(
self
,
value
:
int
)
->
None
:
raise
NotImplementedError
()
def
write_float
(
self
,
value
:
float
)
->
None
:
raise
NotImplementedError
()
def
write_double
(
self
,
value
:
float
)
->
None
:
raise
NotImplementedError
()
def
write_string
(
self
,
value
:
str
)
->
None
:
raise
NotImplementedError
()
def
write_binary
(
self
,
value
:
bytes
)
->
None
:
raise
NotImplementedError
()
def
start_write_list
(
self
,
length
:
int
)
->
None
:
raise
NotImplementedError
()
def
start_write_union
(
self
,
discriminator
:
int
)
->
None
:
raise
NotImplementedError
()
def
write_null_flag
(
self
,
flag
:
int
)
->
None
:
raise
NotImplementedError
()
def
start_read_message
(
self
)
->
MessageInfo
:
""" Returns MessageInfo object.
Returns:
MessageInfo: MessageInfo object.
"""
raise
NotImplementedError
()
def
read_bool
(
self
)
->
bool
:
raise
NotImplementedError
()
def
read_int8
(
self
)
->
int
:
raise
NotImplementedError
()
def
read_int16
(
self
)
->
int
:
raise
NotImplementedError
()
def
read_int32
(
self
)
->
int
:
raise
NotImplementedError
()
def
read_int64
(
self
)
->
int
:
raise
NotImplementedError
()
def
read_uint8
(
self
)
->
int
:
raise
NotImplementedError
()
def
read_uint16
(
self
)
->
int
:
raise
NotImplementedError
()
def
read_uint32
(
self
)
->
int
:
raise
NotImplementedError
()
def
read_uint64
(
self
)
->
int
:
raise
NotImplementedError
()
def
read_float
(
self
)
->
float
:
raise
NotImplementedError
()
def
read_double
(
self
)
->
float
:
raise
NotImplementedError
()
def
read_string
(
self
)
->
str
:
raise
NotImplementedError
()
def
read_binary
(
self
)
->
bytearray
:
raise
NotImplementedError
()
def
start_read_list
(
self
)
->
int
:
""" Function which should be called on list de-serialization.
Returns:
int: Int of list length.
"""
raise
NotImplementedError
()
def
start_read_union
(
self
)
->
int
:
""" Function which should be called on union de-serialization.
Returns:
int: Int of union discriminator.
"""
raise
NotImplementedError
()
def
read_null_flag
(
self
)
->
int
:
raise
NotImplementedError
()
Back
|
FazBrowse Home
|
New Git URL