0

I want to create data on a Device and send it over a BulkIO port to a Component running inside of a Waveform on the Device. I believe this is the correct way to create data flow from hardware into a Component.

I have a usesport on the Device:

port_dataChar = usesport(name="dataChar",
                         repid="IDL:BULKIO/dataChar:1.0",
                         type_="data")

I have a providesport on the Component running on the Device:

port_dataChar = providesport(name="dataChar",
                             repid="IDL:BULKIO/dataChar:1.0",
                             type_="data")

I am able to connect these ports programatically using this python snippet:

comp_port = domain.devMgrs[0].devs[0].getPort('dataChar')
dev_port = domain.apps[0].comps[0].getPort('dataChar')
comp_port.connectPort(dev_port, 'ConnectionId')

This all works great and is very similar to how I have connected the FrontEnd 2.0 DigitalTuner ports on the same Component/Device pair. Those FE 2.0 ports work well and pass all tests.

Now, I go ahead and start the device:

domain.devMgrs[0].devs[0].start()

It is executing this code:

data = ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c']
ts = time.time()
tstamp = BULKIO.PrecisionUTCTime(BULKIO.TCM_CPU,BULKIO.TCS_VALID,0.0,
                                 int(ts),ts - int(ts))
EOS = False
streamId = "1"
print "Sending data of length", len(data)
self.port_dataChar.pushPacket(data, tstamp, EOS, streamId)
return NOOP

This prints out on the Dev Mgr:

Sending data of length 27
Sending data of length 27
Sending data of length 27
Sending data of length 27
Sending data of length 27
Sending data of length 27
...

This all seems good

Then I go ahead and start the waveform:

wave.start()

It is executing this code:

print "Iteration number ", self.numIter 
data, T, EOS, streamID, sri, sriChanged, inputQueueFlushed = self.port_dataChar.getPacket()

if (data != None):
    print "Got data of length ", len(data)
else:
    print "Got no data, streamId ", streamID    
return NOOP

However, it never gets any of the packets/data from the dataChar port:

Iteration number 1
Got no data, streamId None
Sending data of length 27
Iteration number 2
Got no data, streamId None
Sending data of length 27
Iteration number 3
Sending data of length 27
Got no data, streamId None
Sending data of length 27
Iteration number 4
Got no data, streamId None

Am I doing something wrong? Is it possible to receive data over BulkIO from a Device? I am also trying to figure out how to monitor the BulkIO port(s) to figure out what is going wrong, but I cannot find out how to monitor the ports in the documentation.

I can receive data on the component in the Sandbox using this code:

b = sb.Component("MyComponent")
kw = sb.SRIKeyword("SOME_RF",155000000.0,'double')
keywords = [kw]
i = sb.DataSource()
data = ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c']
i.connect(b)
sb.start()
i.push(data,SRIKeywords=keywords)

I attempted to push the SRI before the packet data with no luck:

keywords = []
H = BULKIO.StreamSRI(1, 0.0, 0.0, BULKIO.UNITS_TIME, 0, 0.0, 0.0, BULKIO.UNITS_NONE, 0, "1", True, keywords)
self.port_dataChar.pushSRI(H)
self.port_dataChar.pushPacket(data, tstamp, EOS, streamID)

UPDATE: I can now answer this question myself. The problem lies in the format being sent to pushPacket(). It should be a string instead of an array of chars to be sent over a dataChar BulkIO port. Essentially this:

data = ['a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c', 'a', 'b', 'c']
self.port_dataChar.pushPacket(data, tstamp, EOS, streamId)

should be changed to this:

data = "testing123"
self.port_dataChar.pushPacket(data, tstamp, EOS, streamId)
4

1 回答 1

0

问题是您的 pushPacket() 调用导致CORBA.BAD_PARAM(omniORB.BAD_PARAM_WrongPythonType, CORBA.COMPLETED_NO)异常并且静默失败(使用版本 1.9.0 的 REDHAWK)。dataChar 旨在用于字符数据,事实证明,底层的 omniORBpy / BulkIO 映射需要一个字符串值,而不是数据变量的字符串列表。如果您需要将字符数据从您的设备发送到您的组件,您应该使用:

data = "your text here"
self.port_dataChar.pushPacket(data, tstamp, EOS, streamId)

如果您的意图只是让 BulkIO 数据从您的设备流向您的组件,我建议使用 dataFloat 端口。

如果要监视端口的输出,REDHAWK IDE中的端口监视器数据列表视图可用于调试。

于 2014-02-06T17:25:07.357 回答