dbusmock.templates.bluez5-obex
obexd mock template
This creates the expected methods and properties of the object manager org.bluez.obex object (/), the manager object (/org/bluez/obex), but no agents or clients.
This supports BlueZ 5 only.
Attributes
Functions
|
|
|
OBEX method to create a new transfer session. |
|
OBEX method to remove an existing transfer session. |
|
OBEX method to start a pull transfer of a phone book. |
|
Mock signal emitted when a new Transfer object is created. |
|
Mock method to update the transfer status. |
Module Contents
- dbusmock.templates.bluez5-obex.__copyright__ = Multiline-String[source]
Show Value
""" (c) 2013 Collabora Ltd. (c) 2017 - 2022 Martin Pitt <martin@piware.de> """
- dbusmock.templates.bluez5-obex.CreateSession(self, destination, args)[source]
OBEX method to create a new transfer session.
The destination must be the address of the destination Bluetooth device. The given arguments must be a map from well-known keys to values, containing at least the Target key, whose value must be PBAP (other keys and values are accepted by the real daemon, but not by this mock daemon at the moment). If the target is missing or incorrect, an Unsupported error is returned on the bus.
Returns the path of a new Session object.
- dbusmock.templates.bluez5-obex.RemoveSession(self, session_path)[source]
OBEX method to remove an existing transfer session.
This takes the path of the transfer Session object and removes it.
- dbusmock.templates.bluez5-obex.PullAll(self, target_file, filters)[source]
OBEX method to start a pull transfer of a phone book.
This doesn’t complete the transfer; code to mock up activating and completing the transfer must be provided by the test driver, as it is too complex and test-specific to put here.
The target_file is the absolute path for a file which will have zero or more vCards, separated by new-line characters, written to it if the method is successful (and the transfer is completed). This target_file is actually emitted in a TransferCreated signal, which is a special part of the mock interface designed to be handled by the test driver, which should then populate that file and call UpdateStatus on the Transfer object. The test driver is responsible for deleting the file once the test is complete.
The filters parameter is a map of filters to be applied to the results device-side before transmitting them back to the adapter.
Returns a tuple containing the path for a new Transfer D-Bus object representing the transfer, and a map of the initial properties of that Transfer object.
- dbusmock.templates.bluez5-obex.TransferCreated(_self, _path, _filters, _transfer_filename)[source]
Mock signal emitted when a new Transfer object is created.
This is not part of the BlueZ OBEX interface; it is purely for use by test driver code. It is emitted by the PullAll method, and is intended to be used as a signal to call UpdateStatus on the newly created Transfer (potentially after a timeout).
The path is of the new Transfer object, and the filters are as provided to PullAll. The transfer filename is the full path and filename of a newly created empty temporary file which the test driver should write to.
The test driver should then call UpdateStatus on the Transfer object each time a write is made to the transfer file. The final call to UpdateStatus should mark the transfer as complete.
The test driver is responsible for deleting the transfer file once the test is complete.
FIXME: Ideally the UpdateStatus method would only be used for completion, and all intermediate updates would be found by watching the size of the transfer file. However, that means adding a dependency on an inotify package, which seems a little much.
- dbusmock.templates.bluez5-obex.UpdateStatus(self, is_complete)[source]
Mock method to update the transfer status.
If is_complete is False, this marks the transfer is active; otherwise it marks the transfer as complete. It is an error to call this method after calling it with is_complete as True.
In both cases, it updates the number of bytes transferred to be the current size of the transfer file (whose filename was emitted in the TransferCreated signal).