forked from RedhawkSDR/Documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainch15.html
961 lines (915 loc) · 52.5 KB
/
mainch15.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html >
<head><title>15 Data Flow Management: Bulk IO</title>
<meta http-equiv="Content-Type" content="text/html; charset="utf-8"">
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)">
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)">
<!-- html,2,next,javascript,charset="utf-8" -->
<meta name="src" content="main.tex">
<meta name="date" content="2013-03-12 19:46:00">
<link rel="stylesheet" type="text/css" href="main.css">
<script type="text/javascript" src="scripts/shCore.js"></script>
<script type="text/javascript" src="scripts/shBrushCpp.js"></script>
<script type="text/javascript" src="scripts/shBrushJava.js"></script>
<script type="text/javascript" src="scripts/shBrushPython.js"></script>
<script type="text/javascript" src="scripts/shBrushBash.js"></script>
<script type="text/javascript" src="scripts/shBrushXml.js"></script>
<link href="styles/shCore.css" rel="stylesheet" type="text/css" />
<link href="styles/shThemeDefault.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
SyntaxHighlighter.all()
</script>
</head><body
>
<script>
function f() {
document.getElementById('main_content_wrap').focus();
}
if (window.addEventListener) {
window.addEventListener("load", f, false);
} else if (window.attachEvent) {
window.attachEvent("onload", f);
}
</script>
<div class="header">
<ul class="navbar">
<li><a class="logo-small" href="index.html"><img src="images/RedHawk_Logo_ALT_B_121px.png"/></a></li> <li><a href="index.html">Home</a></li>
<li><a href="gettingstarted/main.html">Getting Started</a></li>
<li><a class="active" href="main.html">Documentation</a></li>
<li><a href="download.html">Download</a></li>
<li><a href="support.html">Support</a></li>
</ul>
<div class="pattern right"></div>
<a id="forkme_banner" href="https://github.com/redhawksdr">View on GitHub</a>
</div>
<!-- Custom MAIN CONTENT -->
<div id="main_content_wrap" tabindex="0" class="outer">
<section id="main_content" class="inner">
<!--l. 1--><div class="crosslinks"><p class="noindent">[<a
href="mainch16.html" >next</a>] [<a
href="mainch14.html" >prev</a>] [<a
href="mainch14.html#tailmainch14.html" >prev-tail</a>] [<a
href="#tailmainch15.html">tail</a>] [<a
href="main.html#mainch15.html" >up</a>] </p></div>
<h2 class="chapterHead"><span class="titlemark">Chapter 15</span><br /><a
id="x17-20700015"></a>Data Flow Management: Bulk IO</h2>
<h3 class="sectionHead"><span class="titlemark">15.1 </span> <a
id="x17-20800015.1"></a>Introduction</h3>
<!--l. 6--><p class="noindent" >Data flow through REDHAWK <a
href="mainli2.html#glo:component">Components</a> is managed through a module of interfaces called
<a
href="mainap3.html#bulkio">BulkIO</a>. The <a
href="mainap3.html#bulkio">BulkIO</a> module is designed to provide a standardized methodology for transferring
data between <a
href="mainli2.html#glo:component">Components</a>/<a
href="mainli2.html#glo:device">Devices</a>. As the name implies, <a
href="mainap3.html#bulkio">BulkIO</a> is designed for bulk data
transfers. The code generators are constructed to provide <a
href="mainli2.html#glo:port">Port</a> implementations that maximize the
efficiency of data throughput while providing network-accessible data ingest/egress and minimizing
the complexity of the implementation.
<!--l. 11--><p class="noindent" >Data is transferred either in-band (through the <a
href="mainli2.html#glo:port">Port</a> object directly) or out-of-band
(i.e., User Datagram Protocol (<a
href="mainap3.html#udp">UDP</a>) multicast). In the case of out-of-band transfers,
the <a
href="mainli2.html#glo:port">Port</a> provides only metadata regarding connections, such as multicast address in a
Virtual Local Area Network (<a
href="mainap3.html#vlan">VLAN</a>). Data transferred in-band is embedded with some
fixed-field metadata, like a birth date timestamp, and variable-field metadata in key/value
pairs.
<!--l. 1--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">15.2 </span> <a
id="x17-20900015.2"></a>SRI</h3>
<!--l. 3--><p class="noindent" ><a
href="mainap3.html#sri">SRI</a> is delivered with the data (when in-band) that describes the data payload.
<!--l. 5--><p class="noindent" >The <a
href="mainap3.html#sri">SRI</a> data structure contains the following 12 fields:
<div class="table">
<!--l. 12--><p class="noindent" ><a
id="x17-209001r1"></a><hr class="float"><div class="float"
><table class="float"><tr class="float"><td class="float"
>
<table class="caption"
><tr style="vertical-align:baseline;" class="caption"><td class="id">Table 15.1: </td><td
class="content"><a
href="mainap3.html#sri">SRI</a> fields</td></tr></table><!--tex4ht:label?: x17-209001r1 -->
<div class="tabular"> <table id="TBL-1" class="tabular"
cellspacing="0" cellpadding="0" rules="groups"
><colgroup id="TBL-1-1g"><col
id="TBL-1-1"></colgroup><colgroup id="TBL-1-2g"><col
id="TBL-1-2"></colgroup><colgroup id="TBL-1-3g"><col
id="TBL-1-3"></colgroup><tr
style="vertical-align:baseline;" id="TBL-1-1-"><td style="white-space:nowrap; text-align:left;" id="TBL-1-1-1"
class="td11"> <span
class="cmbx-12">Name </span></td><td style="white-space:wrap; text-align:left;" id="TBL-1-1-2"
class="td11"> <!--l. 15--><p class="noindent" ><span
class="cmbx-12">Type</span> </td><td style="white-space:wrap; text-align:left;" id="TBL-1-1-3"
class="td11"> <!--l. 15--><p class="noindent" ><span
class="cmbx-12">Description</span> </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-1-2-"><td style="white-space:nowrap; text-align:left;" id="TBL-1-2-1"
class="td11"> hversion </td><td style="white-space:wrap; text-align:left;" id="TBL-1-2-2"
class="td11"> <!--l. 16--><p class="noindent" >long </td><td style="white-space:wrap; text-align:left;" id="TBL-1-2-3"
class="td11"> <!--l. 16--><p class="noindent" >Version of the Stream <a
href="mainap3.html#sri">SRI</a> header. This field
is ignored by the code generators, so a default
1.0 is adequate. </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-1-3-"><td style="white-space:nowrap; text-align:left;" id="TBL-1-3-1"
class="td11"> xstart </td><td style="white-space:wrap; text-align:left;" id="TBL-1-3-2"
class="td11"> <!--l. 17--><p class="noindent" >double </td><td style="white-space:wrap; text-align:left;" id="TBL-1-3-3"
class="td11"> <!--l. 17--><p class="noindent" >Start time of the stream. This is epoch time
from January 1, 1970 in seconds. </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-1-4-"><td style="white-space:nowrap; text-align:left;" id="TBL-1-4-1"
class="td11"> xdelta </td><td style="white-space:wrap; text-align:left;" id="TBL-1-4-2"
class="td11"> <!--l. 18--><p class="noindent" >double </td><td style="white-space:wrap; text-align:left;" id="TBL-1-4-3"
class="td11"> <!--l. 18--><p class="noindent" >Delta between two values in the payload
vector. in the case of time data, this is the
sampling period. In the case of spectral data,
this is the frequency difference between two
adjacent Fast Fourier Transform (<a
href="mainap3.html#fft">FFT</a>) bins. </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-1-5-"><td style="white-space:nowrap; text-align:left;" id="TBL-1-5-1"
class="td11"> xunits </td><td style="white-space:wrap; text-align:left;" id="TBL-1-5-2"
class="td11"> <!--l. 19--><p class="noindent" >short </td><td style="white-space:wrap; text-align:left;" id="TBL-1-5-3"
class="td11"> <!--l. 19--><p class="noindent" >Unit types;
common codes defined in <a
href="mainap3.html#idl">IDL</a> (i.e: 0=None,
1=time, 2=delay, 3=frequency) </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-1-6-"><td style="white-space:nowrap; text-align:left;" id="TBL-1-6-1"
class="td11"> subsize </td><td style="white-space:wrap; text-align:left;" id="TBL-1-6-2"
class="td11"> <!--l. 20--><p class="noindent" >long </td><td style="white-space:wrap; text-align:left;" id="TBL-1-6-3"
class="td11"> <!--l. 20--><p class="noindent" >0 if the data is one dimensional; <span
class="cmmi-12">></span>0 if two
dimensional. This applies to framed data;
ydelta describes the frame length. </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-1-7-"><td style="white-space:nowrap; text-align:left;" id="TBL-1-7-1"
class="td11"> ystart </td><td style="white-space:wrap; text-align:left;" id="TBL-1-7-2"
class="td11"> <!--l. 21--><p class="noindent" >double </td><td style="white-space:wrap; text-align:left;" id="TBL-1-7-3"
class="td11"> <!--l. 21--><p class="noindent" >Start of second dimension </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-1-8-"><td style="white-space:nowrap; text-align:left;" id="TBL-1-8-1"
class="td11"> ydelta </td><td style="white-space:wrap; text-align:left;" id="TBL-1-8-2"
class="td11"> <!--l. 22--><p class="noindent" >double </td><td style="white-space:wrap; text-align:left;" id="TBL-1-8-3"
class="td11"> <!--l. 22--><p class="noindent" >Delta between two samples of second
dimension (e.g., frame length in framed data) </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-1-9-"><td style="white-space:nowrap; text-align:left;" id="TBL-1-9-1"
class="td11"> yunits </td><td style="white-space:wrap; text-align:left;" id="TBL-1-9-2"
class="td11"> <!--l. 23--><p class="noindent" >short </td><td style="white-space:wrap; text-align:left;" id="TBL-1-9-3"
class="td11"> <!--l. 23--><p class="noindent" >Unit types;
common codes defined in <a
href="mainap3.html#idl">IDL</a> (i.e: 0=None,
1=time, 2=delay, 3=frequency) </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-1-10-"><td style="white-space:nowrap; text-align:left;" id="TBL-1-10-1"
class="td11"> mode </td><td style="white-space:wrap; text-align:left;" id="TBL-1-10-2"
class="td11"> <!--l. 24--><p class="noindent" >short </td><td style="white-space:wrap; text-align:left;" id="TBL-1-10-3"
class="td11"> <!--l. 24--><p class="noindent" >0-Scalar, 1-Complex. Complex data is passed
as interleaved I/Q values in the sequence.
The type for the sequence remains the same
for both real and complex data. </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-1-11-"><td style="white-space:nowrap; text-align:left;" id="TBL-1-11-1"
class="td11"> streamID </td><td style="white-space:wrap; text-align:left;" id="TBL-1-11-2"
class="td11"> <!--l. 25--><p class="noindent" >string </td><td style="white-space:wrap; text-align:left;" id="TBL-1-11-3"
class="td11"> <!--l. 25--><p class="noindent" >Stream <a
href="mainap3.html#id">ID</a>. Unique streams can be delivered
over the same <a
href="mainli2.html#glo:port">Port</a>, where each stream
is identified by a unique string (generated
or passed along by the provides side).
The generation of this stream <a
href="mainap3.html#id">ID</a> is
<a
href="mainli2.html#glo:application">Application</a>-specific and not controlled by
the REDHAWK Core Framework. </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-1-12-"><td style="white-space:nowrap; text-align:left;" id="TBL-1-12-1"
class="td11"> blocking </td><td style="white-space:wrap; text-align:left;" id="TBL-1-12-2"
class="td11"> <!--l. 26--><p class="noindent" >boolean </td><td style="white-space:wrap; text-align:left;" id="TBL-1-12-3"
class="td11"> <!--l. 26--><p class="noindent" >Flag to determine whether the receiving <a
href="mainli2.html#glo:port">Port</a>
should exhibit back pressure. If this is false
and the provides-side queue is full, the data is
dumped. If this is true and the provides-side
queue is full, the <span
class="cmtt-12">pushPacket() </span>call blocks. </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-1-13-"><td style="white-space:nowrap; text-align:left;" id="TBL-1-13-1"
class="td11"> keywords </td><td style="white-space:wrap; text-align:left;" id="TBL-1-13-2"
class="td11"> <!--l. 27--><p class="noindent" >sequence
<span
class="cmmi-12"><</span>CF::DataType<span
class="cmmi-12">></span> </td><td style="white-space:wrap; text-align:left;" id="TBL-1-13-3"
class="td11"> <!--l. 27--><p class="noindent" >User defined keywords. This is a sequence
of structures that contain an <a
href="mainap3.html#id">ID</a> of type
string and a value of type <a
href="mainap3.html#corba">CORBA</a> Any. The
content of the <a
href="mainap3.html#corba">CORBA</a> Any can be any type. </td>
</tr></table></div>
</td></tr></table></div><hr class="endfloat" />
</div>
<!--l. 35--><p class="noindent" ><a
href="mainap3.html#sri">SRI</a> is transferred over a connection by the uses-side invoking the providesside function
<span
class="cmtt-12">pushSRI()</span>. The <span
class="cmtt-12">pushSRI() </span>function contains a single argument, an instance of an <a
href="mainap3.html#sri">SRI</a>
object.
<!--l. 38--><p class="noindent" >Each provides-side <a
href="mainli2.html#glo:port">Port</a> that implements a <a
href="mainap3.html#bulkio">BulkIO</a> interface expects that <a
href="mainap3.html#sri">SRI</a> regarding data being
received become available before any data is transferred. When using the code generators and base
classes in the REDHAWK development tools, this behavior is hard-coded into the uses-side <a
href="mainap3.html#bulkio">BulkIO</a>
<a
href="mainli2.html#glo:port">Ports</a>. If the user code on the uses-side of a <a
href="mainap3.html#bulkio">BulkIO</a> connection does not explicitly invoke a
<span
class="cmtt-12">pushSRI() </span>call before any data is sent out, the auto-generated code will create a trivial <a
href="mainap3.html#sri">SRI</a>
message with normalized values.
<!--l. 42--><p class="noindent" >Part of the hard-coded behavior on the uses-side <a
href="mainap3.html#bulkio">BulkIO</a> <a
href="mainli2.html#glo:port">Port</a> is to issue a <span
class="cmtt-12">pushSRI() </span>when a new
connection is made to the newly-connected object. For example, a system is created in which data
is flowing between <a
href="mainli2.html#glo:component">Components</a> A and B. As data is flowing between these <a
href="mainli2.html#glo:component">Components</a>, a new
connection is established between <a
href="mainli2.html#glo:component">Components</a> A and C. When this connection is established, a
<span
class="cmtt-12">pushSRI() </span>method call will automatically be made from <a
href="mainli2.html#glo:component">Component</a> A to <a
href="mainli2.html#glo:component">Component</a>
C.
<h3 class="sectionHead"><span class="titlemark">15.3 </span> <a
id="x17-21000015.3"></a><span
class="cmtt-12">BULKIO::PrecisionUTCTime </span>Timestamp</h3>
<!--l. 4--><p class="noindent" >The following code segment provides an example of how to construct a <span
class="cmtt-12">BULKIO::PrecisionUTCTime</span>
time stamp to be sent in the <a
href="mainap3.html#sri">SRI</a>:
<script type="syntaxhighlighter" class="brush: cpp"><![CDATA[
//To create a PrecisionUTCTime object, use the following
//code:
struct timeval tmp_time;
struct timezone tmp_tz;
gettimeofday(&tmp_time, &tmp_tz);
double wsec = tmp_time.tv_sec;
double fsec = tmp_time.tv_usec / 1e6;;
BULKIO::PrecisionUTCTime tstamp =
BULKIO::PrecisionUTCTime();
tstamp.tcmode = BULKIO::TCM_CPU;
tstamp.tcstatus = (short)1;
tstamp.toff = 0.0;
tstamp.twsec = wsec;
tstamp.tfsec = fsec;
]]></script>
<!--l. 1--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">15.4 </span> <a
id="x17-21100015.4"></a>Data Transfers</h3>
<!--l. 3--><p class="noindent" >The <a
href="mainap3.html#bulkio">BulkIO</a> data transfers happen with the <span
class="cmtt-12">pushPacket() </span>call. As mentioned earlier, the
provides-side <a
href="mainli2.html#glo:port">Port</a> expects a <span
class="cmtt-12">pushSRI() </span>call before the first <span
class="cmtt-12">pushPacket()</span>. The auto-generated
code in <a
href="mainli2.html#glo:component">Components</a> guarantees this behavior. Zero or more <span
class="cmtt-12">pushPacket() </span>calls may happen after
a <span
class="cmtt-12">pushSRI()</span>.
<!--l. 8--><p class="noindent" >In the case of in-band data, the <span
class="cmtt-12">pushPacket() </span>arguments are shown in <a
href="#x17-21100015.4">Table 15.4</a>.
<div class="table">
<!--l. 11--><p class="noindent" ><a
id="x17-211001r2"></a><hr class="float"><div class="float"
><table class="float"><tr class="float"><td class="float"
>
<div class="tabular"> <table id="TBL-2" class="tabular"
cellspacing="0" cellpadding="0" rules="groups"
><colgroup id="TBL-2-1g"><col
id="TBL-2-1"></colgroup><colgroup id="TBL-2-2g"><col
id="TBL-2-2"></colgroup><colgroup id="TBL-2-3g"><col
id="TBL-2-3"></colgroup><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-2-1-"><td style="white-space:nowrap; text-align:left;" id="TBL-2-1-1"
class="td11"> <span
class="cmbx-12">Name </span></td><td style="white-space:nowrap; text-align:left;" id="TBL-2-1-2"
class="td11"> <span
class="cmbx-12">Type </span></td><td style="white-space:wrap; text-align:left;" id="TBL-2-1-3"
class="td11"> <!--l. 15--><p class="noindent" ><span
class="cmbx-12">Description</span> </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-2-2-"><td style="white-space:nowrap; text-align:left;" id="TBL-2-2-1"
class="td11"> data </td><td style="white-space:nowrap; text-align:left;" id="TBL-2-2-2"
class="td11"> sequence<span
class="cmmi-12"><</span>TYPE<span
class="cmmi-12">> </span></td><td style="white-space:wrap; text-align:left;" id="TBL-2-2-3"
class="td11"> <!--l. 16--><p class="noindent" >A sequence of a particular type,
where TYPE is some native
<a
href="mainap3.html#corba">CORBA</a> type (e.g., float, short).
The sequence may be zero-length. </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-2-3-"><td style="white-space:nowrap; text-align:left;" id="TBL-2-3-1"
class="td11"> T </td><td style="white-space:nowrap; text-align:left;" id="TBL-2-3-2"
class="td11"> PrecisionUTCTime </td><td style="white-space:wrap; text-align:left;" id="TBL-2-3-3"
class="td11"> <!--l. 17--><p class="noindent" >The epoch birth date of the first
sample of the sequence passed in
this call. </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-2-4-"><td style="white-space:nowrap; text-align:left;" id="TBL-2-4-1"
class="td11"> <a
href="mainap3.html#eos">EOS</a> </td><td style="white-space:nowrap; text-align:left;" id="TBL-2-4-2"
class="td11"> boolean </td><td style="white-space:wrap; text-align:left;" id="TBL-2-4-3"
class="td11"> <!--l. 18--><p class="noindent" >Flag describing whether this
particular stream ends with this
<span
class="cmtt-12">pushPacket() </span>call. </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-2-5-"><td style="white-space:nowrap; text-align:left;" id="TBL-2-5-1"
class="td11"> streamID </td><td style="white-space:nowrap; text-align:left;" id="TBL-2-5-2"
class="td11"> string </td><td style="white-space:wrap; text-align:left;" id="TBL-2-5-3"
class="td11"> <!--l. 19--><p class="noindent" >Stream ID for this particular
payload. This string is used to
reconcile this sequence of data
with a particular Stream <a
href="mainap3.html#sri">SRI</a>
data structure. </td>
</tr></table></div>
<br /> <table class="caption"
><tr style="vertical-align:baseline;" class="caption"><td class="id">Table 15.2: </td><td
class="content">In-band data fields for <span
class="cmtt-12">pushPacket() </span>call</td></tr></table><!--tex4ht:label?: x17-211001r2 -->
</td></tr></table></div><hr class="endfloat" />
</div>
<!--l. 24--><p class="noindent" >In the case of file transfers, the arguments are shown in <a
href="#x17-21100015.4">Table 15.4</a>.
<div class="table">
<!--l. 27--><p class="noindent" ><a
id="x17-211002r3"></a><hr class="float"><div class="float"
><table class="float"><tr class="float"><td class="float"
>
<div class="tabular"> <table id="TBL-3" class="tabular"
cellspacing="0" cellpadding="0" rules="groups"
><colgroup id="TBL-3-1g"><col
id="TBL-3-1"></colgroup><colgroup id="TBL-3-2g"><col
id="TBL-3-2"></colgroup><colgroup id="TBL-3-3g"><col
id="TBL-3-3"></colgroup><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-3-1-"><td style="white-space:wrap; text-align:left;" id="TBL-3-1-1"
class="td11"> <!--l. 31--><p class="noindent" ><span
class="cmbx-12">Name</span> </td><td style="white-space:nowrap; text-align:left;" id="TBL-3-1-2"
class="td11"> <span
class="cmbx-12">Type </span></td><td style="white-space:wrap; text-align:left;" id="TBL-3-1-3"
class="td11"> <!--l. 31--><p class="noindent" ><span
class="cmbx-12">Description</span> </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-3-2-"><td style="white-space:wrap; text-align:left;" id="TBL-3-2-1"
class="td11"> <!--l. 33--><p class="noindent" >Uniform
Resource
Locator (<a
href="mainap3.html#url">URL</a>) </td><td style="white-space:nowrap; text-align:left;" id="TBL-3-2-2"
class="td11"> string </td><td style="white-space:wrap; text-align:left;" id="TBL-3-2-3"
class="td11"> <!--l. 33--><p class="noindent" >The <a
href="mainap3.html#url">URL</a> describing the file.
Appropriate schemes for the
<a
href="mainap3.html#url">URL</a>s are file:// and <a
href="mainap3.html#sca">SCA</a>://. The
file scheme applies to the local
file system, while the <a
href="mainap3.html#sca">SCA</a> scheme
applies to the <a
href="mainap3.html#sca">SCA</a> <a
href="mainli2.html#glo:filemanager">File Manager</a>. </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-3-3-"><td style="white-space:wrap; text-align:left;" id="TBL-3-3-1"
class="td11"> <!--l. 35--><p class="noindent" >T </td><td style="white-space:nowrap; text-align:left;" id="TBL-3-3-2"
class="td11"> PrecisionUTCTime </td><td style="white-space:wrap; text-align:left;" id="TBL-3-3-3"
class="td11"> <!--l. 35--><p class="noindent" >The epoch birth date of the first
sample of the sequence passed in
this call. </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-3-4-"><td style="white-space:wrap; text-align:left;" id="TBL-3-4-1"
class="td11"> <!--l. 37--><p class="noindent" ><a
href="mainap3.html#eos">EOS</a> </td><td style="white-space:nowrap; text-align:left;" id="TBL-3-4-2"
class="td11"> boolean </td><td style="white-space:wrap; text-align:left;" id="TBL-3-4-3"
class="td11"> <!--l. 37--><p class="noindent" >Flag describing whether this
particular stream ends with this
<span
class="cmtt-12">pushPacket() </span>call. </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-3-5-"><td style="white-space:wrap; text-align:left;" id="TBL-3-5-1"
class="td11"> <!--l. 39--><p class="noindent" >streamID </td><td style="white-space:nowrap; text-align:left;" id="TBL-3-5-2"
class="td11"> string </td><td style="white-space:wrap; text-align:left;" id="TBL-3-5-3"
class="td11"> <!--l. 39--><p class="noindent" >Stream ID for this particular
payload. This string is used to
reconcile this sequence of data
with a particular Stream <a
href="mainap3.html#sri">SRI</a>
data structure. </td>
</tr></table></div>
<br /> <table class="caption"
><tr style="vertical-align:baseline;" class="caption"><td class="id">Table 15.3: </td><td
class="content">Data fields for <span
class="cmtt-12">pushPacket() </span>call in file transfers</td></tr></table><!--tex4ht:label?: x17-211002r3 -->
</td></tr></table></div><hr class="endfloat" />
</div>
<!--l. 44--><p class="noindent" >As many <span
class="cmtt-12">pushPacket() </span>calls can happen as are needed to transfer data from a uses side to a
provides side. If using omniORB (this is the REDHAWK default), there is maximum
transfer size, which can be is set in the <span
class="cmtt-12">/etc/omniORB.cfg </span>file by changing the defined
value for <span
class="cmtt-12">giopMaxMsgSize</span>. The default maximum transfer size is set to <span
class="cmtt-12">2097152 </span>(2
Megabyte (<a
href="mainap3.html#mb">MB</a>)). For every <span
class="cmtt-12">pushPacket()</span>, the data+headers must be less than this
value, otherwise a <span
class="cmtt-12">MARSHAL </span>exception will be raise by the middleware. The maximum
value can be found during run time by using the <span
class="cmtt-12">omniORB::giopMaxMsgSize() </span>function
call.
<h3 class="sectionHead"><span class="titlemark">15.5 </span> <a
id="x17-21200015.5"></a>Data File Guidance</h3>
<!--l. 3--><p class="noindent" >Data files may be sent via the <a
href="mainap3.html#bulkio">BulkIO</a> <span
class="cmtt-12">dataFile </span>type. When using the <a
href="mainap3.html#bulkio">BulkIO</a> <span
class="cmtt-12">dataFile </span>type, a
filename is passed to the <span
class="cmtt-12">pushPacket() </span>method. The location of the file is specified by a Uniform
Resource Identifier (<a
href="mainap3.html#uri">URI</a>) that either points to the local file system or the <a
href="mainap3.html#sdr">SDR</a> file system. In
order to support portability, use of the <a
href="mainap3.html#sdr">SDR</a> file system is recommended.
<!--l. 9--><p class="noindent" >The following table describes in greater detail the <a
href="mainap3.html#uri">URI</a> options.
<table id="TBL-6" class="tabular"
cellspacing="0" cellpadding="0" rules="groups"
><colgroup id="TBL-6-1g"><col
id="TBL-6-1"></colgroup><colgroup id="TBL-6-2g"><col
id="TBL-6-2"></colgroup><colgroup id="TBL-6-3g"><col
id="TBL-6-3"></colgroup><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-6-1-"><td style="white-space:nowrap; text-align:left;" id="TBL-6-1-1"
class="td11"> <span
class="cmbx-12">Protocol </span></td><td style="white-space:wrap; text-align:left;" id="TBL-6-1-2"
class="td11"> <!--l. 20--><p class="noindent" ><span
class="cmbx-12">Format</span> </td><td style="white-space:wrap; text-align:left;" id="TBL-6-1-3"
class="td11"> <!--l. 20--><p class="noindent" ><span
class="cmbx-12">Description</span> </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-6-2-"><td style="white-space:nowrap; text-align:left;" id="TBL-6-2-1"
class="td11"> file </td><td style="white-space:wrap; text-align:left;" id="TBL-6-2-2"
class="td11"> <!--l. 20--><p class="noindent" ><span
class="cmtt-12">file://[localhost]/</span><span
class="cmmi-12"><</span><span
class="cmtt-12">path</span><span
class="cmmi-12">></span> </td><td style="white-space:wrap; text-align:left;" id="TBL-6-2-3"
class="td11"> <!--l. 20--><p class="noindent" >A host specific absolute path of
the deployed
<a
href="mainli2.html#glo:component">Component</a>/<a
href="mainli2.html#glo:device">Device</a>/<a
href="mainli2.html#glo:service">Service</a>. </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-6-3-"><td style="white-space:nowrap; text-align:left;" id="TBL-6-3-1"
class="td11"> sdr </td><td style="white-space:wrap; text-align:left;" id="TBL-6-3-2"
class="td11"> <!--l. 20--><p class="noindent" ><span
class="cmtt-12">sdr://[</span><a
href="mainap3.html#ior"><span
class="cmtt-12">IOR</span></a><span
class="cmtt-12">]/</span><span
class="cmmi-12"><</span><span
class="cmtt-12">path</span><span
class="cmmi-12">></span> </td><td style="white-space:wrap; text-align:left;" id="TBL-6-3-3"
class="td11"> <!--l. 20--><p class="noindent" >A path on the <a
href="mainli2.html#glo:domainmanager">Domain Manager</a>’s
file system. If the optional <a
href="mainap3.html#ior">IOR</a> is
provided, this path provides the
reference to the <a
href="mainli2.html#glo:domainmanager">Domain Manager</a>.
If not
provided, the <a
href="mainli2.html#glo:domainmanager">Domain Manager</a>
should be default used by the
<a
href="mainli2.html#glo:component">Component</a>/<a
href="mainli2.html#glo:device">Device</a>/<a
href="mainli2.html#glo:service">Service</a> </td>
</tr></table>
<!--l. 1--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">15.6 </span> <a
id="x17-21300015.6"></a>Link Statistics</h3>
<!--l. 3--><p class="noindent" >All <a
href="mainap3.html#bulkio">BulkIO</a> <a
href="mainli2.html#glo:port">Ports</a> contain a read only attribute called statistics. The statistics attribute is of type
<span
class="cmtt-12">BULKIO::PortStatistics</span>, and it contains information regarding the performance of the <a
href="mainli2.html#glo:port">Port</a>.
<a
href="#x17-213001r4">Table 15.4</a> contains a description of a statistics structure
<div class="table">
<!--l. 8--><p class="noindent" ><a
id="x17-213001r4"></a><hr class="float"><div class="float"
><table class="float"><tr class="float"><td class="float"
>
<div class="tabular"> <table id="TBL-7" class="tabular"
cellspacing="0" cellpadding="0" rules="groups"
><colgroup id="TBL-7-1g"><col
id="TBL-7-1"></colgroup><colgroup id="TBL-7-2g"><col
id="TBL-7-2"></colgroup><colgroup id="TBL-7-3g"><col
id="TBL-7-3"></colgroup><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-7-1-"><td style="white-space:nowrap; text-align:left;" id="TBL-7-1-1"
class="td11"> <span
class="cmbx-12">Name </span></td><td style="white-space:wrap; text-align:left;" id="TBL-7-1-2"
class="td11"> <!--l. 11--><p class="noindent" ><span
class="cmbx-12">Type</span> </td><td style="white-space:wrap; text-align:left;" id="TBL-7-1-3"
class="td11"> <!--l. 11--><p class="noindent" ><span
class="cmbx-12">Description</span> </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-7-2-"><td style="white-space:nowrap; text-align:left;" id="TBL-7-2-1"
class="td11"> portName </td><td style="white-space:wrap; text-align:left;" id="TBL-7-2-2"
class="td11"> <!--l. 12--><p class="noindent" >string </td><td style="white-space:wrap; text-align:left;" id="TBL-7-2-3"
class="td11"> <!--l. 12--><p class="noindent" >Name of this <a
href="mainli2.html#glo:port">Port</a> </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-7-3-"><td style="white-space:nowrap; text-align:left;" id="TBL-7-3-1"
class="td11"> elementsPerSecond </td><td style="white-space:wrap; text-align:left;" id="TBL-7-3-2"
class="td11"> <!--l. 13--><p class="noindent" >float </td><td style="white-space:wrap; text-align:left;" id="TBL-7-3-3"
class="td11"> <!--l. 13--><p class="noindent" >A moving average describing
the rate at which elements are
arriving. </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-7-4-"><td style="white-space:nowrap; text-align:left;" id="TBL-7-4-1"
class="td11"> bitsPerSecond </td><td style="white-space:wrap; text-align:left;" id="TBL-7-4-2"
class="td11"> <!--l. 14--><p class="noindent" >float </td><td style="white-space:wrap; text-align:left;" id="TBL-7-4-3"
class="td11"> <!--l. 14--><p class="noindent" >This should be the same as
elementsPerSecond * bits per
elements. </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-7-5-"><td style="white-space:nowrap; text-align:left;" id="TBL-7-5-1"
class="td11"> callsPerSecond </td><td style="white-space:wrap; text-align:left;" id="TBL-7-5-2"
class="td11"> <!--l. 15--><p class="noindent" >float </td><td style="white-space:wrap; text-align:left;" id="TBL-7-5-3"
class="td11"> <!--l. 15--><p class="noindent" >Number of <span
class="cmtt-12">pushPacket() </span>calls
per second. </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-7-6-"><td style="white-space:nowrap; text-align:left;" id="TBL-7-6-1"
class="td11"> streamIDs </td><td style="white-space:wrap; text-align:left;" id="TBL-7-6-2"
class="td11"> <!--l. 16--><p class="noindent" >CF::StringSequence </td><td style="white-space:wrap; text-align:left;" id="TBL-7-6-3"
class="td11"> <!--l. 16--><p class="noindent" >List of all stream ids where a
<span
class="cmtt-12">pushSRI() </span>has occurred but no
<a
href="mainap3.html#eos">EOS</a> has been received. </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-7-7-"><td style="white-space:nowrap; text-align:left;" id="TBL-7-7-1"
class="td11"> averageQueueDepth </td><td style="white-space:wrap; text-align:left;" id="TBL-7-7-2"
class="td11"> <!--l. 17--><p class="noindent" >float </td><td style="white-space:wrap; text-align:left;" id="TBL-7-7-3"
class="td11"> <!--l. 17--><p class="noindent" >Moving average calculation of the
percentage queue depth. </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-7-8-"><td style="white-space:nowrap; text-align:left;" id="TBL-7-8-1"
class="td11"> timeSinceLastCall </td><td style="white-space:wrap; text-align:left;" id="TBL-7-8-2"
class="td11"> <!--l. 18--><p class="noindent" >float </td><td style="white-space:wrap; text-align:left;" id="TBL-7-8-3"
class="td11"> <!--l. 18--><p class="noindent" >The
elapsed time, in seconds, since the
last packet was transferred via a
<span
class="cmtt-12">pushPacket() </span>call </td>
</tr><tr
class="hline"><td><hr></td><td><hr></td><td><hr></td></tr><tr
style="vertical-align:baseline;" id="TBL-7-9-"><td style="white-space:nowrap; text-align:left;" id="TBL-7-9-1"
class="td11"> keywords </td><td style="white-space:wrap; text-align:left;" id="TBL-7-9-2"
class="td11"> <!--l. 19--><p class="noindent" >sequence
<span
class="cmmi-12"><</span>CF::DataType<span
class="cmmi-12">></span> </td><td style="white-space:wrap; text-align:left;" id="TBL-7-9-3"
class="td11"> <!--l. 19--><p class="noindent" >Additional statistics information
provided by the <a
href="mainli2.html#glo:port">Port</a>. </td>
</tr></table></div>
<br /> <table class="caption"
><tr style="vertical-align:baseline;" class="caption"><td class="id">Table 15.4: </td><td
class="content">Fields in returned link statistics</td></tr></table><!--tex4ht:label?: x17-213001r4 -->
</td></tr></table></div><hr class="endfloat" />
</div>
<!--l. 25--><p class="noindent" >The provides-side <a
href="mainli2.html#glo:port">Port</a> contains a single <span
class="cmtt-12">PortStatistics </span>structure. The uses-side <a
href="mainli2.html#glo:port">Port</a>
contains a sequence of <span
class="cmtt-12">PortStatistics </span>structures; each one associated with a single
connection.
<!--l. 28--><p class="noindent" >An interesting exercise is to create <a
href="mainli2.html#glo:component">Components</a> that generate and consume data in the three
languages supported by REDHAWK. The data generator and consumer should generate/consume
data as fast as possible. The statistics data structure can provide metrics regarding data transfer
rates, average latency, and other relevant data. Shifting the transfer length (by changing the size of
the sequence in the <span
class="cmtt-12">pushPacket() </span>call) and seeing its effects on the performance of the connection
is also instructive.
<h3 class="sectionHead"><span class="titlemark">15.7 </span> <a
id="x17-21400015.7"></a>Examples</h3>
<!--l. 3--><p class="noindent" >These two examples illustrate high-speed data exchange between two C++ <a
href="mainli2.html#glo:component">Components</a> and basic
data manipulation through the Sandbox
<!--l. 5--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">15.7.1 </span> <a
id="x17-21500015.7.1"></a>High-speed data</h4>
<!--l. 7--><p class="noindent" >In this example, two C++ <a
href="mainli2.html#glo:component">Components</a> are created: a source and a sink. We will then deploy these
<a
href="mainli2.html#glo:component">Components</a> through the Sandbox and evaluate the statistics of the data transfer between
them.
<!--l. 10--><p class="noindent" >
<ol class="enumerate1" >
<li
class="enumerate" id="x17-215002x1">Create a C++ <a
href="mainli2.html#glo:component">Component</a> called <span
class="cmti-12">source </span>with a uses <a
href="mainli2.html#glo:port">Port</a> called <span
class="cmti-12">output </span>of type
<span
class="cmti-12">dataShort</span>. Add a simple <a
href="mainli2.html#glo:property">Property</a> with <a
href="mainap3.html#id">ID</a> <span
class="cmti-12">xfer</span><span
class="cmti-12">_length</span>, type <span
class="cmti-12">ulong</span>, and default value
of <span
class="cmti-12">100000</span>. Generate the <a
href="mainli2.html#glo:component">Component</a> code.
</li>
<li
class="enumerate" id="x17-215004x2">Open the file <span
class="cmtt-12">source.h </span>and add the following member to the <span
class="cmtt-12">source</span><span
class="cmtt-12">_i </span>class: <script type="syntaxhighlighter" class="brush: cpp"><![CDATA[
std::vector<short> data;
]]></script>
</li>
<li
class="enumerate" id="x17-215006x3">Open the file <span
class="cmtt-12">source.cpp </span>and edit it in the following ways:
<ul class="itemize1">
<li class="itemize">In the <span
class="cmtt-12">source</span><span
class="cmtt-12">_i </span>constructor:</li></ul>
<script type="syntaxhighlighter" class="brush: cpp"><![CDATA[
data.resize(0);
<!--l. 22--><p class="noindent" >]]></script>
</li>
<li
class="enumerate" id="x17-215008x4">In <span
class="cmtt-12">serviceFunction() </span>comment-out the <span
class="cmtt-12">LOG</span><span
class="cmtt-12">_DEBUG </span>statement and add the following lines: <script type="syntaxhighlighter" class="brush: cpp"><![CDATA[
if (data.size() != this->xfer_length) {
data.resize(xfer_length);
BULKIO::StreamSRI sri = BULKIO::StreamSRI();
sri.hversion = 1;
sri.xstart = 0.0;
sri.xdelta = 0.0;
sri.xunits = BULKIO::UNITS_TIME;
sri.subsize = 0;
sri.ystart = 0.0;
sri.ydelta = 0.0;
sri.yunits = BULKIO::UNITS_NONE;
sri.mode = 0;
sri.streamID = "sample";
this->output->pushSRI(sri);
}
BULKIO::PrecisionUTCTime tstamp =
BULKIO::PrecisionUTCTime();
tstamp.tcmode = BULKIO::TCM_CPU;
tstamp.tcstatus = (short)1;
tstamp.toff = 0.0;
tstamp.twsec = 0.0;
tstamp.tfsec = 0.0;
this->output->pushPacket(data,tstamp,false,"sample");
return NORMAL;
]]></script>
</li>
<li
class="enumerate" id="x17-215010x5">Compile the <a
href="mainli2.html#glo:component">Component</a> <span
class="cmtt-12">source </span>and install it on Target SDR.
</li>
<li
class="enumerate" id="x17-215012x6">Create a C++ <a
href="mainli2.html#glo:component">Component</a> called <span
class="cmti-12">sink </span>with a provides <a
href="mainli2.html#glo:port">Port</a> called <span
class="cmti-12">input </span>of type <span
class="cmti-12">dataShort</span>.
Generate the <a
href="mainli2.html#glo:component">Component</a> code.
</li>
<li
class="enumerate" id="x17-215014x7">Open the file <span
class="cmtt-12">sink.cpp </span>and edit it in the following ways:
<ol class="enumerate2" >
<li
class="enumerate" id="x17-215016x1">In <span
class="cmtt-12">serviceFunction()</span>, comment-out the <span
class="cmtt-12">LOG</span><span
class="cmtt-12">_DEBUG </span>statement
</li>
<li
class="enumerate" id="x17-215018x2">Add the following lines: <script type="syntaxhighlighter" class="brush: cpp"><![CDATA[
::BULKIO_dataShort_In_i::dataTransfer *tmp =
this->input->getPacket(-1);
if (tmp == NULL) {
return NOOP;
} else {
delete tmp;
return NORMAL;
}
]]></script>
</li></ol>
</li>
<li
class="enumerate" id="x17-215020x8">Compile the <a
href="mainli2.html#glo:component">Component</a> <span
class="cmtt-12">sink </span>and install it on Target SDR.
<!--l. 72--><p class="noindent" >Start a Python session in a command line terminal and run the following commands:</li></ol>
<script type="syntaxhighlighter" class="brush: python"><![CDATA[
>>> from ossie.utils import sb
>>> source = sb.Component("source")
>>> sink = sb.Component("sink")
>>> source.connect(sink)
>>> sb.start()
>>> print source._ports[0]._get_statistics()[0].statistics
]]></script>
<!--l. 84--><p class="noindent" >The output of the print statement is an instance of the <span
class="cmtt-12">PortStatistics </span>structure in <a
href="mainap3.html#bulkio">BulkIO</a>. This
structure contains the statistics gathered from this connection. A measure of data rate is bits per
second.
<!--l. 88--><p class="noindent" >To display the number of Gigabits per second, run the following command:
<script type="syntaxhighlighter" class="brush: python"><![CDATA[
>>> print source._ports[0]._get_statistics()[0].\
... statistics.bitsPerSecond/1e9
]]></script>
<!--l. 95--><p class="noindent" >The resulting value is the measured data transfer rate between the two <a
href="mainli2.html#glo:component">Components</a>. The current
<span
class="cmtt-12">xfer</span><span
class="cmtt-12">_length </span><a
href="mainli2.html#glo:property">Property</a> can be viewed by typing the following:
<script type="syntaxhighlighter" class="brush: python"><![CDATA[
>>> source.xfer_length
]]></script>
<!--l. 102--><p class="noindent" >The default value is <span
class="cmtt-12">100000</span>. Update the <a
href="mainli2.html#glo:property">Property</a> to <span
class="cmtt-12">200000 </span>by running the following
command:
<script type="syntaxhighlighter" class="brush: python"><![CDATA[
>>> source.xfer_length = 200000
]]></script>
<!--l. 108--><p class="noindent" >Check the new data rate by repeating the call to <span
class="cmtt-12">_get</span><span
class="cmtt-12">_statistics()</span>. The resulting data rate
should now be different.
<!--l. 111--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">15.7.2 </span> <a
id="x17-21600015.7.2"></a>Data manipulation</h4>
<!--l. 113--><p class="noindent" >In this example, a Python <a
href="mainli2.html#glo:component">Component</a> is created that takes vectors of floats as inputs, multiplies
the vector by some arbitrary number, and then outputs the resulting vector. This example
demonstrates some basic data manipulation as well as the interaction between the Python
environment and the running <a
href="mainli2.html#glo:component">Component</a>.
<!--l. 115--><p class="noindent" >
<ol class="enumerate1" >
<li
class="enumerate" id="x17-216002x1">Create a Python <a
href="mainli2.html#glo:component">Component</a> called <span
class="cmti-12">mult </span>with a provides <a
href="mainli2.html#glo:port">Port</a> called <span
class="cmti-12">input </span>of type
<span
class="cmti-12">dataFloat </span>and a uses <a
href="mainli2.html#glo:port">Port</a> called <span
class="cmti-12">output </span>of type <span
class="cmti-12">dataFloat</span>. Add a simple <a
href="mainli2.html#glo:property">Property</a> with
<a
href="mainap3.html#id">ID</a> <span
class="cmti-12">factor</span>, type <span
class="cmti-12">float</span>, and default value of <span
class="cmti-12">1</span>. Generate the <a
href="mainli2.html#glo:component">Component</a> code.
</li>
<li
class="enumerate" id="x17-216004x2">Open the file <span
class="cmtt-12">mult.py </span>and add the following lines:
<script type="syntaxhighlighter" class="brush: python"><![CDATA[
data, T, EOS, streamID, sri, sriChanged, inputQueueFlushed =
self.port_input.getPacket()
if data == None:
return NOOP
outData = []
for value in data:
outData.append(value*self.factor)
if sriChanged:
self.port_output.pushSRI(sri)
self.port_output.pushPacket(outData, T, EOS, streamID)
return NORMAL
]]></script>
</li>
<li
class="enumerate" id="x17-216006x3">Save the project and drag the <span
class="cmtt-12">mult </span>project to SCA Explorer<span
class="cmmi-12">> </span>Target SDR.
</li>
<li
class="enumerate" id="x17-216008x4">Start a Python session in a command line terminal and run the following commands:
<script type="syntaxhighlighter" class="brush: python"><![CDATA[
>>> from ossie.utils import sb
>>> mult = sb.Component("mult")
>>> source = sb.DataSource(dataFormat="float")
>>> sink = sb.DataSink()
>>> source.connect(mult)
>>> mult.connect(sink)
>>> sb.start()
>>> source.push([1,2,3,4,5])
>>> sink.getData()
[1.0, 2.0, 3.0, 4.0, 5.0]
]]></script>
</li>
<li
class="enumerate" id="x17-216010x5">The multiplication factor can be changed while the Sandbox is up.
<script type="syntaxhighlighter" class="brush: python"><![CDATA[
>>> mult.factor = 2
>>> source.push([1,2,3,4,5])
>>> sink.getData()
[2.0, 4.0, 6.0, 8.0, 10.0]
]]></script>
</li></ol>
<!--l. 1--><div class="crosslinks"><p class="noindent">[<a
href="mainch16.html" >next</a>] [<a
href="mainch14.html" >prev</a>] [<a
href="mainch14.html#tailmainch14.html" >prev-tail</a>] [<a
href="mainch15.html" >front</a>] [<a
href="main.html#mainch15.html" >up</a>] </p></div>
<!--l. 1--><p class="noindent" ><a
id="tailmainch15.html"></a>
<div class=license>
<hr>
<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png" /></a><br /><span xmlns:dct="http:// purl.org/dc/terms/" property="dct:title">REDHAWK Documentation</span> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>.
</div>
</body></html>