Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
镜像
Eclipse Foundation
paho.mqtt.python
提交
d8aa1c18
P
paho.mqtt.python
项目概览
镜像
/
Eclipse Foundation
/
paho.mqtt.python
10 个月 前同步成功
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
paho.mqtt.python
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d8aa1c18
编写于
7月 07, 2021
作者:
R
Roger A. Light
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'MhhhxX-decorators' into 1.6.x
上级
4e595817
d1b3c7d0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
72 addition
and
0 deletion
+72
-0
src/paho/mqtt/client.py
src/paho/mqtt/client.py
+72
-0
未找到文件。
src/paho/mqtt/client.py
浏览文件 @
d8aa1c18
...
...
@@ -1861,6 +1861,12 @@ class Client(object):
"""
self
.
_on_log
=
func
def
log_callback
(
self
):
def
decorator
(
func
):
self
.
on_log
=
func
return
func
return
decorator
@
property
def
on_connect
(
self
):
"""If implemented, called when the broker responds to our connection
...
...
@@ -1907,6 +1913,12 @@ class Client(object):
with
self
.
_callback_mutex
:
self
.
_on_connect
=
func
def
connect_callback
(
self
):
def
decorator
(
func
):
self
.
on_connect
=
func
return
func
return
decorator
@
property
def
on_subscribe
(
self
):
"""If implemented, called when the broker responds to a subscribe
...
...
@@ -1937,6 +1949,12 @@ class Client(object):
with
self
.
_callback_mutex
:
self
.
_on_subscribe
=
func
def
subscribe_callback
(
self
):
def
decorator
(
func
):
self
.
on_subscribe
=
func
return
func
return
decorator
@
property
def
on_message
(
self
):
"""If implemented, called when a message has been received on a topic
...
...
@@ -1962,6 +1980,12 @@ class Client(object):
with
self
.
_callback_mutex
:
self
.
_on_message
=
func
def
message_callback
(
self
):
def
decorator
(
func
):
self
.
on_message
=
func
return
func
return
decorator
@
property
def
on_publish
(
self
):
"""If implemented, called when a message that was to be sent using the
...
...
@@ -1989,6 +2013,12 @@ class Client(object):
with
self
.
_callback_mutex
:
self
.
_on_publish
=
func
def
publish_callback
(
self
):
def
decorator
(
func
):
self
.
on_publish
=
func
return
func
return
decorator
@
property
def
on_unsubscribe
(
self
):
"""If implemented, called when the broker responds to an unsubscribe
...
...
@@ -2017,6 +2047,12 @@ class Client(object):
with
self
.
_callback_mutex
:
self
.
_on_unsubscribe
=
func
def
unsubscribe_callback
(
self
):
def
decorator
(
func
):
self
.
on_unsubscribe
=
func
return
func
return
decorator
@
property
def
on_disconnect
(
self
):
"""If implemented, called when the client disconnects from the broker.
...
...
@@ -2044,6 +2080,12 @@ class Client(object):
with
self
.
_callback_mutex
:
self
.
_on_disconnect
=
func
def
disconnect_callback
(
self
):
def
decorator
(
func
):
self
.
on_disconnect
=
func
return
func
return
decorator
@
property
def
on_socket_open
(
self
):
"""If implemented, called just after the socket was opend."""
...
...
@@ -2065,6 +2107,12 @@ class Client(object):
with
self
.
_callback_mutex
:
self
.
_on_socket_open
=
func
def
socket_open_callback
(
self
):
def
decorator
(
func
):
self
.
on_socket_open
=
func
return
func
return
decorator
def
_call_socket_open
(
self
):
"""Call the socket_open callback with the just-opened socket"""
with
self
.
_callback_mutex
:
...
...
@@ -2099,6 +2147,12 @@ class Client(object):
with
self
.
_callback_mutex
:
self
.
_on_socket_close
=
func
def
socket_close_callback
(
self
):
def
decorator
(
func
):
self
.
on_socket_close
=
func
return
func
return
decorator
def
_call_socket_close
(
self
,
sock
):
"""Call the socket_close callback with the about-to-be-closed socket"""
with
self
.
_callback_mutex
:
...
...
@@ -2133,6 +2187,12 @@ class Client(object):
with
self
.
_callback_mutex
:
self
.
_on_socket_register_write
=
func
def
socket_register_write_callback
(
self
):
def
decorator
(
func
):
self
.
_on_socket_register_write
=
func
return
func
return
decorator
def
_call_socket_register_write
(
self
):
"""Call the socket_register_write callback with the unwritable socket"""
if
not
self
.
_sock
or
self
.
_registered_write
:
...
...
@@ -2170,6 +2230,12 @@ class Client(object):
with
self
.
_callback_mutex
:
self
.
_on_socket_unregister_write
=
func
def
socket_unregister_write_callback
(
self
):
def
decorator
(
func
):
self
.
_on_socket_unregister_write
=
func
return
func
return
decorator
def
_call_socket_unregister_write
(
self
,
sock
=
None
):
"""Call the socket_unregister_write callback with the writable socket"""
sock
=
sock
or
self
.
_sock
...
...
@@ -2204,6 +2270,12 @@ class Client(object):
with
self
.
_callback_mutex
:
self
.
_on_message_filtered
[
sub
]
=
callback
def
topic_callback
(
self
,
sub
):
def
decorator
(
func
):
self
.
message_callback_add
(
sub
,
func
)
return
func
return
decorator
def
message_callback_remove
(
self
,
sub
):
"""Remove a message callback previously registered with
message_callback_add()."""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录