Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
micropython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
micropython
Commits
6837dba6
Commit
6837dba6
authored
Apr 10, 2016
by
Paul Sokolovsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extmod/modwebsocket: Allow to get type of last read data using ioctl().
parent
0c97e4c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
extmod/modwebsocket.c
extmod/modwebsocket.c
+13
-0
No files found.
extmod/modwebsocket.c
View file @
6837dba6
...
...
@@ -207,15 +207,28 @@ STATIC mp_uint_t websocket_write(mp_obj_t self_in, const void *buf, mp_uint_t si
return
out_sz
;
}
STATIC
mp_uint_t
websocket_ioctl
(
mp_obj_t
self_in
,
mp_uint_t
request
,
uintptr_t
arg
,
int
*
errcode
)
{
mp_obj_websocket_t
*
self
=
MP_OBJ_TO_PTR
(
self_in
);
switch
(
request
)
{
case
MP_STREAM_GET_DATA_OPTS
:
return
self
->
ws_flags
&
FRAME_OPCODE_MASK
;
default:
*
errcode
=
EINVAL
;
return
MP_STREAM_ERROR
;
}
}
STATIC
const
mp_map_elem_t
websocket_locals_dict_table
[]
=
{
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_read
),
(
mp_obj_t
)
&
mp_stream_read_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_write
),
(
mp_obj_t
)
&
mp_stream_write_obj
},
{
MP_OBJ_NEW_QSTR
(
MP_QSTR_ioctl
),
(
mp_obj_t
)
&
mp_stream_ioctl_obj
},
};
STATIC
MP_DEFINE_CONST_DICT
(
websocket_locals_dict
,
websocket_locals_dict_table
);
STATIC
const
mp_stream_p_t
websocket_stream_p
=
{
.
read
=
websocket_read
,
.
write
=
websocket_write
,
.
ioctl
=
websocket_ioctl
,
};
STATIC
const
mp_obj_type_t
websocket_type
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment