34 from .
import fadingselectionevent_pb2
39 MODELS = (
'none',
'nakagami')
42 self.
_event = fadingselectionevent_pb2.FadingSelectionEvent()
46 entry = self.
_event.entries.add()
50 for (name,value)
in list(kwargs.items()):
54 entry.model = fadingselectionevent_pb2.FadingSelectionEvent.TYPE_NONE
56 elif value ==
'nakagami':
57 entry.model = fadingselectionevent_pb2.FadingSelectionEvent.TYPE_NAKAGAMI
60 raise ValueError(
"unknown model")
62 raise KeyError(
"unknown parameter: %s" % name)
65 raise KeyError(
"must specify model")
68 return self.
_event.SerializeToString()
71 self.
_event.ParseFromString(data)
74 for entry
in self.
_event.entries:
77 if entry.model == fadingselectionevent_pb2.FadingSelectionEvent.TYPE_NONE:
79 elif entry.model == fadingselectionevent_pb2.FadingSelectionEvent.TYPE_NAKAGAMI:
82 kwargs = {
'model' : model}
84 yield (entry.nemId,kwargs)
def append(self, nemId, kwargs)