Skip to content

Commit

Permalink
Move Controller state logic attributes to create_attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
c-mita committed Jun 24, 2016
1 parent e36af82 commit 738a1e0
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions malcolm/core/controller.py
Expand Up @@ -21,13 +21,6 @@ def __init__(self, block):
logger_name = "%s.controller" % block.name
super(Controller, self).__init__(logger_name)

enum_meta = EnumMeta("State", "State of Block", [])
self.state = Attribute(enum_meta)
string_meta = StringMeta("Status", "Status of Block")
self.status = Attribute(string_meta)
boolean_meta = BooleanMeta("Busy", "Whether Block busy or not")
self.busy = Attribute(boolean_meta)

self.writeable_methods = OrderedDict()

self.block = block
Expand Down Expand Up @@ -59,7 +52,16 @@ def create_attributes(self):
Attribute: Each one will be attached to the Block by calling
block.add_attribute(attribute)
"""
return iter(())
self.state = Attribute(EnumMeta(
"State", "State of Block",
self.stateMachine.possible_states))
yield self.state
self.status = Attribute(StringMeta("Status", "Status of Block"))
yield self.status
self.busy = Attribute(BooleanMeta("Busy", "Whether Block busy or not"))
yield self.busy



def transition(self, state, message):
"""
Expand Down

0 comments on commit 738a1e0

Please sign in to comment.