Dphan/mqtt#31
Merged
Merged
Conversation
Closed
6 tasks
4b2f4f2 to
ef98203
Compare
4 tasks
8feea24 to
64d532c
Compare
64d532c to
ef75a86
Compare
8dca581 to
ea5beb8
Compare
Closed
ea5beb8 to
10d8531
Compare
ef75a86 to
dc8c163
Compare
10d8531 to
3face65
Compare
8b2f08e to
2cf0d65
Compare
3face65 to
9f6ad85
Compare
1a0fea6 to
a05e123
Compare
add functionality of subscribing and unsubscribing the mqtt messages with the callbacks that are executed on message receive
change order of functions and aling their names with underscores to indicate public, private or protected according to python standard also adds a comment regarding mqtt configuration parameter
Apigear offers client and server side for objects, mqtt offers only mqtt client. The Apigear client and server are both publishers and subscribers in terms of mqtt. The implemented mqtt client will be used as a base for apigear object client and server adapters. The file name is changed to better serve its purpose regarding apigear functionality.
Apigear offers client and server side for objects, mqtt offers only mqtt client. The Apigear client and server are both publishers and subscribers in terms of mqtt. The implemented mqtt client will be used as a base for apigear object client and server adapters. The class name is changed to better serve its purpose regarding apigear functionality
For Apigear messages we require QoS 2
The mqtt clients should have unique client id in same broker, with this commit it is allowed to pass demanded client Id, it is also exposed in the interface of class to obtain it.
depending on type of subscription (property, signal, operation) a callback has different parameters. Either only payload or also some of message properties. This commit adds way of subscribing with a callback with those reqired parameters along with a wrapper which will prepare those parameters.
the incoming messages are decoded to utf8 string and then parsed to json as this format is used along the apigear ecosystem the outgoing messages are assumed to be in a json format which is then written as a string with the utf8 encoding All incomoing and outgoing messages need to be used with one of those functions.
Apigear goal is to use Mqtt as an rpc for the objext. It splits to a client side of object and service side object. this commit adapts the mqtt client (the BaseClient) to those apigeaar objects: a remote object client side (Client) and apigear remote server side (Service) They add the methods that describe required functionality, but not all of them are yet implemented. Those are not yet the inteface taiored classes yet - those are the network and general mqtt handling classes
handles only properties and signals for now
handling only properties and signals for now subscribes for topics with property change request from mqtt clients adds the functions to send notifications on signal emission or property changed to mqtt clients
adds handling of remote operations execution subscribe and unsubscribe from topics for remote call of operation handling is added if operations are present in template
adds subscribing for invoke requests which needs to send response to a client. It adds a wrapper which handles this and just calls user callback. The wrapper uses message properties to give proper response to a client.
client now gives an id to each outgoing invoke request the id should be unique among all subscribers for same operation type (topic) the subscriber should store the id and accept only those responses with matching id (among the topic, but in this implementations we have one generator for all operations). The python integers do not overflow.
for each method in interface we prepare a topic and a response topic. They are stored in subclass MethodTopics, and used in generated code form this sturcture. This way each topic is generated only once in this file. PendingCalls subclass allows storing pending callse separately for each method. Topics for invoke response are subscribed in constructor and unsubscribed in destructor Handling of the invoke sends a message and stores a function that waits for it result. Due to threads and how mqtt client the function uses call_soon_threadsafe to make sure all users, also using different threads will be notified that the method has finished
a05e123 to
b0d91d4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
extracted to [FEAT]: Support MQTT - Add unit tests #35
Tested with tests apigear-io/performance-checks#30
checked for int: setting property, executing method. Server - client technology tested: py-py; qt-py; py-qt
Closes #28
📑 Description
✅ Checks
ℹ Additional Information