|
1 | NO CONTENT: modified file |
@@ -114,10 +114,6 class GenericData(object): | |||
|
114 | 114 | |
|
115 | 115 | flagNoData = True |
|
116 | 116 | |
|
117 | def __init__(self): | |
|
118 | ||
|
119 | raise NotImplementedError | |
|
120 | ||
|
121 | 117 | def copy(self, inputObj=None): |
|
122 | 118 | |
|
123 | 119 | if inputObj == None: |
@@ -231,10 +227,6 class JROData(GenericData): | |||
|
231 | 227 | |
|
232 | 228 | profileIndex = None |
|
233 | 229 | |
|
234 | def __init__(self): | |
|
235 | ||
|
236 | raise NotImplementedError | |
|
237 | ||
|
238 | 230 | def getNoise(self): |
|
239 | 231 | |
|
240 | 232 | raise NotImplementedError |
@@ -15,6 +15,7 from threading import Thread | |||
|
15 | 15 | from multiprocessing import Process |
|
16 | 16 | |
|
17 | 17 | from schainpy.model.proc.jroproc_base import Operation, ProcessingUnit |
|
18 | from schainpy.model.data.jrodata import JROData | |
|
18 | 19 | |
|
19 | 20 | MAXNUMX = 100 |
|
20 | 21 | MAXNUMY = 100 |
@@ -257,7 +258,44 class PublishData(Operation): | |||
|
257 | 258 | self.client.loop_stop() |
|
258 | 259 | self.client.disconnect() |
|
259 | 260 | |
|
260 | class ReceiverData(ProcessingUnit, Process): | |
|
261 | ||
|
262 | class ReceiverData(ProcessingUnit): | |
|
263 | ||
|
264 | def __init__(self, **kwargs): | |
|
265 | ||
|
266 | ProcessingUnit.__init__(self, **kwargs) | |
|
267 | ||
|
268 | self.isConfig = False | |
|
269 | server = kwargs.get('server', 'zmq.pipe') | |
|
270 | if 'tcp://' in server: | |
|
271 | address = server | |
|
272 | else: | |
|
273 | address = 'ipc:///tmp/%s' % server | |
|
274 | ||
|
275 | self.address = address | |
|
276 | self.dataOut = JROData() | |
|
277 | ||
|
278 | def setup(self): | |
|
279 | ||
|
280 | self.context = zmq.Context() | |
|
281 | self.receiver = self.context.socket(zmq.PULL) | |
|
282 | self.receiver.bind(self.address) | |
|
283 | time.sleep(0.5) | |
|
284 | print '[Starting] ReceiverData from {}'.format(self.address) | |
|
285 | ||
|
286 | ||
|
287 | def run(self): | |
|
288 | ||
|
289 | if not self.isConfig: | |
|
290 | self.setup() | |
|
291 | self.isConfig = True | |
|
292 | ||
|
293 | self.dataOut = self.receiver.recv_pyobj() | |
|
294 | print '[Receiving] {} - {}'.format(self.dataOut.type, | |
|
295 | self.dataOut.datatime.ctime()) | |
|
296 | ||
|
297 | ||
|
298 | class PlotterReceiver(ProcessingUnit, Process): | |
|
261 | 299 | |
|
262 | 300 | throttle_value = 5 |
|
263 | 301 |
General Comments 0
You need to be logged in to leave comments.
Login now