Skip to content

Commit

Permalink
Add block_response helper method to process
Browse files Browse the repository at this point in the history
Avoids Block needing to know about Process' internal BlockRespond
message.
  • Loading branch information
c-mita committed Jun 27, 2016
1 parent b4e3549 commit 4faf548
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions malcolm/core/block.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from contextlib import contextmanager

from malcolm.core.monitorable import Monitorable
from malcolm.core.process import BlockRespond
from malcolm.core.request import Request
from malcolm.core.response import Response

Expand Down Expand Up @@ -72,7 +71,8 @@ def handle_request(self, request):
self._attributes[attr_name].put(request.value)
self._attributes[attr_name].set_value(request.value)
response = Response.Return(request.id_, request.context)
response = BlockRespond(response, request.response_queue)
response = self.parent.make_block_response_message(
response, request.response_queue)
self.parent.q.put(response)

def to_dict(self):
Expand Down
3 changes: 3 additions & 0 deletions malcolm/core/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ def _handle_get(self, request):
response = Response.Return(request.id_, request.context, d)
request.response_queue.put(response)

def make_block_response_message(self, response, response_queue):
return BlockRespond(response, response_queue)

def notify_subscribers(self, block_name):
self.q.put(BlockNotify(name=block_name))

Expand Down

0 comments on commit 4faf548

Please sign in to comment.