CameraImageRequest

This commit is contained in:
Otto Winter 2019-03-09 11:02:44 +01:00
parent 97c0f496a8
commit 0d67c464d7
No known key found for this signature in database
GPG Key ID: DB66C0BE6013F97E
3 changed files with 247 additions and 70 deletions

View File

@ -368,3 +368,8 @@ message ExecuteServiceRequest {
fixed32 key = 1;
repeated ExecuteServiceArgument args = 2;
}
message CameraImageRequest {
bool single = 1;
bool stream = 2;
}

File diff suppressed because one or more lines are too long

View File

@ -61,6 +61,7 @@ MESSAGE_TYPE_TO_PROTO = {
42: pb.ExecuteServiceRequest,
43: pb.ListEntitiesCameraResponse,
44: pb.CameraImageResponse,
45: pb.CameraImageRequest,
}
@ -785,7 +786,6 @@ class APIClient:
data = image_stream.pop(msg.key, bytes()) + msg.data
if msg.done:
on_state(CameraState(key=msg.key, image=data))
_LOGGER.warning("Got image len=%s", len(data))
else:
image_stream[msg.key] = data
return
@ -957,3 +957,15 @@ class APIClient:
args.append(arg)
req.args.extend(args)
await self._connection.send_message(req)
async def _request_image(self, *, single=False, stream=False):
req = pb.CameraImageRequest()
req.single = single
req.stream = stream
await self._connection.send_message(req)
async def request_single_image(self):
await self._request_image(single=True)
async def request_image_stream(self):
await self._request_image(stream=True)