Skip to content

Dphan/mqtt#31

Merged
dorotaphanSiili merged 26 commits into
mainfrom
dphan/mqtt
Sep 2, 2024
Merged

Dphan/mqtt#31
dorotaphanSiili merged 26 commits into
mainfrom
dphan/mqtt

Conversation

@dorotaphanSiili
Copy link
Copy Markdown
Collaborator

@dorotaphanSiili dorotaphanSiili commented Jul 8, 2024

  • Find sutible python module which supports MQTT v5
  • Create manual test implementation to check implementation details
  • Extend the python template to support the generation
  • Make sure the mqtt feature is strictly separate from the other features (customer should be able to choose either olink or mqtt without needing boths dependencies) - should it also be applied to requirements (dependencies)?
  • Add examples
  • Write documentation for this feature ( a simple document similar to Qt/C++ is sufficient until the full documentation is available) Dphan/docs #33 and feat: add python documentation apigear-docs#73
  • Write unit tests, maybe without networking, cause those tests are bit complex for unit tests
    extracted to [FEAT]: Support MQTT - Add unit tests #35
  • clean up commit history

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

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

ℹ Additional Information

@dorotaphanSiili dorotaphanSiili changed the base branch from main to dphan/next/use-submodules July 8, 2024 11:59
@dorotaphanSiili dorotaphanSiili linked an issue Jul 8, 2024 that may be closed by this pull request
6 tasks
@dorotaphanSiili dorotaphanSiili requested a review from w4bremer July 16, 2024 10:38
@dorotaphanSiili dorotaphanSiili force-pushed the dphan/next/use-submodules branch 3 times, most recently from 8feea24 to 64d532c Compare July 20, 2024 08:20
@dorotaphanSiili dorotaphanSiili force-pushed the dphan/next/use-submodules branch from 64d532c to ef75a86 Compare August 1, 2024 06:13
@dorotaphanSiili dorotaphanSiili force-pushed the dphan/mqtt branch 6 times, most recently from 8dca581 to ea5beb8 Compare August 6, 2024 08:28
@dorotaphanSiili dorotaphanSiili marked this pull request as ready for review August 6, 2024 11:06
@dorotaphanSiili dorotaphanSiili mentioned this pull request Aug 6, 2024
@dorotaphanSiili dorotaphanSiili force-pushed the dphan/next/use-submodules branch from ef75a86 to dc8c163 Compare August 9, 2024 11:38
@dorotaphanSiili dorotaphanSiili force-pushed the dphan/next/use-submodules branch 2 times, most recently from 8b2f08e to 2cf0d65 Compare August 12, 2024 12:50
@dorotaphanSiili dorotaphanSiili force-pushed the dphan/mqtt branch 2 times, most recently from 1a0fea6 to a05e123 Compare August 29, 2024 08:54
Base automatically changed from dphan/next/use-submodules to main August 29, 2024 11:22
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
@dorotaphanSiili dorotaphanSiili merged commit ab7f556 into main Sep 2, 2024
@dorotaphanSiili dorotaphanSiili deleted the dphan/mqtt branch September 2, 2024 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT]: Support MQTT

1 participant