forked from RedhawkSDR/Documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainch3.html
819 lines (783 loc) · 39.8 KB
/
mainch3.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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html >
<head><title>3 Components in Brief</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="mainch4.html" >next</a>] [<a
href="mainch2.html" >prev</a>] [<a
href="mainch2.html#tailmainch2.html" >prev-tail</a>] [<a
href="#tailmainch3.html">tail</a>] [<a
href="main.html#mainch3.html" >up</a>] </p></div>
<h2 class="chapterHead"><span class="titlemark">Chapter 3</span><br /><a
id="x5-180003"></a>Components in Brief</h2>
<h3 class="sectionHead"><span class="titlemark">3.1 </span> <a
id="x5-190003.1"></a>Introduction</h3>
<!--l. 6--><p class="noindent" >A <a
href="mainli2.html#glo:component">Component</a> is a modular building block that can be inserted into any number of signal
processing applications to perform a specific and reusable function. A <a
href="mainli2.html#glo:component">Component</a> is fully
defined by its interfaces, <a
href="mainli2.html#glo:property">Properties</a>, and functionality. Examples include a <a
href="mainli2.html#glo:component">Component</a>
that will tune, filter, and decimate a wideband signal and one that would perform a
Frequency Modulation (<a
href="mainap3.html#fm">FM</a>) demodulation. Some <a
href="mainli2.html#glo:component">Components</a> will inevitably need to be
custom implementations, but a majority of signal processing functions can be reused and
shared.
<!--l. 11--><p class="noindent" >REDHAWK allows for developers to create <a
href="mainli2.html#glo:component">Components</a> in either C++, Python, or Java. C++ is
recommended for most computationally-intensive tasks, whereas Python or Java work well at
handling metadata manipulation or command and control tasks.
<!--l. 14--><p class="noindent" ><a
href="mainli2.html#glo:component">Components</a> can be interconnected together within a <a
href="mainli2.html#glo:waveformapplication">Waveform</a> to create a complete signal
processing application or can be run independently in the REDHAWK Sandbox to perform trivial
tasks on a local host. The figure below depicts the composition of <a
href="mainli2.html#glo:component">Components</a> into a
<a
href="mainli2.html#glo:waveformapplication">Waveform</a>.
<!--l. 17--><p class="noindent" ><hr class="figure"><div class="figure"
><table class="figure"><tr class="figure"><td class="figure"
>
<a
id="x5-19001r1"></a>
<!--l. 19--><p class="noindent" ><img
src="images/REDHAWK_Component_Workflow_Graphic.png" alt="PIC"
>
<br /> <table class="caption"
><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 3.1: </td><td
class="content">REDHAWK Workflow</td></tr></table><!--tex4ht:label?: x5-19001r1 -->
<!--l. 21--><p class="noindent" ></td></tr></table></div><hr class="endfigure">
<div
class="centerline"> </div>
<!--l. 24--><p class="noindent" >By using the REDHAWK Framework, basic processing elements may be encapsulated as
<a
href="mainli2.html#glo:component">Components</a> and reused by other REDHAWK compliant systems. Using the REDHAWK <a
href="mainap3.html#ide">IDE</a> and
the included code generators, much of the code for control and input/output can be
auto-generated. The figure below depicts the encapsulation of an arbitrary processing algorithm
into an auto-generated REDHAWK <a
href="mainli2.html#glo:component">Component</a> wrapper.
<!--l. 28--><p class="noindent" ><hr class="figure"><div class="figure"
><table class="figure"><tr class="figure"><td class="figure"
>
<a
id="x5-19002r2"></a>
<!--l. 30--><p class="noindent" ><img
src="images/REDHAWK_Component_Container_Graphic.png" alt="PIC"
>
<br /> <table class="caption"
><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 3.2: </td><td
class="content">Components</td></tr></table><!--tex4ht:label?: x5-19002r2 -->
<!--l. 32--><p class="noindent" ></td></tr></table></div><hr class="endfigure">
<h3 class="sectionHead"><span class="titlemark">3.2 </span> <a
id="x5-200003.2"></a>Creating a Component Project</h3>
<!--l. 36--><p class="noindent" >In this section, an overview of the structure of a <a
href="mainli2.html#glo:component">Component</a> is presented.
<!--l. 38--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">3.2.1 </span> <a
id="x5-210003.2.1"></a>Component Wizard</h4>
<!--l. 40--><p class="noindent" >In the REDHAWK <a
href="mainap3.html#ide">IDE</a>, development of new <a
href="mainli2.html#glo:component">Components</a>, <a
href="mainli2.html#glo:device">Devices</a>, or other artifacts in a
REDHAWK environment is contained within an Eclipse project. Each REDHAWK-specific artifact
is associated with a wizard that leads the developer through the steps necessary to create a project
which supports the minimum required pieces for proper functioning. For <a
href="mainli2.html#glo:component">Components</a>, the default
project settings allow the developer to choose between Python, C++, and Java as the
development language. To start the <a
href="mainap3.html#ide">IDE</a> and begin creating a <a
href="mainli2.html#glo:component">Component</a>, run the <span
class="cmtt-12">eclipse</span>
binary in the <a
href="mainap3.html#ide">IDE</a> installation directory. Then, select <span
class="cmbx-12">File </span><span
class="cmmi-12">> </span><span
class="cmbx-12">New </span><span
class="cmmi-12">> </span><a
href="mainap3.html#sca"><span
class="cmbx-12">SCA</span></a> <a
href="mainli2.html#glo:component"><span
class="cmbx-12">Component</span></a>
<span
class="cmbx-12">Project</span>.
<!--l. 46--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">3.2.2 </span> <a
id="x5-220003.2.2"></a>Component Descriptors</h4>
<!--l. 48--><p class="noindent" >A REDHAWK <a
href="mainli2.html#glo:component">Component</a> is described through three Extensible Markup Language (<a
href="mainap3.html#xml">XML</a>)
files, a Software Package Descriptor (<a
href="mainap3.html#spd">SPD</a>) file (<span
class="cmmi-12"><</span><span
class="cmtt-12">component</span><span
class="cmmi-12">></span><span
class="cmtt-12">.spd.xml</span>), a Properties
File (<a
href="mainap3.html#prf">PRF</a>) file (<span
class="cmmi-12"><</span><span
class="cmtt-12">component</span><span
class="cmmi-12">></span><span
class="cmtt-12">.prf.xml</span>), and a Software Component Descriptor (<a
href="mainap3.html#scd">SCD</a>) file
(<span
class="cmmi-12"><</span><span
class="cmtt-12">component</span><span
class="cmmi-12">></span><span
class="cmtt-12">.scd.xml</span>). The role of the <a
href="mainap3.html#spd">SPD</a> is to describe all the files that are associated with
the <a
href="mainli2.html#glo:component">Component</a>: the <a
href="mainap3.html#prf">PRF</a> and <a
href="mainap3.html#scd">SCD</a> files, all binaries, and associated data files. The <a
href="mainap3.html#prf">PRF</a> file
contains a description of all the <a
href="mainli2.html#glo:property">Properties</a> that this <a
href="mainli2.html#glo:component">Component</a> supports. The <a
href="mainap3.html#scd">SCD</a> file contains a
description of the inputs/outputs for the <a
href="mainli2.html#glo:component">Component</a>.
<!--l. 52--><p class="noindent" >The REDHAWK <a
href="mainap3.html#ide">IDE</a> uses an internal model to maintain the state of the <a
href="mainli2.html#glo:component">Component</a> design.
This model is a Java representation of the three <a
href="mainap3.html#xml">XML</a> files described above as well as
project-specific information (like the development language). The main screen on the <a
href="mainli2.html#glo:component">Component</a>
development perspective contains several tabs. Some of these tabs are for panels and
some are for <a
href="mainap3.html#xml">XML</a> files. The different panels available for <a
href="mainli2.html#glo:component">Component</a> design are used to
change this model; the model is automatically and continuously mapped to the three
<a
href="mainap3.html#xml">XML</a> files. This awareness is symmetrical; much like changes in the panels will result in
changes in the <a
href="mainap3.html#xml">XML</a> files, changes in the <a
href="mainap3.html#xml">XML</a> files will result in automatic updates to the
panels.
<!--l. 59--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">3.2.3 </span> <a
id="x5-230003.2.3"></a>Ports</h4>
<!--l. 61--><p class="noindent" >Data flow into and out of <a
href="mainli2.html#glo:component">Components</a> is accomplished through the use of <a
href="mainli2.html#glo:port">Ports</a>. <a
href="mainli2.html#glo:port">Ports</a> are
described as being either a <span
class="cmbx-12">provides </span>(input) or <span
class="cmbx-12">uses </span>(output) <a
href="mainli2.html#glo:port">Port</a>. This naming convention is
often viewed as counter-intuitive, so an explanation is in order. <a
href="mainli2.html#glo:port">Ports</a> are Remote Procedure
Call (<a
href="mainap3.html#rpc">RPC</a>) interfaces to a <a
href="mainli2.html#glo:component">Component</a>. An input <a
href="mainli2.html#glo:port">Port</a> therefore <span
class="cmbx-12">provides </span>functionality that can
be <span
class="cmbx-12">used </span>by an output <a
href="mainli2.html#glo:port">Port</a>.
<!--l. 67--><p class="noindent" >REDHAWK contains a variety of standardized interfaces that facilitate interoperability. These
interfaces are implemented by <a
href="mainli2.html#glo:port">Ports</a>. When a <a
href="mainli2.html#glo:port">Port</a> is selected in the <a
href="mainli2.html#glo:component">Component</a> generation
wizard in the REDHAWK <a
href="mainap3.html#ide">IDE</a>, code to implement these interfaces is automatically
generated.
<!--l. 71--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">3.2.4 </span> <a
id="x5-240003.2.4"></a>Properties</h4>
<!--l. 73--><p class="noindent" >Properties provide a way to maintain <a
href="mainli2.html#glo:component">Component</a> states while also allowing external entities (e.g.,
programs, <a
href="mainap3.html#ui">UI</a>s, or status scripts) to inspect the state of the <a
href="mainli2.html#glo:component">Component</a>. Properties are the primary
means for <a
href="mainli2.html#glo:component">Component</a> configuration.
<!--l. 76--><p class="noindent" >There are four types of <a
href="mainli2.html#glo:property">Properties</a>: <span
class="cmtt-12">simple</span>, <span
class="cmtt-12">simple sequence</span>, <span
class="cmtt-12">struct</span>, and <span
class="cmtt-12">struct sequence</span>. A
<span
class="cmtt-12">simple </span><a
href="mainli2.html#glo:property">Property</a> can be one of several well-defined primitive types (e.g., <span
class="cmtt-12">short </span>or <span
class="cmtt-12">float</span>). A
<span
class="cmtt-12">simple sequence </span>is an array of values of a common primitive type. A <span
class="cmtt-12">struct </span>property is a
structure that contains a set of named <a
href="mainli2.html#glo:property">Properties</a> with primitive types. A <span
class="cmtt-12">struct sequence</span>
is a sequence of struct <a
href="mainli2.html#glo:property">Properties</a>, where all elements in the sequence have the same
structure.
<!--l. 82--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">3.2.5 </span> <a
id="x5-250003.2.5"></a>Logging</h4>
<!--l. 84--><p class="noindent" ><a
href="mainli2.html#glo:component">Components</a>, irrespective of which language is used for their implementation, contain access to
loggers. Logging in C++, Python, and Java utilizes log4j, a powerful logging framework
maintained by the Apache Software Foundation.
<!--l. 87--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">3.2.6 </span> <a
id="x5-260003.2.6"></a>Component Generation</h4>
<!--l. 89--><p class="noindent" >On the top-right of the Overview panel of the <a
href="mainli2.html#glo:component">Component</a> development project is the <span
class="cmbx-12">Generate</span>
<span
class="cmbx-12">All Implementations </span>button (see <a
href="#x5-26001r3">Figure 3.3</a>).
<!--l. 91--><p class="noindent" ><hr class="figure"><div class="figure"
><table class="figure"><tr class="figure"><td class="figure"
>
<a
id="x5-26001r3"></a>
<!--l. 93--><p class="noindent" ><img
src="images/Generate_Code_Highlighted.png" alt="PIC"
>
<br /> <table class="caption"
><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 3.3: </td><td
class="content"><span
class="cmbx-12">Generate Component </span>Button</td></tr></table><!--tex4ht:label?: x5-26001r3 -->
<!--l. 96--><p class="noindent" ></td></tr></table></div><hr class="endfigure">
<!--l. 98--><p class="noindent" >Upon clicking this button, the tool will generate:
<ul class="itemize1">
<li class="itemize">skeleton-code for the <a
href="mainli2.html#glo:component">Component</a> in the language of choice
</li>
<li class="itemize">the <a
href="mainap3.html#xml">XML</a> files associated with the <a
href="mainli2.html#glo:component">Component</a>
</li>
<li class="itemize">Autotools build files</li></ul>
<h4 class="subsectionHead"><span class="titlemark">3.2.7 </span> <a
id="x5-270003.2.7"></a>Component Installation</h4>
<!--l. 106--><p class="noindent" >Once a <a
href="mainli2.html#glo:component">Component</a> is compiled, it can be installed onto the staging area (<span
class="cmtt-12">$SDRROOT/dom/components</span>)
by either dragging the project on the <a
href="mainap3.html#ide">IDE</a> from the <span
class="cmbx-12">Project Explorer </span>to the <span
class="cmbx-12">Target Software</span>
<span
class="cmbx-12">Defined Radio (</span><a
href="mainap3.html#sdr"><span
class="cmbx-12">SDR</span></a><span
class="cmbx-12">) </span>section of the <a
href="mainap3.html#sca"><span
class="cmbx-12">SCA</span></a> <span
class="cmbx-12">Explorer </span>or by invoking <span
class="cmtt-12">make install </span>in the
directory containing the <a
href="mainli2.html#glo:component">Component</a> <span
class="cmtt-12">Makefile</span>.
<!--l. 108--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">3.3 </span> <a
id="x5-280003.3"></a>Running a Component</h3>
<!--l. 110--><p class="noindent" >There are two mechanisms that can be used to run a <a
href="mainli2.html#glo:component">Component</a>: the REDHAWK Sandbox and
the REDHAWK <a
href="mainli2.html#glo:domain">Domain</a>. When using the Sandbox, a <a
href="mainli2.html#glo:component">Component</a> is run from within a
Python shell or a graphical environment, all operating on a single computer. When
using the <a
href="mainli2.html#glo:domain">Domain</a>, a <a
href="mainli2.html#glo:component">Component</a> is run in the context of an <a
href="mainli2.html#glo:application">Application</a> that can be
deployed over an arbitrarily large number of computers. The Sandbox is useful for tasks
such as signal processing development and analysis, <a
href="mainli2.html#glo:component">Component</a> debugging, and data
inspection.
<!--l. 115--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">3.4 </span> <a
id="x5-290003.4"></a>Sandbox</h3>
<!--l. 117--><p class="noindent" >This section describes how to use the Sandbox either from a Python shell or through a <a
href="mainap3.html#ui">UI</a> available
on the REDHAWK <a
href="mainap3.html#ide">IDE</a>.
<!--l. 119--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">3.4.1 </span> <a
id="x5-300003.4.1"></a>Python Sandbox</h4>
<!--l. 121--><p class="noindent" >The Sandbox can be accessed directly from the command line and is used to manipulate new
<a
href="mainli2.html#glo:component">Components</a> and <a
href="mainli2.html#glo:waveformapplication">Waveforms</a>. This provides a very powerful means of testing and scripting tests for
REDHAWK systems.
<!--l. 124--><p class="noindent" >The following is a short overview of how to use the Sandbox; for a more detailed description of the
Python Sandbox, see <a
href="mainch9.html#x11-1290009">Chapter 9</a>.
<!--l. 127--><p class="noindent" >
<ol class="enumerate1" >
<li
class="enumerate" id="x5-30002x1">Open a Python session and import the Sandbox: <script type="syntaxhighlighter" class="brush: python"><![CDATA[
$ python
Python 2.4.3 (#1, Sep 3 2009, 15:37:12)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> from ossie.utils import sb
]]></script>
</li>
<li
class="enumerate" id="x5-30004x2">Running a <a
href="mainli2.html#glo:component">Component</a>
<ol class="enumerate2" >
<li
class="enumerate" id="x5-30006x1">To get a list of available <a
href="mainli2.html#glo:component">Components</a>, type: <script type="syntaxhighlighter" class="brush: python"><![CDATA[
>>> sb.catalog()
['HardLimit', 'SigGen', ...]
]]></script>
The returned list is derived by doing a scan of <span
class="cmtt-12">$SDRROOT</span>. HardLimit and SigGen are
examples of existing <a
href="mainli2.html#glo:component">Components</a>.
</li>
<li
class="enumerate" id="x5-30008x2">Create the <a
href="mainli2.html#glo:component">Component</a> object by typing: <script type="syntaxhighlighter" class="brush: python"><![CDATA[
>>> hardLimit = sb.Component("HardLimit")
>>> sigGen = sb.Component("SigGen")
]]></script>
After the constructor is finished, the <a
href="mainli2.html#glo:component">Components</a> will be running as their
own processes. Note that if an absolute file path for a <a
href="mainli2.html#glo:component">Component</a>’s <a
href="mainap3.html#spd">SPD</a> file
(<span
class="cmmi-12"><</span><span
class="cmtt-12">component</span><span
class="cmmi-12">></span><span
class="cmtt-12">.spd.xml</span>) is given as a constructor argument for the <a
href="mainli2.html#glo:component">Component</a>
instance, then that <a
href="mainli2.html#glo:component">Component</a> is started irrespective of whether or not it is present in
<span
class="cmtt-12">$SDRROOT</span>.</li></ol>
</li>
<li
class="enumerate" id="x5-30010x3">Support widgets are available in the Sandbox to help the developer interact with running
<a
href="mainli2.html#glo:component">Components</a>. There are a variety of widgets, including data sources and sinks, a
speaker interface, and plotters. For the sake of this example, the plot widget is
used.
<!--l. 154--><p class="noindent" >In order to use plotting, the path to the eclipse directory of the installed <a
href="mainap3.html#ide">IDE</a> must be
specified in the Sandbox (this can also be done by setting the RH_IDE environment variable
to the absolute path of the eclipse directory prior to starting the Python session): <script type="syntaxhighlighter" class="brush: python"><![CDATA[
>>> sb.IDELocation('/path/to/ide/eclipse')
>>> plot = sb.Plot()
]]></script>
<!--l. 160--><p class="noindent" >
<ol class="enumerate2" >
<li
class="enumerate" id="x5-30012x1">Create two plot objects by instantiating the <span
class="cmtt-12">Plot </span>class twice and assigning the objects to local variables: <script type="syntaxhighlighter" class="brush: python"><![CDATA[
>>> plot1 = sb.Plot()
>>> plot2 = sb.Plot()
]]></script>
</li></ol>
</li>
<li
class="enumerate" id="x5-30014x4">Connect the <a
href="mainli2.html#glo:component">Components</a> together and connect the plots. The <span
class="cmtt-12">connect() </span>method will try to match
the <a
href="mainli2.html#glo:port">Port</a>; ambiguities can be resolved with the parameters <span
class="cmtt-12">usesPortName </span>and <span
class="cmtt-12">providesPortName</span>.
Connecting the plots to the <a
href="mainli2.html#glo:component">Components</a> will present the plot application window. <script type="syntaxhighlighter" class="brush: python"><![CDATA[
>>> sigGen.connect(hardLimit)
>>> sigGen.connect(plot1)
>>> hardLimit.connect(plot2)
]]></script>
</li>
<li
class="enumerate" id="x5-30016x5">For the purposes of this tutorial, the <span
class="cmtt-12">SigGen </span><a
href="mainli2.html#glo:component">Component</a> will be configured before
it is started to get a better visual. Set the frequency of <span
class="cmtt-12">sigGen </span>equal to <span
class="cmti-12">5006</span>: <script type="syntaxhighlighter" class="brush: python"><![CDATA[
>>> sigGen.frequency = 5006
]]></script>
</li>
<li
class="enumerate" id="x5-30018x6">Start everything in the Sandbox: <script type="syntaxhighlighter" class="brush: python"><![CDATA[
>>> sb.start()
]]></script>
</li>
<li
class="enumerate" id="x5-30020x7">The <a
href="mainli2.html#glo:property">Property</a> values can now be set on the <span
class="cmtt-12">hardLimit </span><a
href="mainli2.html#glo:component">Component</a>. The plot should reflect the <a
href="mainli2.html#glo:property">Property</a> change: <script type="syntaxhighlighter" class="brush: python"><![CDATA[
>>> hardLimit.upper_limit = .8
]]></script>
</li>
<li
class="enumerate" id="x5-30022x8">To inspect the <a
href="mainli2.html#glo:property">Properties</a> and input/output <a
href="mainli2.html#glo:port">Ports</a> of a <a
href="mainli2.html#glo:component">Component</a>, invoke the <a
href="mainli2.html#glo:component">Component</a>’s <span
class="cmtt-12">api() </span>method: <script type="syntaxhighlighter" class="brush: python"><![CDATA[
>>> sigGen.api()
]]></script>
</li>
<li
class="enumerate" id="x5-30024x9">To clean up, type <span
class="cmtt-12">Ctrl+D </span>to end the Python session. The Python Sandbox will release all
<a
href="mainli2.html#glo:component">Components</a> and cleanup whatever plots or additional widgets were created during the
session.</li></ol>
<!--l. 192--><p class="noindent" >
<h4 class="subsectionHead"><span class="titlemark">3.4.2 </span> <a
id="x5-310003.4.2"></a>The IDE Sandbox</h4>
<!--l. 194--><p class="noindent" >This section provides an overview of how to use the Sandbox in the REDHAWK <a
href="mainap3.html#ide">IDE</a>. The <a
href="mainap3.html#ide">IDE</a>
Sandbox provides a graphical environment for launching, inspecting, and debugging
<a
href="mainli2.html#glo:component">Components</a> and <a
href="mainli2.html#glo:device">Devices</a>. In addition, via the REDHAWK <a
href="mainap3.html#sca">SCA</a> Console, you can use the
Python-based Sandbox <a
href="mainap3.html#api">API</a> to interact with objects that are running within the <a
href="mainap3.html#ide">IDE</a>
Sandbox.
<!--l. 198--><p class="noindent" >
<ol class="enumerate1" >
<li
class="enumerate" id="x5-31002x1">In the <a
href="mainap3.html#sca"><span
class="cmbx-12">SCA</span></a> <span
class="cmbx-12">Explorer View</span>:
<ol class="enumerate2" >
<li
class="enumerate" id="x5-31004x1">Expand the <span
class="cmbx-12">Sandbox </span>to expose the <span
class="cmbx-12">Chalkboard</span>
</li>
<li
class="enumerate" id="x5-31006x2">Double-click the <span
class="cmbx-12">Chalkboard</span></li></ol>
<!--l. 204--><p class="noindent" ><hr class="figure"><div class="figure"
><table class="figure"><tr class="figure"><td class="figure"
><a
id="x5-31007r4"></a> <img
src="images/REDHAWK_Example_HardLimit_Chalkboard_Highlighted.png" alt="PIC"
>
<br /> <table class="caption"
><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 3.4: </td><td
class="content">Open Chalkboard</td></tr></table><!--tex4ht:label?: x5-31007r4 -->
<!--l. 208--><p class="noindent" ></td></tr></table></div><hr class="endfigure">
</li>
<li
class="enumerate" id="x5-31009x2">From the Chalkboard:
<ol class="enumerate2" >
<li
class="enumerate" id="x5-31011x1">Select the palette on the right, drag the <span
class="cmtt-12">SigGen </span><a
href="mainli2.html#glo:component">Component</a> onto the
<span
class="cmbx-12">Chalkboard</span>. This <a
href="mainli2.html#glo:component">Component</a> will be used to help test the new <span
class="cmtt-12">HardLimit</span>
<a
href="mainli2.html#glo:component">Component</a>.
</li>
<li
class="enumerate" id="x5-31013x2">If asked to choose an implementation, select the <span
class="cmbx-12">cpp </span>implementation
</li>
<li
class="enumerate" id="x5-31015x3">Right-click on the <span
class="cmtt-12">SigGen </span><a
href="mainli2.html#glo:component">Component</a>, click <span
class="cmbx-12">Start </span><hr class="figure"><div class="figure"
><table class="figure"><tr class="figure"><td class="figure"
><a
id="x5-31016r5"></a> <img
src="images/REDHAWK_Example_HardLimit_Sandbox_Start_Comp.png" alt="PIC"
>
<br /> <table class="caption"
><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 3.5: </td><td
class="content">Start Component</td></tr></table><!--tex4ht:label?: x5-31016r5 -->
<!--l. 219--><p class="noindent" ></td></tr></table></div><hr class="endfigure">
</li>
<li
class="enumerate" id="x5-31018x4">Right-click on the <span
class="cmbx-12">out </span><a
href="mainli2.html#glo:port">Port</a> and click <span
class="cmbx-12">Plot </span><a
href="mainli2.html#glo:port"><span
class="cmbx-12">Port</span></a> <span
class="cmbx-12">Data </span><hr class="figure"><div class="figure"
><table class="figure"><tr class="figure"><td class="figure"
><a
id="x5-31019r6"></a> <img
src="images/REDHAWK_Example_HardLimit_Sandbox_Plot_Port.png" alt="PIC"
>
<br /> <table class="caption"
><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 3.6: </td><td
class="content">Plot Port Data</td></tr></table><!--tex4ht:label?: x5-31019r6 -->
<!--l. 225--><p class="noindent" ></td></tr></table></div><hr class="endfigure">
</li>
<li
class="enumerate" id="x5-31021x5">Right-click on the <span
class="cmtt-12">SigGen </span><a
href="mainli2.html#glo:component">Component</a>, click <span
class="cmbx-12">Show Properties View</span>. A new
view should open displaying the signal <a
href="mainli2.html#glo:property">Properties</a> <hr class="figure"><div class="figure"
><table class="figure"><tr class="figure"><td class="figure"
><a
id="x5-31022r7"></a> <img
src="images/REDHAWK_Example_HardLimit_Sandbox_Show_Prop.png" alt="PIC"
>
<br /> <table class="caption"
><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 3.7: </td><td
class="content">Show Properties View</td></tr></table><!--tex4ht:label?: x5-31022r7 -->
<!--l. 231--><p class="noindent" ></td></tr></table></div><hr class="endfigure">
</li>
<li
class="enumerate" id="x5-31024x6">Change the following signal <a
href="mainli2.html#glo:property">Properties</a>:
<ul class="itemize1">
<li class="itemize">frequency: 100
</li>
<li class="itemize">magnitude: 10</li></ul>
<!--l. 237--><p class="noindent" ><hr class="figure"><div class="figure"
><table class="figure"><tr class="figure"><td class="figure"
><a
id="x5-31025r8"></a> <img
src="images/REDHAWK_Example_HardLimit_Sandbox_Prop_Change.png" alt="PIC"
>
<br /> <table class="caption"
><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 3.8: </td><td
class="content">Change Property Value</td></tr></table><!--tex4ht:label?: x5-31025r8 -->
<!--l. 241--><p class="noindent" ></td></tr></table></div><hr class="endfigure">
</li>
<li
class="enumerate" id="x5-31027x7">Select the palette on the right, drag the <span
class="cmtt-12">HardLimit </span><a
href="mainli2.html#glo:component">Component</a> onto the
<span
class="cmbx-12">Chalkboard</span>.
</li>
<li
class="enumerate" id="x5-31029x8">Right-click on the <span
class="cmtt-12">HardLimit </span><a
href="mainli2.html#glo:component">Component</a>, click <span
class="cmbx-12">Start</span>
</li>
<li
class="enumerate" id="x5-31031x9">Connect the <span
class="cmbx-12">out </span><a
href="mainli2.html#glo:port">Port</a> on the <span
class="cmtt-12">SigGen </span><a
href="mainli2.html#glo:component">Component</a> to the <span
class="cmbx-12">dataDouble</span><span
class="cmbx-12">_in </span><a
href="mainli2.html#glo:port">Port</a>
on the <span
class="cmtt-12">HardLimit </span><a
href="mainli2.html#glo:component">Component</a> by clicking and dragging from the solid black
output <a
href="mainli2.html#glo:port">Port</a> to the input <a
href="mainli2.html#glo:port">Port</a>. <hr class="figure"><div class="figure"
><table class="figure"><tr class="figure"><td class="figure"
><a
id="x5-31032r9"></a> <img
src="images/REDHAWK_Example_HardLimit_Sandbox_Connect_Comp.png" alt="PIC"
>
<br /> <table class="caption"
><tr style="vertical-align:baseline;" class="caption"><td class="id">Figure 3.9: </td><td
class="content">Connect Ports</td></tr></table><!--tex4ht:label?: x5-31032r9 -->
<!--l. 249--><p class="noindent" ></td></tr></table></div><hr class="endfigure">
</li>
<li
class="enumerate" id="x5-31034x10">Right-click on the <span
class="cmbx-12">dataDouble</span><span
class="cmbx-12">_out </span><a
href="mainli2.html#glo:port">Port</a> on the <span
class="cmtt-12">HardLimit </span><a
href="mainli2.html#glo:component">Component</a>, click <span
class="cmbx-12">Plot</span>
<a
href="mainli2.html#glo:port"><span
class="cmbx-12">Port</span></a> <span
class="cmbx-12">Data</span>
</li>
<li
class="enumerate" id="x5-31036x11">Notice that the output has been hard limited by the <span
class="cmtt-12">HardLimit </span><a
href="mainli2.html#glo:component">Component</a></li></ol>
</li></ol>
<!--l. 256--><p class="noindent" >
<h3 class="sectionHead"><span class="titlemark">3.5 </span> <a
id="x5-320003.5"></a>Create and Run a Hello World Component</h3>
<!--l. 258--><p class="noindent" >This Section provides a brief overview of how to create a simple <a
href="mainli2.html#glo:component">Component</a> that prints <span
class="cmtt-12">hello</span>
<span
class="cmtt-12">world </span>to the terminal upon startup.
<!--l. 260--><p class="noindent" >
<ol class="enumerate1" >
<li
class="enumerate" id="x5-32002x1">Create a new <a
href="mainap3.html#sca">SCA</a> <a
href="mainli2.html#glo:component">Component</a> Project:
<ul class="itemize1">
<li class="itemize"><span
class="cmbx-12">File </span><span
class="cmmi-12">> </span><span
class="cmbx-12">New </span><span
class="cmmi-12">> </span><a
href="mainap3.html#sca"><span
class="cmbx-12">SCA</span></a> <a
href="mainli2.html#glo:component"><span
class="cmbx-12">Component</span></a> <span
class="cmbx-12">Project</span></li></ul>
</li>
<li
class="enumerate" id="x5-32004x2">Name the project: <span
class="cmti-12">HelloWorld</span>
</li>
<li
class="enumerate" id="x5-32006x3">Click <span
class="cmbx-12">Next</span>
</li>
<li
class="enumerate" id="x5-32008x4">Select:
<ul class="itemize1">
<li class="itemize"><span
class="cmbx-12">Prog. Lang: C++</span></li></ul>
</li>
<li
class="enumerate" id="x5-32010x5">Click <span
class="cmbx-12">Next</span>
</li>
<li
class="enumerate" id="x5-32012x6">Click <span
class="cmbx-12">Finish</span>
<ul class="itemize1">
<li class="itemize">If a dialog asks to switch to CPP perspective, click <span
class="cmbx-12">No</span></li></ul>
</li>
<li
class="enumerate" id="x5-32014x7">Generate Code:
<ul class="itemize1">
<li class="itemize">In the editor tool bar click <span
class="cmbx-12">Generate All </span><a
href="mainli2.html#glo:component"><span
class="cmbx-12">Component</span></a> <span
class="cmbx-12">Implementations</span>, as
seen in <a
href="#x5-26001r3">Figure 3.3</a></li></ul>
</li>
<li
class="enumerate" id="x5-32016x8">In the <span
class="cmtt-12">HelloWorld.cpp </span>file add the following include to the beginning of the file <script type="syntaxhighlighter" class="brush: cpp"><![CDATA[
#include <iostream>
]]></script>
</li>
<li
class="enumerate" id="x5-32018x9">In the <span
class="cmtt-12">HelloWorld.cpp </span>file, add the following code to the <span
class="cmtt-12">serviceFunction() </span>method: <script type="syntaxhighlighter" class="brush: cpp"><![CDATA[
std::cout<<"Hello world"<<std::endl;
]]></script>
</li>
<li
class="enumerate" id="x5-32020x10">Compile the project:
<ul class="itemize1">
<li class="itemize"><span
class="cmbx-12">Project</span><span
class="cmmi-12">> </span><span
class="cmbx-12">Build Project</span></li></ul>
</li>
<li
class="enumerate" id="x5-32022x11">Drag the project to the <span
class="cmbx-12">Target </span><a
href="mainap3.html#sdr"><span
class="cmbx-12">SDR</span></a> section of the <a
href="mainap3.html#sca"><span
class="cmbx-12">SCA</span></a> <span
class="cmbx-12">Explorer</span>
</li>
<li
class="enumerate" id="x5-32024x12">On a terminal, start a Python session
</li>
<li
class="enumerate" id="x5-32026x13">Run the following commands: <script type="syntaxhighlighter" class="brush: python"><![CDATA[
>>> from ossie.utils import sb
>>> hello_world = sb.Component('HelloWorld')
>>> sb.start()
]]></script>
</li></ol>
<!--l. 1--><div class="crosslinks"><p class="noindent">[<a
href="mainch4.html" >next</a>] [<a
href="mainch2.html" >prev</a>] [<a
href="mainch2.html#tailmainch2.html" >prev-tail</a>] [<a
href="mainch3.html" >front</a>] [<a
href="main.html#mainch3.html" >up</a>] </p></div>
<!--l. 1--><p class="noindent" ><a
id="tailmainch3.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>