Skip to content

Commit

Permalink
Address PR comment
Browse files Browse the repository at this point in the history
  • Loading branch information
tehampson committed Jan 17, 2024
1 parent 0e851b8 commit b8dde79
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/controller/python/chip/ChipDeviceCtrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -951,7 +951,7 @@ async def SendBatchCommands(self, nodeid: int, commands: typing.List[ClusterComm
- A value of `None` indicates success.
- If only a single command fails, for example with `UNSUPPORTED_COMMAND`, the corresponding index associated with the command will,
contain `interaction_model.Status.UnsupportedCommand`.
- If a command is not responded to by server, command will contain `interaction_model.Status.Failure`
- If a command is not responded to by server, command will contain `interaction_model.Status.NoCommandResponse`
Raises:
- InteractionModelError if error with sending of InvokeRequestMessage fails as a whole.
'''
Expand Down
34 changes: 23 additions & 11 deletions src/controller/python/chip/clusters/Command.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,17 +327,29 @@ def _BuildPyInvokeRequestData(commands: List[InvokeRequestInfo], timedRequestTim
def SendBatchCommands(future: Future, eventLoop, device, commands: List[InvokeRequestInfo],
timedRequestTimeoutMs: Optional[int] = None, interactionTimeoutMs: Optional[int] = None, busyWaitMs: Optional[int] = None,
suppressResponse: Optional[bool] = None) -> PyChipError:
''' Send a cluster-object encapsulated command to a device and does the following:
- On receipt of a successful data response, returns the cluster-object equivalent through the provided future.
- None (on a successful response containing no data)
- Raises an exception if any errors are encountered.
If no response type is provided above, the type will be automatically deduced.
If a valid timedRequestTimeoutMs is provided, a timed interaction will be initiated instead.
If a valid interactionTimeoutMs is provided, the interaction will terminate with a CHIP_ERROR_TIMEOUT if a response
has not been received within that timeout. If it isn't provided, a sensible value will be automatically computed that
accounts for the underlying characteristics of both the transport and the responsiveness of the receiver.
''' Initiates an InvokeInteraction with the batch commands provided.
Arguments:
- timedRequestTimeoutMs: If a valid value is provided, a timed interaction will be initiated.
- interactionTimeoutMs: If a valid value is provided, the interaction will terminate with a
CHIP_ERROR_TIMEOUT if a response is not received within the specified timeout. If not provided,
a suitable value will be automatically computed based on transport characteristics and
receiver responsiveness.
Returns:
- PyChipError: Indicates the outcome of initiating the InvokeRequest. Upon success the caller
is expected to await on `future` to get result of the InvokeInteraction.
Results passed via the provided future:
- Successful InvokeInteraction with path-specific responses (including path-specific errors):
- A list of responses is returned in the same order as the `commands` argument.
- Possible response elements:
- `None`: Successful command execution without additional cluster data.
- Encapsulated cluster-object: Successful command with response data.
- interaction_model.Status.*: Command failure with IM Status.
- interaction_model.Status.NoCommandResponse: No response from the server for
a specific command.
- Non-path-specific error: An `InteractionModelError` exception is raised through the future.
'''
handle = chip.native.GetLibraryHandle()

Expand Down

0 comments on commit b8dde79

Please sign in to comment.