mirror of
https://github.com/nasa/fprime.git
synced 2025-12-10 00:44:37 -06:00
Compare commits
154 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94b4457154 | ||
|
|
1f860de821 | ||
|
|
f3b191beff | ||
|
|
59e1baa9d8 | ||
|
|
43de02bafd | ||
|
|
6c80056596 | ||
|
|
a8fe137283 | ||
|
|
3a293cd705 | ||
|
|
e0afd3c3fb | ||
|
|
cddf38bb6f | ||
|
|
89a9e3247b | ||
|
|
a9e05045da | ||
|
|
9fbf5800ab | ||
|
|
08f43279da | ||
|
|
e8c3fea70c | ||
|
|
b9a7059667 | ||
|
|
aed0837c9c | ||
|
|
f5902583ce | ||
|
|
5baf4076ab | ||
|
|
ba95054a24 | ||
|
|
081a2f8654 | ||
|
|
027b658208 | ||
|
|
6d756f7431 | ||
|
|
8cbba542fc | ||
|
|
31b6488723 | ||
|
|
62dd7445db | ||
|
|
afb6f13853 | ||
|
|
6388f046e1 | ||
|
|
6a132c5df4 | ||
|
|
317ba3d7e0 | ||
|
|
402c0317b6 | ||
|
|
589871a957 | ||
|
|
cc2522b257 | ||
|
|
6af7bcd5a9 | ||
|
|
1c87278b6b | ||
|
|
a587677fae | ||
|
|
a46fccf54d | ||
|
|
2b65cc83cf | ||
|
|
90bac90821 | ||
|
|
ba5988bfcd | ||
|
|
d669ea2c5a | ||
|
|
48e4720419 | ||
|
|
b254e981a1 | ||
|
|
b1b613fd0c | ||
|
|
903677e97d | ||
|
|
d6f43b02ff | ||
|
|
d0e9508988 | ||
|
|
aa4517c69b | ||
|
|
edf5c85d09 | ||
|
|
695478d1a1 | ||
|
|
c51921aca3 | ||
|
|
cb9f3a982b | ||
|
|
033f504418 | ||
|
|
fdc582bc56 | ||
|
|
0d78cd407c | ||
|
|
bf12f48c27 | ||
|
|
3f25d8b535 | ||
|
|
c0b75fb06a | ||
|
|
6bdd79f290 | ||
|
|
38361bebd1 | ||
|
|
4261f9d815 | ||
|
|
c909a19a54 | ||
|
|
4705b6c989 | ||
|
|
626473fc4e | ||
|
|
1ff13ac93f | ||
|
|
a8328b95cf | ||
|
|
4afac326ba | ||
|
|
2fca863e4d | ||
|
|
0fc995fefd | ||
|
|
9c11872889 | ||
|
|
2ee27f82f3 | ||
|
|
9a7123c190 | ||
|
|
d385cb45ac | ||
|
|
2de91b0916 | ||
|
|
e1098018e2 | ||
|
|
e34c019c3b | ||
|
|
74dd80e2b7 | ||
|
|
7aa034c526 | ||
|
|
6c2698cea1 | ||
|
|
a4579d2fca | ||
|
|
896803ad20 | ||
|
|
35840d549d | ||
|
|
589ed5d437 | ||
|
|
e9d7f3ab66 | ||
|
|
20477ad9c8 | ||
|
|
498546eac9 | ||
|
|
c7048d0b9c | ||
|
|
0a945a55c9 | ||
|
|
7fbe13086a | ||
|
|
1786ffee01 | ||
|
|
9139148de2 | ||
|
|
43ed537106 | ||
|
|
157f0f4d23 | ||
|
|
3fa2ed9716 | ||
|
|
0e40726440 | ||
|
|
6433f694c7 | ||
|
|
8b1d627139 | ||
|
|
73ab9621e4 | ||
|
|
8ad0b830e8 | ||
|
|
9141f01919 | ||
|
|
b377be2a9f | ||
|
|
bae7d2573c | ||
|
|
40142d7d39 | ||
|
|
3422cfa117 | ||
|
|
01e3d70925 | ||
|
|
5bee1a1151 | ||
|
|
241e74ea1d | ||
|
|
b28709cbdb | ||
|
|
38f0c1f3b2 | ||
|
|
e21fa7b109 | ||
|
|
ade6cc5ff3 | ||
|
|
6190d9610b | ||
|
|
9871fd5608 | ||
|
|
942c9eb6ac | ||
|
|
965109bc50 | ||
|
|
054c51ad3e | ||
|
|
4f381110a1 | ||
|
|
31919e6931 | ||
|
|
ba65039fff | ||
|
|
c8e2d44877 | ||
|
|
82fff1abc8 | ||
|
|
fff0e0bf77 | ||
|
|
1ee55a0c90 | ||
|
|
aabfa56193 | ||
|
|
3e41e2052b | ||
|
|
4c0092751c | ||
|
|
d9ecb8b637 | ||
|
|
4429614ea4 | ||
|
|
9cb948ed5d | ||
|
|
0dbc4febbc | ||
|
|
bce0b5de79 | ||
|
|
d014f30a96 | ||
|
|
77f286f3ed | ||
|
|
10f2b49d3f | ||
|
|
8b9ac2197d | ||
|
|
b90345e9df | ||
|
|
976ad2b28e | ||
|
|
42c665f080 | ||
|
|
9ec8c559de | ||
|
|
287a0211eb | ||
|
|
d911fb903f | ||
|
|
373f81d0f3 | ||
|
|
513582f420 | ||
|
|
a20535ea42 | ||
|
|
475f323525 | ||
|
|
94f67e4e21 | ||
|
|
f4439a8cc9 | ||
|
|
bdade025d0 | ||
|
|
6915c93c10 | ||
|
|
7972392cf4 | ||
|
|
d6cd606e66 | ||
|
|
a070ee768a | ||
|
|
30a3902e3e | ||
|
|
2dea8abedf |
@ -2,4 +2,5 @@
|
|||||||
BasedOnStyle: Chromium
|
BasedOnStyle: Chromium
|
||||||
IndentWidth: 4
|
IndentWidth: 4
|
||||||
ColumnLimit: 120
|
ColumnLimit: 120
|
||||||
AccessModifierOffset: -2
|
AccessModifierOffset: -2
|
||||||
|
InsertNewlineAtEOF: true
|
||||||
|
|||||||
@ -6,6 +6,6 @@ Checks: >
|
|||||||
modernize-redundant-void-arg,
|
modernize-redundant-void-arg,
|
||||||
modernize-use-bool-literals,
|
modernize-use-bool-literals,
|
||||||
modernize-use-nullptr,
|
modernize-use-nullptr,
|
||||||
readability-braces-around-statements
|
readability-braces-around-statements,
|
||||||
-clang-analyzer-security.insecureAPI.rand,
|
-clang-analyzer-security.insecureAPI.rand
|
||||||
WarningsAsErrors: '*'
|
WarningsAsErrors: '*'
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
set timeout 180
|
set timeout 180
|
||||||
spawn fprime-bootstrap project
|
spawn fprime-bootstrap project
|
||||||
expect -re {.*Project name.*}
|
expect -re {.*Project repository name.*}
|
||||||
|
send "my-project\r"
|
||||||
|
expect -re {.*Project top-level namespace.*}
|
||||||
send "MyProject\r"
|
send "MyProject\r"
|
||||||
expect eof
|
expect eof
|
||||||
|
|||||||
@ -2,6 +2,8 @@ set timeout 60
|
|||||||
spawn fprime-util new --deployment
|
spawn fprime-util new --deployment
|
||||||
expect -re {Deployment name.*}
|
expect -re {Deployment name.*}
|
||||||
send "MyDeployment\r"
|
send "MyDeployment\r"
|
||||||
|
expect -re {Deployment namespace.*}
|
||||||
|
send "MyNamespace\r"
|
||||||
expect -re {.*Select communication driver type}
|
expect -re {.*Select communication driver type}
|
||||||
send "1\r"
|
send "1\r"
|
||||||
expect -re "Add .*MyDeployment.*"
|
expect -re "Add .*MyDeployment.*"
|
||||||
|
|||||||
49
.github/actions/spelling/expect.txt
vendored
49
.github/actions/spelling/expect.txt
vendored
@ -32,13 +32,19 @@ baremetal
|
|||||||
batchmode
|
batchmode
|
||||||
BDV
|
BDV
|
||||||
bfree
|
bfree
|
||||||
|
BHn
|
||||||
bibtex
|
bibtex
|
||||||
Bies
|
Bies
|
||||||
|
binaryfile
|
||||||
BINDIR
|
BINDIR
|
||||||
bitmaps
|
bitmaps
|
||||||
|
bitshifts
|
||||||
|
bitwidth
|
||||||
bocchino
|
bocchino
|
||||||
boolt
|
boolt
|
||||||
bsd
|
bsd
|
||||||
|
BSDI
|
||||||
|
bst
|
||||||
BUFFERALLOCATE
|
BUFFERALLOCATE
|
||||||
BUFFERALLOCATIONFAILED
|
BUFFERALLOCATIONFAILED
|
||||||
BUFFERGETOUT
|
BUFFERGETOUT
|
||||||
@ -58,6 +64,7 @@ Campuzano
|
|||||||
carg
|
carg
|
||||||
CBF
|
CBF
|
||||||
CBLOCK
|
CBLOCK
|
||||||
|
CCACHE
|
||||||
CCB
|
CCB
|
||||||
CComponent
|
CComponent
|
||||||
ccsds
|
ccsds
|
||||||
@ -110,6 +117,7 @@ coravy
|
|||||||
coreutils
|
coreutils
|
||||||
Coverity
|
Coverity
|
||||||
CPHA
|
CPHA
|
||||||
|
CPIU
|
||||||
cplusplus
|
cplusplus
|
||||||
CPOL
|
CPOL
|
||||||
cppcheck
|
cppcheck
|
||||||
@ -136,6 +144,7 @@ CYCLEOUT
|
|||||||
DATAPRODUCTS
|
DATAPRODUCTS
|
||||||
DATAPRODUCTSSUBTOPOLOGY
|
DATAPRODUCTSSUBTOPOLOGY
|
||||||
DATAROOTDIR
|
DATAROOTDIR
|
||||||
|
datasheet
|
||||||
DDDTHH
|
DDDTHH
|
||||||
Debian
|
Debian
|
||||||
deconstructor
|
deconstructor
|
||||||
@ -177,6 +186,7 @@ DPWRITER
|
|||||||
DRAINBUFFERS
|
DRAINBUFFERS
|
||||||
drv
|
drv
|
||||||
drvtcpserversocket
|
drvtcpserversocket
|
||||||
|
DSL
|
||||||
dspal
|
dspal
|
||||||
DSSC
|
DSSC
|
||||||
Dstate
|
Dstate
|
||||||
@ -189,6 +199,7 @@ ECLIPSEHELP
|
|||||||
EHAs
|
EHAs
|
||||||
eip
|
eip
|
||||||
Elts
|
Elts
|
||||||
|
emptydir
|
||||||
endcond
|
endcond
|
||||||
endfunction
|
endfunction
|
||||||
endmacro
|
endmacro
|
||||||
@ -209,6 +220,7 @@ externalproject
|
|||||||
FAKELOGGER
|
FAKELOGGER
|
||||||
fbuild
|
fbuild
|
||||||
fdp
|
fdp
|
||||||
|
featherm
|
||||||
fecf
|
fecf
|
||||||
FEEDNAME
|
FEEDNAME
|
||||||
feq
|
feq
|
||||||
@ -222,17 +234,20 @@ FILEDOWNLINKCFG
|
|||||||
FILEHANDLING
|
FILEHANDLING
|
||||||
FILEHANDLINGSUBTOPOLOGY
|
FILEHANDLINGSUBTOPOLOGY
|
||||||
FILEID
|
FILEID
|
||||||
|
FILEMANAGERCONFIG
|
||||||
FILEOPENERROR
|
FILEOPENERROR
|
||||||
FILEWRITEERROR
|
FILEWRITEERROR
|
||||||
fio
|
fio
|
||||||
fle
|
fle
|
||||||
FNDELAY
|
FNDELAY
|
||||||
fne
|
fne
|
||||||
|
fontcolor
|
||||||
FONTPATH
|
FONTPATH
|
||||||
foodoodie
|
foodoodie
|
||||||
foodoodiehoo
|
foodoodiehoo
|
||||||
FPCONFIG
|
FPCONFIG
|
||||||
fpext
|
fpext
|
||||||
|
fpow
|
||||||
fpp
|
fpp
|
||||||
fppi
|
fppi
|
||||||
fpptest
|
fpptest
|
||||||
@ -243,13 +258,12 @@ fptr
|
|||||||
fptrunc
|
fptrunc
|
||||||
fputil
|
fputil
|
||||||
fpy
|
fpy
|
||||||
|
fpyc
|
||||||
FPYSEQUENCER
|
FPYSEQUENCER
|
||||||
freeram
|
freeram
|
||||||
Fregoso
|
Fregoso
|
||||||
fres
|
|
||||||
frsize
|
frsize
|
||||||
fsblkcnt
|
fsblkcnt
|
||||||
fsrc
|
|
||||||
fsw
|
fsw
|
||||||
FWCASSERT
|
FWCASSERT
|
||||||
gcda
|
gcda
|
||||||
@ -270,6 +284,7 @@ gpiochip
|
|||||||
gpioevent
|
gpioevent
|
||||||
gpiohandle
|
gpiohandle
|
||||||
gpioline
|
gpioline
|
||||||
|
GPT
|
||||||
Graphviz
|
Graphviz
|
||||||
grayscales
|
grayscales
|
||||||
GROUNDINTERFACERULES
|
GROUNDINTERFACERULES
|
||||||
@ -277,9 +292,9 @@ GSE
|
|||||||
gtags
|
gtags
|
||||||
gtest
|
gtest
|
||||||
gtimeout
|
gtimeout
|
||||||
|
GTK
|
||||||
Guire
|
Guire
|
||||||
GVCID
|
GVCID
|
||||||
GPT
|
|
||||||
HACKSM
|
HACKSM
|
||||||
Handcoded
|
Handcoded
|
||||||
handleflags
|
handleflags
|
||||||
@ -304,34 +319,34 @@ HTMLHELP
|
|||||||
ibd
|
ibd
|
||||||
ieeetr
|
ieeetr
|
||||||
ieq
|
ieq
|
||||||
iext
|
|
||||||
iflag
|
iflag
|
||||||
ifstr
|
ifstr
|
||||||
ilhs
|
|
||||||
imple
|
imple
|
||||||
inbool
|
inbool
|
||||||
INCLUDEDIR
|
INCLUDEDIR
|
||||||
ine
|
ine
|
||||||
initstate
|
initstate
|
||||||
inkscape
|
inkscape
|
||||||
|
inorder
|
||||||
installable
|
installable
|
||||||
intlimits
|
intlimits
|
||||||
inttypes
|
inttypes
|
||||||
INVALIDBUFFER
|
INVALIDBUFFER
|
||||||
INVALIDHEADER
|
INVALIDHEADER
|
||||||
INVALIDHEADERHASH
|
INVALIDHEADERHASH
|
||||||
|
invis
|
||||||
invisi
|
invisi
|
||||||
ioc
|
ioc
|
||||||
ioctl
|
ioctl
|
||||||
ipas
|
ipas
|
||||||
IPCFG
|
IPCFG
|
||||||
IPHELPER
|
IPHELPER
|
||||||
irhs
|
|
||||||
isf
|
isf
|
||||||
isgreater
|
isgreater
|
||||||
|
isgreaterequal
|
||||||
isless
|
isless
|
||||||
|
islessequal
|
||||||
isr
|
isr
|
||||||
isrc
|
|
||||||
isunordered
|
isunordered
|
||||||
itimerspec
|
itimerspec
|
||||||
itr
|
itr
|
||||||
@ -369,12 +384,15 @@ LINEEVENT
|
|||||||
LINEHANDLE
|
LINEHANDLE
|
||||||
linelength
|
linelength
|
||||||
lineoffset
|
lineoffset
|
||||||
|
LISTDIRECTORY
|
||||||
lld
|
lld
|
||||||
llu
|
llu
|
||||||
LOCALSTATEDIR
|
LOCALSTATEDIR
|
||||||
LOGGERRULES
|
LOGGERRULES
|
||||||
LOGPACKET
|
LOGPACKET
|
||||||
lseek
|
lseek
|
||||||
|
LTK
|
||||||
|
lvar
|
||||||
LVL
|
LVL
|
||||||
lxml
|
lxml
|
||||||
MACROFILE
|
MACROFILE
|
||||||
@ -402,6 +420,7 @@ MMAPALLOCATOR
|
|||||||
MML
|
MML
|
||||||
modbus
|
modbus
|
||||||
MOVEFILE
|
MOVEFILE
|
||||||
|
Mpu
|
||||||
msc
|
msc
|
||||||
mscfile
|
mscfile
|
||||||
mseconds
|
mseconds
|
||||||
@ -419,6 +438,8 @@ ncsl
|
|||||||
newtio
|
newtio
|
||||||
nmsgs
|
nmsgs
|
||||||
NOBLOCK
|
NOBLOCK
|
||||||
|
NODELABEL
|
||||||
|
noinline
|
||||||
NOLINT
|
NOLINT
|
||||||
NOLINTNEXTLINE
|
NOLINTNEXTLINE
|
||||||
noparent
|
noparent
|
||||||
@ -477,6 +498,7 @@ patsubst
|
|||||||
pdflatex
|
pdflatex
|
||||||
penv
|
penv
|
||||||
PERLMOD
|
PERLMOD
|
||||||
|
PHASERMEMBEROUT
|
||||||
PINGENTRIES
|
PINGENTRIES
|
||||||
PINGSEND
|
PINGSEND
|
||||||
pkill
|
pkill
|
||||||
@ -491,6 +513,7 @@ PORTOUT
|
|||||||
PORTSELECTOR
|
PORTSELECTOR
|
||||||
ppandian
|
ppandian
|
||||||
pregen
|
pregen
|
||||||
|
prescaler
|
||||||
prioritization
|
prioritization
|
||||||
PRIORITYQUEUE
|
PRIORITYQUEUE
|
||||||
prm
|
prm
|
||||||
@ -534,6 +557,7 @@ RATELIMITERTESTER
|
|||||||
rawtime
|
rawtime
|
||||||
RAWTIMETESTER
|
RAWTIMETESTER
|
||||||
RBF
|
RBF
|
||||||
|
rbt
|
||||||
RCHILD
|
RCHILD
|
||||||
rcvd
|
rcvd
|
||||||
rdwr
|
rdwr
|
||||||
@ -563,6 +587,7 @@ sbom
|
|||||||
scid
|
scid
|
||||||
scm
|
scm
|
||||||
sdd
|
sdd
|
||||||
|
sdiv
|
||||||
searchdata
|
searchdata
|
||||||
SENDPARTIAL
|
SENDPARTIAL
|
||||||
seqgen
|
seqgen
|
||||||
@ -570,10 +595,10 @@ serializables
|
|||||||
setaffinity
|
setaffinity
|
||||||
setinheritsched
|
setinheritsched
|
||||||
SETLOGGING
|
SETLOGGING
|
||||||
|
setname
|
||||||
setprotocol
|
setprotocol
|
||||||
setschedparam
|
setschedparam
|
||||||
setschedpolicy
|
setschedpolicy
|
||||||
setser
|
|
||||||
setstacksize
|
setstacksize
|
||||||
settime
|
settime
|
||||||
sev
|
sev
|
||||||
@ -585,11 +610,13 @@ SHAREDSTATEDIR
|
|||||||
SHELLCOMMAND
|
SHELLCOMMAND
|
||||||
showinitializer
|
showinitializer
|
||||||
sideeffect
|
sideeffect
|
||||||
|
siext
|
||||||
Signedness
|
Signedness
|
||||||
Silveira
|
Silveira
|
||||||
sitofp
|
sitofp
|
||||||
sle
|
sle
|
||||||
sloc
|
sloc
|
||||||
|
smod
|
||||||
socio
|
socio
|
||||||
SOCKETHELPER
|
SOCKETHELPER
|
||||||
SOCKETIPDRIVER
|
SOCKETIPDRIVER
|
||||||
@ -680,13 +707,15 @@ tparam
|
|||||||
TPP
|
TPP
|
||||||
trinomials
|
trinomials
|
||||||
tts
|
tts
|
||||||
typedef'ed
|
|
||||||
typedef
|
typedef
|
||||||
|
typedef'ed
|
||||||
uart
|
uart
|
||||||
|
udiv
|
||||||
UDPSOCKET
|
UDPSOCKET
|
||||||
uge
|
uge
|
||||||
uitofp
|
uitofp
|
||||||
UML
|
UML
|
||||||
|
umod
|
||||||
UNEXP
|
UNEXP
|
||||||
unistd
|
unistd
|
||||||
UNITTESTASSERT
|
UNITTESTASSERT
|
||||||
@ -713,9 +742,11 @@ wrs
|
|||||||
wxgui
|
wxgui
|
||||||
wxy
|
wxy
|
||||||
Xapian
|
Xapian
|
||||||
|
XBee
|
||||||
xdf
|
xdf
|
||||||
xdffe
|
xdffe
|
||||||
xsltproc
|
xsltproc
|
||||||
xxxx
|
xxxx
|
||||||
XXYY
|
XXYY
|
||||||
|
ziext
|
||||||
zimri
|
zimri
|
||||||
|
|||||||
2
.github/pull_request_template.md
vendored
2
.github/pull_request_template.md
vendored
@ -22,6 +22,6 @@
|
|||||||
|
|
||||||
<!-- Note any additional work that will be done relating to this issue. -->
|
<!-- Note any additional work that will be done relating to this issue. -->
|
||||||
|
|
||||||
## AI Usage ([policy](../AI_POLICY.md))
|
## AI Usage (see [policy](https://github.com/nasa/fprime/blob/devel/AI_POLICY.md))
|
||||||
|
|
||||||
<!-- If AI was used, please describe how it was utilized (e.g., code generation, documentation, testing, debugging assistance, etc.). -->
|
<!-- If AI was used, please describe how it was utilized (e.g., code generation, documentation, testing, debugging assistance, etc.). -->
|
||||||
|
|||||||
4
.github/workflows/build-test-rhel8.yml
vendored
4
.github/workflows/build-test-rhel8.yml
vendored
@ -38,7 +38,7 @@ jobs:
|
|||||||
- uses: ./.github/actions/setup
|
- uses: ./.github/actions/setup
|
||||||
- name: Build Framework
|
- name: Build Framework
|
||||||
run: |
|
run: |
|
||||||
fprime-util generate
|
fprime-util generate -DFPRIME_ENABLE_JSON_MODEL_GENERATION=ON
|
||||||
fprime-util build --all -j4
|
fprime-util build --all -j4
|
||||||
|
|
||||||
Ref:
|
Ref:
|
||||||
@ -59,7 +59,7 @@ jobs:
|
|||||||
- name: Build Ref
|
- name: Build Ref
|
||||||
run: |
|
run: |
|
||||||
cd Ref
|
cd Ref
|
||||||
fprime-util generate
|
fprime-util generate -DFPRIME_ENABLE_JSON_MODEL_GENERATION=ON
|
||||||
fprime-util build -j4
|
fprime-util build -j4
|
||||||
|
|
||||||
UTs:
|
UTs:
|
||||||
|
|||||||
3
.github/workflows/cppcheck-scan.yml
vendored
3
.github/workflows/cppcheck-scan.yml
vendored
@ -48,8 +48,9 @@ jobs:
|
|||||||
fprime-util generate -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
fprime-util generate -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
|
||||||
fprime-util build --all --jobs "$(nproc || printf '%s\n' 1)"
|
fprime-util build --all --jobs "$(nproc || printf '%s\n' 1)"
|
||||||
|
|
||||||
# Since our subtopologies have EXCLUDE_FROM_ALL, we need to explicitly build them
|
# Add EXCLUDE_FROM_ALL targets as we need to explicitly build them
|
||||||
fprime-util build --target Svc_Subtopologies --jobs "$(nproc || printf '%s\n' 1)"
|
fprime-util build --target Svc_Subtopologies --jobs "$(nproc || printf '%s\n' 1)"
|
||||||
|
fprime-util build --target Svc_GenericHub --jobs "$(nproc || printf '%s\n' 1)"
|
||||||
echo CPPCHECK_OPTS=--project="$GITHUB_WORKSPACE/build-fprime-automatic-native/compile_commands.json" >> $GITHUB_ENV
|
echo CPPCHECK_OPTS=--project="$GITHUB_WORKSPACE/build-fprime-automatic-native/compile_commands.json" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Run cppcheck
|
- name: Run cppcheck
|
||||||
|
|||||||
@ -68,8 +68,8 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mkdir -p aarch64-linux-artifacts
|
mkdir -p aarch64-linux-artifacts
|
||||||
cp -r ./build-artifacts aarch64-linux-artifacts
|
cp -r ./build-artifacts aarch64-linux-artifacts
|
||||||
cp -r Components/Led/test/int aarch64-linux-artifacts
|
cp -r LedBlinker/Components/Led/test/int aarch64-linux-artifacts
|
||||||
- name: 'Archive Build Artifacts'
|
- name: "Archive Build Artifacts"
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: aarch64-linux-artifacts
|
name: aarch64-linux-artifacts
|
||||||
@ -84,7 +84,7 @@ jobs:
|
|||||||
- name: "Checkout F´ Repository"
|
- name: "Checkout F´ Repository"
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
sparse-checkout: 'requirements.txt'
|
sparse-checkout: "requirements.txt"
|
||||||
sparse-checkout-cone-mode: false
|
sparse-checkout-cone-mode: false
|
||||||
- name: "Setup environment"
|
- name: "Setup environment"
|
||||||
run: |
|
run: |
|
||||||
@ -97,13 +97,14 @@ jobs:
|
|||||||
name: aarch64-linux-artifacts
|
name: aarch64-linux-artifacts
|
||||||
- name: Run Integration Tests
|
- name: Run Integration Tests
|
||||||
run: |
|
run: |
|
||||||
|
DEPLOYMENT=LedBlinker_LedBlinkerDeployment
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
mkdir -p ci-logs
|
mkdir -p ci-logs
|
||||||
chmod +x ./build-artifacts/aarch64-linux/LedBlinker/bin/LedBlinker
|
chmod +x ./build-artifacts/aarch64-linux/${DEPLOYMENT}/bin/${DEPLOYMENT}
|
||||||
fprime-gds --ip-client -d ./build-artifacts/aarch64-linux/LedBlinker --logs ./ci-logs &
|
fprime-gds --ip-client -d ./build-artifacts/aarch64-linux/${DEPLOYMENT} --logs ./ci-logs &
|
||||||
sleep 10
|
sleep 10
|
||||||
pytest --dictionary ./build-artifacts/aarch64-linux/LedBlinker/dict/LedBlinkerTopologyDictionary.json ./int/led_integration_tests.py
|
pytest --dictionary ./build-artifacts/aarch64-linux/${DEPLOYMENT}/dict/LedBlinkerDeploymentTopologyDictionary.json ./int/led_integration_tests.py
|
||||||
- name: 'Archive logs'
|
- name: "Archive logs"
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
|
|||||||
2
.github/workflows/ext-build-hello-world.yml
vendored
2
.github/workflows/ext-build-hello-world.yml
vendored
@ -32,6 +32,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
target_repository: fprime-community/fprime-tutorial-hello-world
|
target_repository: fprime-community/fprime-tutorial-hello-world
|
||||||
fprime_location: ./lib/fprime
|
fprime_location: ./lib/fprime
|
||||||
build_location: HelloWorldDeployment
|
build_location: Hello/HelloWorldDeployment
|
||||||
run_unit_tests: false # no UTs in HelloWorld project
|
run_unit_tests: false # no UTs in HelloWorld project
|
||||||
target_ref: ${{ needs.get-branch.outputs.target-branch }}
|
target_ref: ${{ needs.get-branch.outputs.target-branch }}
|
||||||
|
|||||||
2
.github/workflows/ext-build-led-blinker.yml
vendored
2
.github/workflows/ext-build-led-blinker.yml
vendored
@ -32,6 +32,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
target_repository: fprime-community/fprime-workshop-led-blinker
|
target_repository: fprime-community/fprime-workshop-led-blinker
|
||||||
fprime_location: lib/fprime
|
fprime_location: lib/fprime
|
||||||
build_location: LedBlinker
|
build_location: LedBlinker/LedBlinkerDeployment
|
||||||
run_unit_tests: true
|
run_unit_tests: true
|
||||||
target_ref: ${{ needs.get-branch.outputs.target-branch }}
|
target_ref: ${{ needs.get-branch.outputs.target-branch }}
|
||||||
|
|||||||
3
.github/workflows/ext-build-math-comp.yml
vendored
3
.github/workflows/ext-build-math-comp.yml
vendored
@ -31,6 +31,7 @@ jobs:
|
|||||||
uses: ./.github/workflows/reusable-project-builder.yml
|
uses: ./.github/workflows/reusable-project-builder.yml
|
||||||
with:
|
with:
|
||||||
target_repository: fprime-community/fprime-tutorial-math-component
|
target_repository: fprime-community/fprime-tutorial-math-component
|
||||||
build_location: MathDeployment
|
build_location: MathProject/MathDeployment
|
||||||
|
fprime_location: ./lib/fprime
|
||||||
run_unit_tests: true
|
run_unit_tests: true
|
||||||
target_ref: ${{ needs.get-branch.outputs.target-branch }}
|
target_ref: ${{ needs.get-branch.outputs.target-branch }}
|
||||||
|
|||||||
20
.github/workflows/ext-cookiecutters-test.yml
vendored
20
.github/workflows/ext-cookiecutters-test.yml
vendored
@ -73,41 +73,43 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
path: ./MyProject/lib/fprime
|
path: ./my-project/lib/fprime
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: "Update dependencies and install fprime-tools"
|
- name: "Update dependencies and install fprime-tools"
|
||||||
run: |
|
run: |
|
||||||
cd MyProject
|
cd my-project
|
||||||
. fprime-venv/bin/activate
|
. fprime-venv/bin/activate
|
||||||
pip install -U -r ./lib/fprime/requirements.txt
|
pip install -U -r ./requirements.txt
|
||||||
pip install git+https://github.com/nasa/fprime-tools@${{ needs.get-tools-branch.outputs.target-branch }}
|
pip install git+https://github.com/nasa/fprime-tools@${{ needs.get-tools-branch.outputs.target-branch }}
|
||||||
|
|
||||||
- name: "Version Check"
|
- name: "Version Check"
|
||||||
run: |
|
run: |
|
||||||
cd MyProject
|
cd my-project
|
||||||
. fprime-venv/bin/activate
|
. fprime-venv/bin/activate
|
||||||
fprime-util version-check
|
fprime-util version-check
|
||||||
|
|
||||||
- name: "Test Generate and Build Project"
|
- name: "Test Generate and Build Project"
|
||||||
run: |
|
run: |
|
||||||
cd MyProject
|
cd my-project
|
||||||
. fprime-venv/bin/activate
|
. fprime-venv/bin/activate
|
||||||
fprime-util generate
|
fprime-util generate
|
||||||
fprime-util build -j4
|
fprime-util build -j4
|
||||||
|
|
||||||
- name: "Test New Deployment and Build"
|
- name: "Test New Deployment and Build"
|
||||||
run: |
|
run: |
|
||||||
cd MyProject
|
cd my-project
|
||||||
. fprime-venv/bin/activate
|
. fprime-venv/bin/activate
|
||||||
expect ./lib/fprime/.github/actions/cookiecutter-check/deployment.expect
|
cd MyProject
|
||||||
|
expect ../lib/fprime/.github/actions/cookiecutter-check/deployment.expect
|
||||||
cd MyDeployment
|
cd MyDeployment
|
||||||
fprime-util build -j4
|
fprime-util build -j4
|
||||||
|
|
||||||
- name: "Test New Component and Build"
|
- name: "Test New Component and Build"
|
||||||
run: |
|
run: |
|
||||||
cd MyProject
|
cd my-project
|
||||||
. fprime-venv/bin/activate
|
. fprime-venv/bin/activate
|
||||||
expect ./lib/fprime/.github/actions/cookiecutter-check/component.expect
|
cd MyProject
|
||||||
|
expect ../lib/fprime/.github/actions/cookiecutter-check/component.expect
|
||||||
cd MyComponent
|
cd MyComponent
|
||||||
fprime-util build -j4
|
fprime-util build -j4
|
||||||
|
|||||||
36
.github/workflows/ext-fprime-zephyr-reference-pico2.yml
vendored
Normal file
36
.github/workflows/ext-fprime-zephyr-reference-pico2.yml
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Cross-compile https://github.com/fprime-community/fprime-zephyr-reference
|
||||||
|
|
||||||
|
name: "External Repo: Zephyr Reference (Pico 2)"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ devel, release/** ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ devel, release/** ]
|
||||||
|
paths-ignore:
|
||||||
|
- 'docs/**'
|
||||||
|
- '**.md'
|
||||||
|
- '.github/actions/spelling/**'
|
||||||
|
- '.github/ISSUE_TEMPLATE/**'
|
||||||
|
# Cancel in-progress runs if a newer run is started on a given PR
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: ${{ !contains(github.ref, 'devel') && !contains(github.ref, 'release/')}}
|
||||||
|
jobs:
|
||||||
|
get-branch:
|
||||||
|
name: "Get target branch"
|
||||||
|
uses: ./.github/workflows/reusable-get-pr-branch.yml
|
||||||
|
with:
|
||||||
|
target_repository: fprime-community/fprime-zephyr-reference
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: "Zephyr Build"
|
||||||
|
needs: get-branch
|
||||||
|
uses: ./.github/workflows/reusable-project-ci.yml
|
||||||
|
with:
|
||||||
|
target_repository: fprime-community/fprime-zephyr-reference
|
||||||
|
target_ref: ${{ needs.get-branch.outputs.target-branch }}
|
||||||
|
ci_config_file: ./lib/fprime-zephyr/ci/sample-configs/pico2.yml
|
||||||
|
|
||||||
|
|
||||||
36
.github/workflows/ext-fprime-zephyr-reference-teensy41.yml
vendored
Normal file
36
.github/workflows/ext-fprime-zephyr-reference-teensy41.yml
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Cross-compile https://github.com/fprime-community/fprime-zephyr-reference
|
||||||
|
|
||||||
|
name: "External Repo: Zephyr Reference (Teensy 4.1)"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ devel, release/** ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ devel, release/** ]
|
||||||
|
paths-ignore:
|
||||||
|
- 'docs/**'
|
||||||
|
- '**.md'
|
||||||
|
- '.github/actions/spelling/**'
|
||||||
|
- '.github/ISSUE_TEMPLATE/**'
|
||||||
|
# Cancel in-progress runs if a newer run is started on a given PR
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: ${{ !contains(github.ref, 'devel') && !contains(github.ref, 'release/')}}
|
||||||
|
jobs:
|
||||||
|
get-branch:
|
||||||
|
name: "Get target branch"
|
||||||
|
uses: ./.github/workflows/reusable-get-pr-branch.yml
|
||||||
|
with:
|
||||||
|
target_repository: fprime-community/fprime-zephyr-reference
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: "Zephyr Build"
|
||||||
|
needs: get-branch
|
||||||
|
uses: ./.github/workflows/reusable-project-ci.yml
|
||||||
|
with:
|
||||||
|
target_repository: fprime-community/fprime-zephyr-reference
|
||||||
|
target_ref: ${{ needs.get-branch.outputs.target-branch }}
|
||||||
|
ci_config_file: ./lib/fprime-zephyr/ci/sample-configs/teensy41.yml
|
||||||
|
|
||||||
|
|
||||||
16
.github/workflows/ext-raspberry-led-blinker.yml
vendored
16
.github/workflows/ext-raspberry-led-blinker.yml
vendored
@ -57,13 +57,14 @@ jobs:
|
|||||||
fprime-util generate raspberrypi
|
fprime-util generate raspberrypi
|
||||||
- name: "Build RPI"
|
- name: "Build RPI"
|
||||||
run: |
|
run: |
|
||||||
|
cd LedBlinker/LedBlinkerDeployment
|
||||||
fprime-util build raspberrypi
|
fprime-util build raspberrypi
|
||||||
- name: "Prepare artifacts"
|
- name: "Prepare artifacts"
|
||||||
run: |
|
run: |
|
||||||
mkdir -p rpi-artifacts
|
mkdir -p rpi-artifacts
|
||||||
cp -r ./build-artifacts rpi-artifacts
|
cp -r ./build-artifacts rpi-artifacts
|
||||||
cp -r Components/Led/test/int rpi-artifacts
|
cp -r LedBlinker/Components/Led/test/int rpi-artifacts
|
||||||
- name: 'Archive Build Artifacts'
|
- name: "Archive Build Artifacts"
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: rpi-artifacts
|
name: rpi-artifacts
|
||||||
@ -78,7 +79,7 @@ jobs:
|
|||||||
- name: "Checkout F´ Repository"
|
- name: "Checkout F´ Repository"
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
sparse-checkout: 'requirements.txt'
|
sparse-checkout: "requirements.txt"
|
||||||
sparse-checkout-cone-mode: false
|
sparse-checkout-cone-mode: false
|
||||||
- name: "Setup environment"
|
- name: "Setup environment"
|
||||||
run: |
|
run: |
|
||||||
@ -91,13 +92,14 @@ jobs:
|
|||||||
name: rpi-artifacts
|
name: rpi-artifacts
|
||||||
- name: Run Integration Tests
|
- name: Run Integration Tests
|
||||||
run: |
|
run: |
|
||||||
|
DEPLOYMENT=LedBlinker_LedBlinkerDeployment
|
||||||
. venv/bin/activate
|
. venv/bin/activate
|
||||||
mkdir -p ci-logs
|
mkdir -p ci-logs
|
||||||
chmod +x ./build-artifacts/raspberrypi/LedBlinker/bin/LedBlinker
|
chmod +x ./build-artifacts/raspberrypi/${DEPLOYMENT}/bin/${DEPLOYMENT}
|
||||||
fprime-gds --ip-client -d ./build-artifacts/raspberrypi/LedBlinker --logs ./ci-logs &
|
fprime-gds --ip-client -d ./build-artifacts/raspberrypi/${DEPLOYMENT} --logs ./ci-logs &
|
||||||
sleep 10
|
sleep 10
|
||||||
pytest --dictionary ./build-artifacts/raspberrypi/LedBlinker/dict/LedBlinkerTopologyDictionary.json ./int/led_integration_tests.py
|
pytest --dictionary ./build-artifacts/raspberrypi/${DEPLOYMENT}/dict/LedBlinkerDeploymentTopologyDictionary.json ./int/led_integration_tests.py
|
||||||
- name: 'Archive logs'
|
- name: "Archive logs"
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
if: always()
|
if: always()
|
||||||
with:
|
with:
|
||||||
|
|||||||
65
.github/workflows/format-check.yml
vendored
65
.github/workflows/format-check.yml
vendored
@ -31,67 +31,16 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
# Svc is currently listing all but Svc/FpySequencer
|
# Svc is currently listing all but Svc/FpySequencer
|
||||||
CHECKED_DIRS: >-
|
CHECKED_DIRS: >-
|
||||||
|
CFDP
|
||||||
|
default
|
||||||
Drv
|
Drv
|
||||||
|
FppTestProject
|
||||||
Fw
|
Fw
|
||||||
Os
|
Os
|
||||||
Svc/ActiveRateGroup
|
Ref
|
||||||
Svc/ActiveTextLogger
|
Svc
|
||||||
Svc/AssertFatalAdapter
|
TestUtils
|
||||||
Svc/BufferAccumulator
|
Utils
|
||||||
Svc/BufferLogger
|
|
||||||
Svc/BufferManager
|
|
||||||
Svc/BufferRepeater
|
|
||||||
Svc/Ccsds
|
|
||||||
Svc/ChronoTime
|
|
||||||
Svc/CmdDispatcher
|
|
||||||
Svc/CmdSequencer
|
|
||||||
Svc/CmdSplitter
|
|
||||||
Svc/ComLogger
|
|
||||||
Svc/ComQueue
|
|
||||||
Svc/ComSplitter
|
|
||||||
Svc/ComStub
|
|
||||||
Svc/Cycle
|
|
||||||
Svc/DpCatalog
|
|
||||||
Svc/DpManager
|
|
||||||
Svc/DpPorts
|
|
||||||
Svc/DpWriter
|
|
||||||
Svc/EventManager
|
|
||||||
Svc/Fatal
|
|
||||||
Svc/FatalHandler
|
|
||||||
Svc/FileDownlink
|
|
||||||
Svc/FileDownlinkPorts
|
|
||||||
Svc/FileManager
|
|
||||||
Svc/FileUplink
|
|
||||||
Svc/FprimeDeframer
|
|
||||||
Svc/FprimeFramer
|
|
||||||
Svc/FprimeProtocol
|
|
||||||
Svc/FprimeRouter
|
|
||||||
Svc/FrameAccumulator
|
|
||||||
Svc/FramingProtocol
|
|
||||||
Svc/GenericHub
|
|
||||||
Svc/Health
|
|
||||||
Svc/Interfaces
|
|
||||||
Svc/LinuxTimer
|
|
||||||
Svc/OsTime
|
|
||||||
Svc/PassiveConsoleTextLogger
|
|
||||||
Svc/PassiveRateGroup
|
|
||||||
Svc/Ping
|
|
||||||
Svc/PolyDb
|
|
||||||
Svc/PolyIf
|
|
||||||
Svc/Ports
|
|
||||||
Svc/PosixTime
|
|
||||||
Svc/PrmDb
|
|
||||||
Svc/RateGroupDriver
|
|
||||||
Svc/Sched
|
|
||||||
Svc/Seq
|
|
||||||
Svc/SeqDispatcher
|
|
||||||
Svc/StaticMemory
|
|
||||||
Svc/Subtopologies
|
|
||||||
Svc/SystemResources
|
|
||||||
Svc/TlmChan
|
|
||||||
Svc/TlmPacketizer
|
|
||||||
Svc/Version
|
|
||||||
Svc/WatchDog
|
|
||||||
|
|
||||||
run: |
|
run: |
|
||||||
fprime-util format --check --dirs $CHECKED_DIRS
|
fprime-util format --check --dirs $CHECKED_DIRS
|
||||||
|
|||||||
2
.github/workflows/fpp-tests.yml
vendored
2
.github/workflows/fpp-tests.yml
vendored
@ -33,7 +33,7 @@ jobs:
|
|||||||
- name: "Generate UT build cache"
|
- name: "Generate UT build cache"
|
||||||
working-directory: ./FppTestProject
|
working-directory: ./FppTestProject
|
||||||
run: |
|
run: |
|
||||||
fprime-util generate --ut
|
fprime-util generate --ut -DFPRIME_ENABLE_JSON_MODEL_GENERATION=ON
|
||||||
shell: bash
|
shell: bash
|
||||||
- name: "Build UTs"
|
- name: "Build UTs"
|
||||||
working-directory: ./FppTestProject/FppTest
|
working-directory: ./FppTestProject/FppTest
|
||||||
|
|||||||
2
.github/workflows/fpp-to-json.yml
vendored
2
.github/workflows/fpp-to-json.yml
vendored
@ -30,7 +30,7 @@ jobs:
|
|||||||
- name: "Generate Ref Deployment"
|
- name: "Generate Ref Deployment"
|
||||||
working-directory: ./Ref
|
working-directory: ./Ref
|
||||||
run: |
|
run: |
|
||||||
fprime-util generate
|
fprime-util generate -DFPRIME_ENABLE_JSON_MODEL_GENERATION=ON
|
||||||
shell: bash
|
shell: bash
|
||||||
- name: "Run fpp-to-json on Ref topology"
|
- name: "Run fpp-to-json on Ref topology"
|
||||||
working-directory: ./Ref/Top
|
working-directory: ./Ref/Top
|
||||||
|
|||||||
8
.github/workflows/pip-check.yml
vendored
8
.github/workflows/pip-check.yml
vendored
@ -6,10 +6,10 @@ name: Python Dependency Check
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
paths:
|
paths:
|
||||||
- 'requirements.txt'
|
- "requirements.txt"
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- 'requirements.txt'
|
- "requirements.txt"
|
||||||
# Cancel in-progress runs if a newer run is started on a given PR
|
# Cancel in-progress runs if a newer run is started on a given PR
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
@ -21,8 +21,8 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
|
||||||
# macos-13 is the last Intel-family runner; macos-latest is ARM
|
# Purposefully test on both ARM and Intel macOS (macos-latest is ARM)
|
||||||
runner: [macos-13, macos-latest, ubuntu-22.04, ubuntu-latest]
|
runner: [macos-15-intel, macos-latest, ubuntu-22.04, ubuntu-latest]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
|||||||
10
.github/workflows/reusable-get-pr-branch.yml
vendored
10
.github/workflows/reusable-get-pr-branch.yml
vendored
@ -34,14 +34,16 @@ jobs:
|
|||||||
- name: "Get target branch"
|
- name: "Get target branch"
|
||||||
id: get_target_branch
|
id: get_target_branch
|
||||||
run: |
|
run: |
|
||||||
|
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
|
||||||
|
echo "Looking for 'pr-${{ github.event.number }}'/'${BRANCH_NAME}'"
|
||||||
response_code_pr=`curl -w '%{response_code}' https://api.github.com/repos/${{ inputs.target_repository }}/branches/pr-${{ github.event.number }} -o /dev/null`
|
response_code_pr=`curl -w '%{response_code}' https://api.github.com/repos/${{ inputs.target_repository }}/branches/pr-${{ github.event.number }} -o /dev/null`
|
||||||
response_code_base=`curl -w '%{response_code}' https://api.github.com/repos/${{ inputs.target_repository }}/branches/${{ github.event.pull_request.base.ref }} -o /dev/null`
|
response_code_branch=`curl -w '%{response_code}' https://api.github.com/repos/${{ inputs.target_repository }}/branches/${BRANCH_NAME} -o /dev/null`
|
||||||
if [[ "${{ github.event_name }}" == "pull_request" && "$response_code_pr" == "200" ]]; then
|
if [[ "${{ github.event_name }}" == "pull_request" && "$response_code_pr" == "200" ]]; then
|
||||||
echo "TARGET_BRANCH=pr-${{ github.event.number }}" >> $GITHUB_OUTPUT
|
echo "TARGET_BRANCH=pr-${{ github.event.number }}" >> $GITHUB_OUTPUT
|
||||||
echo "PR branch found, using pr-${{ github.event.number }}"
|
echo "PR branch found, using pr-${{ github.event.number }}"
|
||||||
elif [[ "${{ github.event_name }}" == "pull_request" && "$response_code_base" == "200" ]]; then
|
elif [[ "$response_code_branch" == "200" ]]; then
|
||||||
echo "TARGET_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_OUTPUT
|
echo "TARGET_BRANCH=${BRANCH_NAME}" >> $GITHUB_OUTPUT
|
||||||
echo "Base branch found, using ${{ github.event.pull_request.base.ref }}"
|
echo "Base branch found, using ${BRANCH_NAME}"
|
||||||
else
|
else
|
||||||
echo "TARGET_BRANCH=${{ inputs.default_target_ref }}" >> $GITHUB_OUTPUT
|
echo "TARGET_BRANCH=${{ inputs.default_target_ref }}" >> $GITHUB_OUTPUT
|
||||||
echo "PR branch not found, using ${{ inputs.default_target_ref }}"
|
echo "PR branch not found, using ${{ inputs.default_target_ref }}"
|
||||||
|
|||||||
85
.github/workflows/reusable-project-ci.yml
vendored
Normal file
85
.github/workflows/reusable-project-ci.yml
vendored
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
# This workflow is intended for reuse by other workflows and will not run directly (no triggers).
|
||||||
|
# The behavior is to run the steps of fprime-ci.
|
||||||
|
name: "F´ CI - Reusable Workflow"
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
target_repository:
|
||||||
|
description: "Additional external repository to checkout (<owner>/<repo>)"
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
fprime_location:
|
||||||
|
description: "Relative path from the external project root to its F´ submodule"
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: "./lib/fprime"
|
||||||
|
target_ref:
|
||||||
|
description: "Branch on target to checkout"
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: "devel"
|
||||||
|
ci_config_file:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
run_unit_tests:
|
||||||
|
description: "Run an additional job in parallel to run unit tests."
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: true
|
||||||
|
runs_on:
|
||||||
|
description: "Platform to run on. Defaults to ubuntu-22.04"
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: "ubuntu-22.04"
|
||||||
|
runs_on_int:
|
||||||
|
description: "Platform to run integration tests on. Defaults to: apple-ci"
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: "apple-ci"
|
||||||
|
runs_on_ut:
|
||||||
|
description: "Platform to run UTs on. Defaults to ubuntu-22.04"
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: "ubuntu-22.04"
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ${{ inputs.runs_on }}
|
||||||
|
name: "Build"
|
||||||
|
steps:
|
||||||
|
- name: "Make Space"
|
||||||
|
uses: nasa/fprime-actions/make-space@devel
|
||||||
|
- name: "Set up target repository"
|
||||||
|
uses: nasa/fprime-actions/external-repository-setup@devel
|
||||||
|
with:
|
||||||
|
target_repository: ${{ inputs.target_repository }}
|
||||||
|
fprime_location: ${{ inputs.fprime_location }}
|
||||||
|
target_ref: ${{ inputs.target_ref }}
|
||||||
|
stage: build
|
||||||
|
- name: "Build Binary"
|
||||||
|
run: |
|
||||||
|
CCACHE_DISABLE=1 fprime-ci -c ${{ inputs.ci_config_file }} --add-stage build
|
||||||
|
- name: Archive Results
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: archive.tar.gz
|
||||||
|
path: ./archive.tar.gz
|
||||||
|
integration-tests:
|
||||||
|
needs: build
|
||||||
|
name: "Integration Tests"
|
||||||
|
runs-on: ${{ inputs.runs_on_int }}
|
||||||
|
steps:
|
||||||
|
- name: "Set up target repository"
|
||||||
|
uses: nasa/fprime-actions/external-repository-setup@devel
|
||||||
|
with:
|
||||||
|
target_repository: ${{ inputs.target_repository }}
|
||||||
|
fprime_location: ${{ inputs.fprime_location }}
|
||||||
|
target_ref: ${{ inputs.target_ref }}
|
||||||
|
stage: int
|
||||||
|
- name: Pull Archive Results
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: archive.tar.gz
|
||||||
|
- name: "Integration tests"
|
||||||
|
run: |
|
||||||
|
fprime-ci -c ${{ inputs.ci_config_file }} --skip-stage build
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -26,6 +26,7 @@ RemoteSystemsTempFiles
|
|||||||
*.stackdump
|
*.stackdump
|
||||||
Dict
|
Dict
|
||||||
*.core
|
*.core
|
||||||
|
*.swp
|
||||||
|
|
||||||
**/coverage/
|
**/coverage/
|
||||||
*.gcov
|
*.gcov
|
||||||
|
|||||||
3
.nav.yml
3
.nav.yml
@ -38,6 +38,8 @@ nav:
|
|||||||
- Svc:
|
- Svc:
|
||||||
- "Svc/**/docs/sdd.md"
|
- "Svc/**/docs/sdd.md"
|
||||||
- Fw:
|
- Fw:
|
||||||
|
- DataStructures:
|
||||||
|
- "Fw/DataStructures/docs/**.md"
|
||||||
- "Fw/**/docs/sdd.md"
|
- "Fw/**/docs/sdd.md"
|
||||||
- Drv:
|
- Drv:
|
||||||
- "Drv/**/docs/sdd.md"
|
- "Drv/**/docs/sdd.md"
|
||||||
@ -47,3 +49,4 @@ nav:
|
|||||||
- "docs/reference/*.md"
|
- "docs/reference/*.md"
|
||||||
- Support: '../support'
|
- Support: '../support'
|
||||||
- Events: '../events'
|
- Events: '../events'
|
||||||
|
- News: "../news"
|
||||||
|
|||||||
@ -14,133 +14,83 @@
|
|||||||
#include "Fw/Types/Assert.hpp"
|
#include "Fw/Types/Assert.hpp"
|
||||||
|
|
||||||
static U32 min(const U32 a, const U32 b) {
|
static U32 min(const U32 a, const U32 b) {
|
||||||
return (a < b) ? a : b;
|
return (a < b) ? a : b;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace CFDP {
|
namespace CFDP {
|
||||||
|
|
||||||
Checksum ::
|
Checksum ::Checksum() : m_value(0) {}
|
||||||
Checksum() : m_value(0)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
Checksum ::Checksum(const U32 value) : m_value(value) {}
|
||||||
|
|
||||||
Checksum ::
|
Checksum ::Checksum(const Checksum& original) {
|
||||||
Checksum(const U32 value) : m_value(value)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Checksum ::
|
|
||||||
Checksum(const Checksum &original)
|
|
||||||
{
|
|
||||||
this->m_value = original.getValue();
|
this->m_value = original.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
Checksum ::
|
Checksum ::~Checksum() {}
|
||||||
~Checksum()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
Checksum& Checksum ::operator=(const Checksum& checksum) {
|
||||||
|
|
||||||
Checksum& Checksum ::
|
|
||||||
operator=(const Checksum& checksum)
|
|
||||||
{
|
|
||||||
this->m_value = checksum.m_value;
|
this->m_value = checksum.m_value;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Checksum ::
|
bool Checksum ::operator==(const Checksum& checksum) const {
|
||||||
operator==(const Checksum& checksum) const
|
|
||||||
{
|
|
||||||
return this->m_value == checksum.m_value;
|
return this->m_value == checksum.m_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Checksum ::
|
bool Checksum ::operator!=(const Checksum& checksum) const {
|
||||||
operator!=(const Checksum& checksum) const
|
return not(*this == checksum);
|
||||||
{
|
}
|
||||||
return not (*this == checksum);
|
|
||||||
}
|
|
||||||
|
|
||||||
U32 Checksum ::
|
U32 Checksum ::getValue() const {
|
||||||
getValue() const
|
|
||||||
{
|
|
||||||
return this->m_value;
|
return this->m_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Checksum ::
|
void Checksum ::update(const U8* const data, const U32 offset, const U32 length) {
|
||||||
update(
|
|
||||||
const U8 *const data,
|
|
||||||
const U32 offset,
|
|
||||||
const U32 length
|
|
||||||
)
|
|
||||||
{
|
|
||||||
U32 index = 0;
|
U32 index = 0;
|
||||||
|
|
||||||
// Add the first word unaligned if necessary
|
// Add the first word unaligned if necessary
|
||||||
const U32 offsetMod4 = offset % 4;
|
const U32 offsetMod4 = offset % 4;
|
||||||
if (offsetMod4 != 0) {
|
if (offsetMod4 != 0) {
|
||||||
const U8 wordLength = static_cast<U8>(min(length, 4 - offsetMod4));
|
const U8 wordLength = static_cast<U8>(min(length, 4 - offsetMod4));
|
||||||
this->addWordUnaligned(
|
this->addWordUnaligned(&data[index], static_cast<U8>(offset + index), wordLength);
|
||||||
&data[index],
|
index += wordLength;
|
||||||
static_cast<U8>(offset + index),
|
|
||||||
wordLength
|
|
||||||
);
|
|
||||||
index += wordLength;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the middle words aligned
|
// Add the middle words aligned
|
||||||
for ( ; index + 4 <= length; index += 4) {
|
for (; index + 4 <= length; index += 4) {
|
||||||
addWordAligned(&data[index]);
|
addWordAligned(&data[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the last word unaligned if necessary
|
// Add the last word unaligned if necessary
|
||||||
if (index < length) {
|
if (index < length) {
|
||||||
const U8 wordLength = static_cast<U8>(length - index);
|
const U8 wordLength = static_cast<U8>(length - index);
|
||||||
this->addWordUnaligned(
|
this->addWordUnaligned(&data[index], static_cast<U8>(offset + index), wordLength);
|
||||||
&data[index],
|
|
||||||
static_cast<U8>(offset + index),
|
|
||||||
wordLength
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
void Checksum ::addWordAligned(const U8* const word) {
|
||||||
|
|
||||||
void Checksum ::
|
|
||||||
addWordAligned(const U8 *const word)
|
|
||||||
{
|
|
||||||
for (U8 i = 0; i < 4; ++i) {
|
for (U8 i = 0; i < 4; ++i) {
|
||||||
addByteAtOffset(word[i], i);
|
addByteAtOffset(word[i], i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Checksum ::
|
void Checksum ::addWordUnaligned(const U8* word, const U8 position, const U8 length) {
|
||||||
addWordUnaligned(
|
|
||||||
const U8 *word,
|
|
||||||
const U8 position,
|
|
||||||
const U8 length
|
|
||||||
)
|
|
||||||
{
|
|
||||||
FW_ASSERT(length < 4);
|
FW_ASSERT(length < 4);
|
||||||
U8 offset = position % 4;
|
U8 offset = position % 4;
|
||||||
for (U8 i = 0; i < length; ++i) {
|
for (U8 i = 0; i < length; ++i) {
|
||||||
addByteAtOffset(word[i], offset);
|
addByteAtOffset(word[i], offset);
|
||||||
++offset;
|
++offset;
|
||||||
if (offset == 4) {
|
if (offset == 4) {
|
||||||
offset = 0;
|
offset = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void Checksum ::
|
|
||||||
addByteAtOffset(
|
|
||||||
const U8 byte,
|
|
||||||
const U8 offset
|
|
||||||
)
|
|
||||||
{
|
|
||||||
FW_ASSERT(offset < 4);
|
|
||||||
const U32 addend = static_cast<U32>(byte) << (8*(3-offset));
|
|
||||||
this->m_value += addend;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Checksum ::addByteAtOffset(const U8 byte, const U8 offset) {
|
||||||
|
FW_ASSERT(offset < 4);
|
||||||
|
const U32 addend = static_cast<U32>(byte) << (8 * (3 - offset));
|
||||||
|
this->m_value += addend;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace CFDP
|
||||||
|
|||||||
@ -17,130 +17,120 @@
|
|||||||
|
|
||||||
namespace CFDP {
|
namespace CFDP {
|
||||||
|
|
||||||
//! \class Checksum
|
//! \class Checksum
|
||||||
//! \brief Class representing a 32-bit checksum as mandated by the CCSDS File
|
//! \brief Class representing a 32-bit checksum as mandated by the CCSDS File
|
||||||
//! Delivery Protocol.
|
//! Delivery Protocol.
|
||||||
//!
|
//!
|
||||||
//! This checksum is calculated by update of an existing 32-bit value
|
//! This checksum is calculated by update of an existing 32-bit value
|
||||||
//! with the "next" 32-bit string drawn from the file data. Beginning
|
//! with the "next" 32-bit string drawn from the file data. Beginning
|
||||||
//! at the start of the file, a 4-byte window moves up the file by four
|
//! at the start of the file, a 4-byte window moves up the file by four
|
||||||
//! bytes per update. The update itself replaces the existing checksum
|
//! bytes per update. The update itself replaces the existing checksum
|
||||||
//! with the byte-wise sum of the existing checksum and the file data
|
//! with the byte-wise sum of the existing checksum and the file data
|
||||||
//! contained in the window. Overflows in the addition are permitted
|
//! contained in the window. Overflows in the addition are permitted
|
||||||
//! and the carry discarded.
|
//! and the carry discarded.
|
||||||
//!
|
//!
|
||||||
//! If an update is to be made beginning at an offset into the file
|
//! If an update is to be made beginning at an offset into the file
|
||||||
//! which is not aligned to a 4-byte boundary, the window is treated
|
//! which is not aligned to a 4-byte boundary, the window is treated
|
||||||
//! as beginning at the last 4-byte boundary, but is left-zero-padded.
|
//! as beginning at the last 4-byte boundary, but is left-zero-padded.
|
||||||
//! Similarly, where the file data for an update ends on an unaligned
|
//! Similarly, where the file data for an update ends on an unaligned
|
||||||
//! byte, the window extends up to the next boundary and is
|
//! byte, the window extends up to the next boundary and is
|
||||||
//! right-zero-padded.
|
//! right-zero-padded.
|
||||||
//!
|
//!
|
||||||
//! ## Example
|
//! ## Example
|
||||||
//!
|
//!
|
||||||
//! For buffer 0xDE 0xAD 0xBE 0xEF 0xCA 0xFE and initial zero checksum:
|
//! For buffer 0xDE 0xAD 0xBE 0xEF 0xCA 0xFE and initial zero checksum:
|
||||||
//!
|
//!
|
||||||
//! ------------------------------------ Update 1
|
//! ------------------------------------ Update 1
|
||||||
//! Window 0xDE 0xAD 0xBE 0xEF
|
//! Window 0xDE 0xAD 0xBE 0xEF
|
||||||
//! Checksum 0xDEADBEEF
|
//! Checksum 0xDEADBEEF
|
||||||
//!
|
//!
|
||||||
//! ------------------------------------ Update 2
|
//! ------------------------------------ Update 2
|
||||||
//! Window 0xCA 0xFE
|
//! Window 0xCA 0xFE
|
||||||
//! Checksum 0xDEADBEEF+
|
//! Checksum 0xDEADBEEF+
|
||||||
//! 0xCAFE0000
|
//! 0xCAFE0000
|
||||||
//! ----------
|
//! ----------
|
||||||
//! 0xA8ABBEEF <- Final value
|
//! 0xA8ABBEEF <- Final value
|
||||||
class Checksum {
|
class Checksum {
|
||||||
|
public:
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Types
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Construction and destruction
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
//! Construct a fresh Checksum object.
|
||||||
// Types
|
Checksum();
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
public:
|
//! Construct a Checksum object and initialize it with a value.
|
||||||
|
Checksum(const U32 value);
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
//! Copy a Checksum object.
|
||||||
// Construction and destruction
|
Checksum(const Checksum& original);
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
//! Construct a fresh Checksum object.
|
//! Destroy a Checksum object.
|
||||||
Checksum();
|
~Checksum();
|
||||||
|
|
||||||
//! Construct a Checksum object and initialize it with a value.
|
public:
|
||||||
Checksum(const U32 value);
|
// ----------------------------------------------------------------------
|
||||||
|
// Public instance methods
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
//! Copy a Checksum object.
|
//! Assign checksum to this.
|
||||||
Checksum(const Checksum &original);
|
Checksum& operator=(const Checksum& checksum);
|
||||||
|
|
||||||
//! Destroy a Checksum object.
|
//! Compare checksum and this for equality.
|
||||||
~Checksum();
|
bool operator==(const Checksum& checksum) const;
|
||||||
|
|
||||||
public:
|
//! Compare checksum and this for inequality.
|
||||||
|
bool operator!=(const Checksum& checksum) const;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
//! Update the checksum value by accumulating words in the given data.
|
||||||
// Public instance methods
|
//!
|
||||||
// ----------------------------------------------------------------------
|
//! \important The data and data-length passed to this method are specifically
|
||||||
|
//! those over which the update is made, rather than the entire
|
||||||
|
//! file. Typically, therefore, `data` will be a pointer to the
|
||||||
|
//! byte given by the offset, e.g. `&file_buffer[offset]`.
|
||||||
|
//!
|
||||||
|
void update(const U8* const data, //!< Beginning of the data over which to update.
|
||||||
|
const U32 offset, //!< Offset into the file at which the data begins.
|
||||||
|
const U32 length //!< Length of the update data in bytes.
|
||||||
|
);
|
||||||
|
|
||||||
//! Assign checksum to this.
|
//! Get the checksum value
|
||||||
Checksum& operator=(const Checksum& checksum);
|
U32 getValue() const;
|
||||||
|
|
||||||
//! Compare checksum and this for equality.
|
private:
|
||||||
bool operator==(const Checksum& checksum) const;
|
// ----------------------------------------------------------------------
|
||||||
|
// Private instance methods
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
//! Compare checksum and this for inequality.
|
//! Add a four-byte aligned word to the checksum value
|
||||||
bool operator!=(const Checksum& checksum) const;
|
void addWordAligned(const U8* const word //! The word
|
||||||
|
);
|
||||||
|
|
||||||
//! Update the checksum value by accumulating words in the given data.
|
//! Add a four-byte unaligned word to the checksum value
|
||||||
//!
|
void addWordUnaligned(const U8* const word, //! The word
|
||||||
//! \important The data and data-length passed to this method are specifically
|
const U8 position, //! The position of the word relative to the start of the file
|
||||||
//! those over which the update is made, rather than the entire
|
const U8 length //! The number of valid bytes in the word
|
||||||
//! file. Typically, therefore, `data` will be a pointer to the
|
);
|
||||||
//! byte given by the offset, e.g. `&file_buffer[offset]`.
|
|
||||||
//!
|
|
||||||
void update(const U8* const data, //!< Beginning of the data over which to update.
|
|
||||||
const U32 offset, //!< Offset into the file at which the data begins.
|
|
||||||
const U32 length //!< Length of the update data in bytes.
|
|
||||||
);
|
|
||||||
|
|
||||||
//! Get the checksum value
|
//! Add byte to value at offset in word
|
||||||
U32 getValue() const;
|
void addByteAtOffset(const U8 byte, //! The byte
|
||||||
|
const U8 offset //! The offset
|
||||||
|
);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Private member variables
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
//! The accumulated checksum value
|
||||||
// Private instance methods
|
U32 m_value;
|
||||||
// ----------------------------------------------------------------------
|
};
|
||||||
|
|
||||||
//! Add a four-byte aligned word to the checksum value
|
} // namespace CFDP
|
||||||
void addWordAligned(
|
|
||||||
const U8 *const word //! The word
|
|
||||||
);
|
|
||||||
|
|
||||||
//! Add a four-byte unaligned word to the checksum value
|
|
||||||
void addWordUnaligned(
|
|
||||||
const U8 *const word, //! The word
|
|
||||||
const U8 position, //! The position of the word relative to the start of the file
|
|
||||||
const U8 length //! The number of valid bytes in the word
|
|
||||||
);
|
|
||||||
|
|
||||||
//! Add byte to value at offset in word
|
|
||||||
void addByteAtOffset(
|
|
||||||
const U8 byte, //! The byte
|
|
||||||
const U8 offset //! The offset
|
|
||||||
);
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// Private member variables
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
//! The accumulated checksum value
|
|
||||||
U32 m_value;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
// ======================================================================
|
// ======================================================================
|
||||||
// \title CFDP/Checksum/GTest/Checksums.cpp
|
// \title CFDP/Checksum/GTest/Checksums.cpp
|
||||||
// \author bocchino
|
// \author bocchino
|
||||||
// \brief cpp file for CFDP Checksum gtest utilities
|
// \brief cpp file for CFDP Checksum gtest utilities
|
||||||
@ -7,26 +7,21 @@
|
|||||||
// Copyright (C) 2016, California Institute of Technology.
|
// Copyright (C) 2016, California Institute of Technology.
|
||||||
// ALL RIGHTS RESERVED. United States Government Sponsorship
|
// ALL RIGHTS RESERVED. United States Government Sponsorship
|
||||||
// acknowledged.
|
// acknowledged.
|
||||||
//
|
//
|
||||||
// ======================================================================
|
// ======================================================================
|
||||||
|
|
||||||
#include "CFDP/Checksum/GTest/Checksums.hpp"
|
#include "CFDP/Checksum/GTest/Checksums.hpp"
|
||||||
|
|
||||||
namespace CFDP {
|
namespace CFDP {
|
||||||
|
|
||||||
namespace GTest {
|
namespace GTest {
|
||||||
|
|
||||||
void Checksums ::
|
|
||||||
compare(
|
|
||||||
const CFDP::Checksum& expected,
|
|
||||||
const CFDP::Checksum& actual
|
|
||||||
)
|
|
||||||
{
|
|
||||||
const U32 expectedValue = expected.getValue();
|
|
||||||
const U32 actualValue = actual.getValue();
|
|
||||||
ASSERT_EQ(expectedValue, actualValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
void Checksums ::compare(const CFDP::Checksum& expected, const CFDP::Checksum& actual) {
|
||||||
|
const U32 expectedValue = expected.getValue();
|
||||||
|
const U32 actualValue = actual.getValue();
|
||||||
|
ASSERT_EQ(expectedValue, actualValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace GTest
|
||||||
|
|
||||||
|
} // namespace CFDP
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
// ======================================================================
|
// ======================================================================
|
||||||
// \title CFDP/Checksum/GTest/Checksums.hpp
|
// \title CFDP/Checksum/GTest/Checksums.hpp
|
||||||
// \author bocchino
|
// \author bocchino
|
||||||
// \brief hpp file for CFDP Checksum gtest utilities
|
// \brief hpp file for CFDP Checksum gtest utilities
|
||||||
@ -7,8 +7,8 @@
|
|||||||
// Copyright (C) 2016 California Institute of Technology.
|
// Copyright (C) 2016 California Institute of Technology.
|
||||||
// ALL RIGHTS RESERVED. United States Government Sponsorship
|
// ALL RIGHTS RESERVED. United States Government Sponsorship
|
||||||
// acknowledged.
|
// acknowledged.
|
||||||
//
|
//
|
||||||
// ======================================================================
|
// ======================================================================
|
||||||
|
|
||||||
#ifndef GTest_CFDP_Checksums_HPP
|
#ifndef GTest_CFDP_Checksums_HPP
|
||||||
#define GTest_CFDP_Checksums_HPP
|
#define GTest_CFDP_Checksums_HPP
|
||||||
@ -19,21 +19,20 @@
|
|||||||
|
|
||||||
namespace CFDP {
|
namespace CFDP {
|
||||||
|
|
||||||
namespace GTest {
|
namespace GTest {
|
||||||
|
|
||||||
//! Utilities for testing Checksum operations
|
//! Utilities for testing Checksum operations
|
||||||
//!
|
//!
|
||||||
namespace Checksums {
|
namespace Checksums {
|
||||||
|
|
||||||
void compare(
|
void compare(const CFDP::Checksum& expected, //!< Expected value
|
||||||
const CFDP::Checksum& expected, //!< Expected value
|
const CFDP::Checksum& actual //!< Actual value
|
||||||
const CFDP::Checksum& actual //!< Actual value
|
);
|
||||||
);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace GTest
|
||||||
|
|
||||||
|
} // namespace CFDP
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Main.cpp
|
// Main.cpp
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
@ -8,49 +8,47 @@
|
|||||||
|
|
||||||
using namespace CFDP;
|
using namespace CFDP;
|
||||||
|
|
||||||
const U8 data[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8 };
|
const U8 data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
|
||||||
|
|
||||||
const U32 expectedValue =
|
const U32 expectedValue = (data[0] << 3 * 8) + (data[1] << 2 * 8) + (data[2] << 1 * 8) + data[3] + (data[4] << 3 * 8) +
|
||||||
(data[0] << 3*8) + (data[1] << 2*8) + (data[2] << 1*8) + data[3] +
|
(data[5] << 2 * 8) + (data[6] << 1 * 8) + data[7];
|
||||||
(data[4] << 3*8) + (data[5] << 2*8) + (data[6] << 1*8) + data[7];
|
|
||||||
|
|
||||||
TEST(Checksum, OnePacket) {
|
TEST(Checksum, OnePacket) {
|
||||||
Checksum checksum;
|
Checksum checksum;
|
||||||
checksum.update(data, 0, 8);
|
checksum.update(data, 0, 8);
|
||||||
ASSERT_EQ(expectedValue, checksum.getValue());
|
ASSERT_EQ(expectedValue, checksum.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Checksum, TwoPacketsAligned) {
|
TEST(Checksum, TwoPacketsAligned) {
|
||||||
Checksum checksum;
|
Checksum checksum;
|
||||||
checksum.update(&data[0], 0, 4);
|
checksum.update(&data[0], 0, 4);
|
||||||
checksum.update(&data[4], 4, 4);
|
checksum.update(&data[4], 4, 4);
|
||||||
ASSERT_EQ(expectedValue, checksum.getValue());
|
ASSERT_EQ(expectedValue, checksum.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Checksum, TwoPacketsUnaligned1) {
|
TEST(Checksum, TwoPacketsUnaligned1) {
|
||||||
Checksum checksum;
|
Checksum checksum;
|
||||||
checksum.update(&data[0], 0, 3);
|
checksum.update(&data[0], 0, 3);
|
||||||
checksum.update(&data[3], 3, 5);
|
checksum.update(&data[3], 3, 5);
|
||||||
ASSERT_EQ(expectedValue, checksum.getValue());
|
ASSERT_EQ(expectedValue, checksum.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Checksum, TwoPacketsUnaligned2) {
|
TEST(Checksum, TwoPacketsUnaligned2) {
|
||||||
Checksum checksum;
|
Checksum checksum;
|
||||||
checksum.update(&data[0], 0, 5);
|
checksum.update(&data[0], 0, 5);
|
||||||
checksum.update(&data[5], 5, 3);
|
checksum.update(&data[5], 5, 3);
|
||||||
ASSERT_EQ(expectedValue, checksum.getValue());
|
ASSERT_EQ(expectedValue, checksum.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Checksum, ThreePackets) {
|
TEST(Checksum, ThreePackets) {
|
||||||
Checksum checksum;
|
Checksum checksum;
|
||||||
checksum.update(&data[0], 0, 2);
|
checksum.update(&data[0], 0, 2);
|
||||||
checksum.update(&data[2], 2, 3);
|
checksum.update(&data[2], 2, 3);
|
||||||
checksum.update(&data[5], 5, 3);
|
checksum.update(&data[5], 5, 3);
|
||||||
ASSERT_EQ(expectedValue, checksum.getValue());
|
ASSERT_EQ(expectedValue, checksum.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char** argv) {
|
||||||
::testing::InitGoogleTest(&argc, argv);
|
::testing::InitGoogleTest(&argc, argv);
|
||||||
return RUN_ALL_TESTS();
|
return RUN_ALL_TESTS();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
109
CONTRIBUTING.md
109
CONTRIBUTING.md
@ -16,20 +16,11 @@ Specific Ways to Contribute:
|
|||||||
- [Ask a Question or Suggest Improvements](https://github.com/nasa/fprime/discussions/new)
|
- [Ask a Question or Suggest Improvements](https://github.com/nasa/fprime/discussions/new)
|
||||||
- [Report a Bug or Mistake](https://github.com/nasa/fprime/issues/new/choose)
|
- [Report a Bug or Mistake](https://github.com/nasa/fprime/issues/new/choose)
|
||||||
- [Review Contributions](https://github.com/nasa/fprime/pulls)
|
- [Review Contributions](https://github.com/nasa/fprime/pulls)
|
||||||
- Submit a Pull Request
|
- Submit a Pull Request see: [Code Contribution Process](#cod-ontribution-process)
|
||||||
- Contribute to Ongoing Discussions and Reviews
|
- Contribute to Ongoing Discussions and Reviews
|
||||||
|
|
||||||
Feel free to contribute any way that suits your skills and enjoy.
|
Feel free to contribute any way that suits your skills and enjoy.
|
||||||
|
|
||||||
|
|
||||||
> **Note:** [F´ Autocoder Python](https://github.com/nasa/fprime/tree/master/Autocoders) is being actively replaced
|
|
||||||
> by [FPP](https://github.com/fprime-community/fpp). Thus we will no longer accept changes to this code except for
|
|
||||||
> security and critical bug fixes done in the most minimal fashion.
|
|
||||||
>
|
|
||||||
> We do love Python fixes, please consider contributing to
|
|
||||||
> [fprime-tools](https://github.com/fprime-community/fprime-tools) or
|
|
||||||
> [fprime-gds](https://github.com/fprime-community/fprime-gds)
|
|
||||||
|
|
||||||
## Where to Start
|
## Where to Start
|
||||||
|
|
||||||
First, contributors should build some understanding of F´. Read through the documentation, try a tutorial, or run a
|
First, contributors should build some understanding of F´. Read through the documentation, try a tutorial, or run a
|
||||||
@ -44,28 +35,13 @@ with an [easy first issue](https://github.com/nasa/fprime/issues?q=is%3Aissue+is
|
|||||||
When starting to modify F´ directly, ask questions, seek help, and be patient. Remember to review the project structure,
|
When starting to modify F´ directly, ask questions, seek help, and be patient. Remember to review the project structure,
|
||||||
development process, and helpful tips sections below.
|
development process, and helpful tips sections below.
|
||||||
|
|
||||||
## Project Structure
|
## Code Contribution Process
|
||||||
|
|
||||||
The F´ project is designed as a base software [framework](https://github.com/nasa/fprime) with additional
|
All code contributions to F´ begin with an issue. Whether you're fixing a bug, adding a feature, or improving documentation, please start by opening an issue describing your proposal. The Change Control Board (CCB) reviews and approves issues before work begins to ensure alignment with project goals and standards. Once approved, you can proceed with implementation and submit a pull request (PR).
|
||||||
[packages](https://github.com/fprime-community) designed to extend the framework. This means that occasionally we may
|
|
||||||
move contributions in or out of these packages.
|
|
||||||
|
|
||||||
Key packages include:
|
If a PR is opened for work that does not correspond to an approved issue, the PR will be routed through the CCB process first—reviewed on a best-effort basis—and may be delayed or declined depending on CCB decisions.You can read more about how this process works in the [F´ Governance document](https://github.com/nasa/fprime/blob/devel/GOVERNANCE.md).
|
||||||
|
|
||||||
- [fpp](https://github.com/fprime-community/fpp): fpp development repository
|
### Development Process
|
||||||
- [fprime-tools](https://github.com/fprime-community/fprime-tools): `fprime-util` development repository
|
|
||||||
- [fprime-gds](https://github.com/fprime-community/fprime-gds): `fprime-gds` development repository
|
|
||||||
|
|
||||||
|
|
||||||
### F´ Repository Structure
|
|
||||||
|
|
||||||
Contributors to the [fprime](https://github.com/nasa/fprime) repository should understand the following key folders:
|
|
||||||
|
|
||||||
- [docs/UsersGuide](https://github.com/nasa/fprime/tree/devel/docs/UsersGuide): add new documentation in this or a subfolder
|
|
||||||
- [Fw](https://github.com/nasa/fprime/tree/devel/Fw): changes here will be reviewed carefully because this code is critical across F
|
|
||||||
- [Ref](https://github.com/nasa/fprime/tree/devel/Ref): update and maintain the Reference application here
|
|
||||||
|
|
||||||
## Development Process
|
|
||||||
|
|
||||||
F´ follows a standard git flow development model. Developers should start with a
|
F´ follows a standard git flow development model. Developers should start with a
|
||||||
[fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) of one of the F´ repositories and then develop
|
[fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) of one of the F´ repositories and then develop
|
||||||
@ -84,6 +60,11 @@ git checkout -b <desired branch name>
|
|||||||
|
|
||||||
Once a pull request has been submitted the following process will begin.
|
Once a pull request has been submitted the following process will begin.
|
||||||
|
|
||||||
|
**Best practice: commit messages and PRs**
|
||||||
|
|
||||||
|
We recommend users to use an [imperative-style phrasing](https://cbea.ms/git-commit/#imperative) when writing commit messages. F´ uses the "Squash & Merge" strategy, meaning that all commits made on a PR branch will be combined into one squashed commit when merged into F´. The commit message for the squashed commit defaults to use the title of the Pull Request, so we do ask contributors to please follow the imperative-style phrasing for the title of their Pull Requests.
|
||||||
|
When opening a Pull Request, please fill in the given template, and link to any relevant issue on the repository.
|
||||||
|
|
||||||
### Submission Review
|
### Submission Review
|
||||||
|
|
||||||
The pull request changes will be reviewed by the team and community supporting F´. Often this means that a discussion on
|
The pull request changes will be reviewed by the team and community supporting F´. Often this means that a discussion on
|
||||||
@ -121,13 +102,31 @@ The checks are configured to run on the `devel` branch of each external reposito
|
|||||||
|
|
||||||
Maintainers will gladly help you in this process.
|
Maintainers will gladly help you in this process.
|
||||||
|
|
||||||
## Final Approval and Submission
|
### Final Approval and Submission
|
||||||
|
|
||||||
Once all corrections have been made, automated checks are passing, and a maintainer has given final approval, it is time
|
Once all corrections have been made, automated checks are passing, and a maintainer has given final approval, it is time
|
||||||
to contribute the submission. A maintainer will handle this final step and once complete changes should appear in the
|
to contribute the submission. A maintainer will handle this final step and once complete changes should appear in the
|
||||||
`devel` branch. You can help this process by submitting any deferred or future work items as issues using the links
|
`devel` branch. You can help this process by submitting any deferred or future work items as issues using the links
|
||||||
above.
|
above.
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
The F´ project is designed as a base software [framework](https://github.com/nasa/fprime) with additional
|
||||||
|
[packages](https://github.com/fprime-community) designed to extend the framework. This means that occasionally we may
|
||||||
|
move contributions in or out of these packages.
|
||||||
|
|
||||||
|
Key packages include:
|
||||||
|
|
||||||
|
- [fpp](https://github.com/fprime-community/fpp): fpp development repository
|
||||||
|
- [fprime-tools](https://github.com/fprime-community/fprime-tools): `fprime-util` development repository
|
||||||
|
- [fprime-gds](https://github.com/fprime-community/fprime-gds): `fprime-gds` development repository
|
||||||
|
|
||||||
|
|
||||||
|
### F´ Repository Structure
|
||||||
|
|
||||||
|
Contributors to the [fprime](https://github.com/nasa/fprime) repository should refer to the following guide to understand the repository structure: [A Tour of the Source Tree](docs/user-manual/overview/source-tree.md)
|
||||||
|
|
||||||
|
|
||||||
## Helpful Tips
|
## Helpful Tips
|
||||||
|
|
||||||
This section will describe some helpful tips for contributing to F´.
|
This section will describe some helpful tips for contributing to F´.
|
||||||
@ -141,42 +140,54 @@ changes across many files.
|
|||||||
Keep in mind that editors that fix whitespace automatically can cause many small changes. Even with advanced GitHub
|
Keep in mind that editors that fix whitespace automatically can cause many small changes. Even with advanced GitHub
|
||||||
tools this can increase the effort required to review a submission. Be careful with the changes you are submitting.
|
tools this can increase the effort required to review a submission. Be careful with the changes you are submitting.
|
||||||
|
|
||||||
## Run Tests
|
### Run Tests
|
||||||
|
|
||||||
The automatic checking system will run all our unit tests and integration tests across several systems. However, this
|
The automatic checking system will run all our unit tests and integration tests across several systems. However, this
|
||||||
process will take time. Try to run the unit tests locally during development before submitting a PR and use the
|
process will take time. Try to run the unit tests locally during development before submitting a PR and use the
|
||||||
automatic checks as a safety net.
|
automatic checks as a safety net.
|
||||||
|
|
||||||
|
Building and running the tests has the same Python virtual environment requirements as developing an F´ project, which
|
||||||
|
is usually set up by fprime-bootstrap. Steps to set up the environment outside a project are included below.
|
||||||
|
|
||||||
The tests can be run using the following commands:
|
The tests can be run using the following commands:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Go into the fprime directory
|
# Go into the fprime directory
|
||||||
cp MY_FPRIME_DIRECTORY
|
cd MY_FPRIME_DIRECTORY
|
||||||
|
|
||||||
# Run CI tests on fprime
|
# Set up and activate a Python virtual environment, if none already:
|
||||||
./ci/tests/Framework.bash
|
python3 -m venv .venv
|
||||||
|
source .venv/bin/activate
|
||||||
|
|
||||||
# Run CI tests on the reference application
|
# Make sure Python packages from ./requirements.txt are installed and up-to-date:
|
||||||
./ci/tests/Ref.bash
|
pip install -Ur requirements.txt
|
||||||
|
|
||||||
|
# Initialize googletest submodule:
|
||||||
|
git submodule update --init --recursive
|
||||||
|
|
||||||
# Run the static analyzer with the basic configuration
|
# Run the static analyzer with the basic configuration
|
||||||
# Purge unit test directory
|
# Purge unit test directory
|
||||||
fprime-util purge
|
fprime-util purge
|
||||||
# Generate the build files for clang-tidy. Make sure clang-tidy is installed.
|
# Generate the build files. Using clang-tidy is optional, but recommended to match the CI checks.
|
||||||
fprime-util generate --ut -DCMAKE_CXX_CLANG_TIDY=clang-tidy-12
|
# On macOS, expect a CMake Warning 'Leak sanitizer is not supported on macOS in cmake/sanitizers.cmake'
|
||||||
|
fprime-util generate --ut -DCMAKE_CXX_CLANG_TIDY=clang-tidy
|
||||||
# Build fprime with the static analyzer
|
# Build fprime with the static analyzer
|
||||||
fprime-util build --all --ut -j16
|
fprime-util build --all --ut
|
||||||
|
|
||||||
# Run the static analyzer with additional flight code checks
|
# Run Unit Tests
|
||||||
# Purge release directory
|
fprime-util check --all
|
||||||
fprime-util purge
|
|
||||||
# Generate the build files for clang-tidy. Make sure clang-tidy is installed.
|
|
||||||
fprime-util generate -DCMAKE_CXX_CLANG_TIDY="clang-tidy-12;--config-file=$PWD/release.clang-tidy"
|
|
||||||
# Build fprime with the static analyzer
|
|
||||||
fprime-util build --all -j16
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Development with modified FPP version
|
### Code formatting
|
||||||
|
|
||||||
|
The F´ repository enforces formatting with `clang-format`. Most IDEs offer tools to format on demand or auto-format on "Save". To run formatting yourself, `fprime-util` provides a quick way to format all files that have been modified since you branched off of `devel`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git diff --name-only devel...HEAD | fprime-util format --stdin
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Development with modified FPP version
|
||||||
|
|
||||||
In case FPP needs to be locally changed, first uninstall all `fprime-fpp-*` `pip` packages, and install FPP
|
In case FPP needs to be locally changed, first uninstall all `fprime-fpp-*` `pip` packages, and install FPP
|
||||||
using the procedure mentioned in the [FPP readme](https://github.com/nasa/fpp/blob/main/compiler/README.adoc).
|
using the procedure mentioned in the [FPP readme](https://github.com/nasa/fpp/blob/main/compiler/README.adoc).
|
||||||
@ -190,5 +201,5 @@ cp MY_FPRIME_DIRECTORY
|
|||||||
# Generate the build files without checking the FPP version
|
# Generate the build files without checking the FPP version
|
||||||
fprime-util generate -DFPRIME_SKIP_TOOLS_VERSION_CHECK=1
|
fprime-util generate -DFPRIME_SKIP_TOOLS_VERSION_CHECK=1
|
||||||
# Build the project
|
# Build the project
|
||||||
fprime-util build -j4
|
fprime-util build
|
||||||
```
|
```
|
||||||
|
|||||||
@ -0,0 +1,52 @@
|
|||||||
|
// ======================================================================
|
||||||
|
// \title AsyncByteStreamBufferAdapter.cpp
|
||||||
|
// \author bocchino
|
||||||
|
// \brief cpp file for AsyncByteStreamBufferAdapter component implementation class
|
||||||
|
// ======================================================================
|
||||||
|
|
||||||
|
#include "Drv/AsyncByteStreamBufferAdapter/AsyncByteStreamBufferAdapter.hpp"
|
||||||
|
|
||||||
|
namespace Drv {
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Component construction and destruction
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
AsyncByteStreamBufferAdapter::AsyncByteStreamBufferAdapter(const char* const compName)
|
||||||
|
: AsyncByteStreamBufferAdapterComponentBase(compName) {}
|
||||||
|
|
||||||
|
AsyncByteStreamBufferAdapter::~AsyncByteStreamBufferAdapter() {}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Handler implementations for typed input ports
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
void AsyncByteStreamBufferAdapter::bufferIn_handler(FwIndexType portNum, Fw::Buffer& fwBuffer) {
|
||||||
|
// TODO: If m_driverIsReady then send fwBuffer on toByteStreamDriver_out
|
||||||
|
// TODO: Otherwise
|
||||||
|
// TODO: Log the error
|
||||||
|
// TODO: Send fwBuffer on bufferInReturn_out
|
||||||
|
}
|
||||||
|
|
||||||
|
void AsyncByteStreamBufferAdapter::bufferOutReturn_handler(FwIndexType portNum, Fw::Buffer& fwBuffer) {
|
||||||
|
// TODO: Send fwBuffer on fromByteStreamDriverReturn_out
|
||||||
|
}
|
||||||
|
|
||||||
|
void AsyncByteStreamBufferAdapter::byteStreamDriverReady_handler(FwIndexType portNum) {
|
||||||
|
this->m_driverIsReady = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AsyncByteStreamBufferAdapter::fromByteStreamDriver_handler(FwIndexType portNum,
|
||||||
|
Fw::Buffer& buffer,
|
||||||
|
const Drv::ByteStreamStatus& status) {
|
||||||
|
// TODO: If the status is OK, then send buffer on toByteStreamDriver_out
|
||||||
|
// TODO: Otherwise log the error and send buffer on fromByteStreamDriverReturn_out
|
||||||
|
}
|
||||||
|
|
||||||
|
void AsyncByteStreamBufferAdapter::toByteStreamDriverReturn_handler(FwIndexType portNum,
|
||||||
|
Fw::Buffer& buffer,
|
||||||
|
const Drv::ByteStreamStatus& status) {
|
||||||
|
// TODO: Send fwBuffer on bufferInReturn_out
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Drv
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
module Drv {
|
||||||
|
|
||||||
|
@ A passive component for mediating between the AsyncByteStreamDriver
|
||||||
|
@ interface and the PassiveBufferDriver interface
|
||||||
|
@
|
||||||
|
@ Sample topology:
|
||||||
|
@
|
||||||
|
@ -----------------------------------------------------------
|
||||||
|
@ | |
|
||||||
|
@ | AsyncByteStreamDriver <--> AsyncByteStreamBufferAdapter | <--> PassiveBufferDriverClient
|
||||||
|
@ | |
|
||||||
|
@ -----------------------------------------------------------
|
||||||
|
@
|
||||||
|
@ The two components in the box function together as a PassiveBufferDriver:
|
||||||
|
@
|
||||||
|
@ -------------------------------------------------
|
||||||
|
@ | |
|
||||||
|
@ | PassiveBufferDriver | <--> PassiveBufferDriverClient
|
||||||
|
@ | |
|
||||||
|
@ -------------------------------------------------
|
||||||
|
@
|
||||||
|
passive component AsyncByteStreamBufferAdapter {
|
||||||
|
|
||||||
|
@ AsyncByteStreamBufferAdapter is a passive client of the
|
||||||
|
@ AsyncByteStreamDriver interface
|
||||||
|
import PassiveAsyncByteStreamDriverClient
|
||||||
|
|
||||||
|
@ AsyncByteStreamBufferAdapter is a PassiveBufferDriver
|
||||||
|
import PassiveBufferDriver
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,80 @@
|
|||||||
|
// ======================================================================
|
||||||
|
// \title AsyncByteStreamBufferAdapter.hpp
|
||||||
|
// \author bocchino
|
||||||
|
// \brief hpp file for AsyncByteStreamBufferAdapter component implementation class
|
||||||
|
// ======================================================================
|
||||||
|
|
||||||
|
#ifndef Drv_AsyncByteStreamBufferAdapter_HPP
|
||||||
|
#define Drv_AsyncByteStreamBufferAdapter_HPP
|
||||||
|
|
||||||
|
#include "Drv/AsyncByteStreamBufferAdapter/AsyncByteStreamBufferAdapterComponentAc.hpp"
|
||||||
|
|
||||||
|
namespace Drv {
|
||||||
|
|
||||||
|
class AsyncByteStreamBufferAdapter final : public AsyncByteStreamBufferAdapterComponentBase {
|
||||||
|
public:
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Component construction and destruction
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
//! Construct AsyncByteStreamBufferAdapter object
|
||||||
|
AsyncByteStreamBufferAdapter(const char* const compName //!< The component name
|
||||||
|
);
|
||||||
|
|
||||||
|
//! Destroy AsyncByteStreamBufferAdapter object
|
||||||
|
~AsyncByteStreamBufferAdapter();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Handler implementations for typed input ports
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
//! Handler implementation for bufferIn
|
||||||
|
//!
|
||||||
|
//! Port for receiving buffers
|
||||||
|
void bufferIn_handler(FwIndexType portNum, //!< The port number
|
||||||
|
Fw::Buffer& fwBuffer //!< The buffer
|
||||||
|
) override;
|
||||||
|
|
||||||
|
//! Handler implementation for bufferOutReturn
|
||||||
|
//!
|
||||||
|
//! Port for receiving buffers sent on bufferOut and then returned
|
||||||
|
void bufferOutReturn_handler(FwIndexType portNum, //!< The port number
|
||||||
|
Fw::Buffer& fwBuffer //!< The buffer
|
||||||
|
) override;
|
||||||
|
|
||||||
|
//! Handler implementation for byteStreamDriver
|
||||||
|
//!
|
||||||
|
//! Port for receiving ready signals from the driver
|
||||||
|
//! Sample connection: byteStreamDriver.ready -> byteStreamDriverClient.byteStreamReady
|
||||||
|
void byteStreamDriverReady_handler(FwIndexType portNum //!< The port number
|
||||||
|
) override;
|
||||||
|
|
||||||
|
//! Handler implementation for fromByteStreamDriver
|
||||||
|
//!
|
||||||
|
//! Port for receiving data from the driver
|
||||||
|
//! Sample connection: byteStreamDriver.$recv -> byteStreamDriverClient.fromDriver
|
||||||
|
void fromByteStreamDriver_handler(FwIndexType portNum, //!< The port number
|
||||||
|
Fw::Buffer& buffer,
|
||||||
|
const Drv::ByteStreamStatus& status) override;
|
||||||
|
|
||||||
|
//! Handler implementation for toByteStreamDriverReturn
|
||||||
|
//!
|
||||||
|
//! Port for receiving buffers sent on toByteStreamDriver and then returned
|
||||||
|
//! Sample connection: driver.sendReturnOut -> client.toByteStreamDriverReturn
|
||||||
|
void toByteStreamDriverReturn_handler(FwIndexType portNum, //!< The port number
|
||||||
|
Fw::Buffer& buffer,
|
||||||
|
const Drv::ByteStreamStatus& status) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Private member variables
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
//! Whether the driver is ready
|
||||||
|
bool m_driverIsReady = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Drv
|
||||||
|
|
||||||
|
#endif
|
||||||
10
Drv/AsyncByteStreamBufferAdapter/CMakeLists.txt
Normal file
10
Drv/AsyncByteStreamBufferAdapter/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
set(SOURCE_FILES
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/AsyncByteStreamBufferAdapter.fpp"
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/AsyncByteStreamBufferAdapter.cpp"
|
||||||
|
)
|
||||||
|
|
||||||
|
set(MOD_DEPS
|
||||||
|
"Fw/Logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
register_fprime_module()
|
||||||
47
Drv/ByteStreamBufferAdapter/ByteStreamBufferAdapter.cpp
Normal file
47
Drv/ByteStreamBufferAdapter/ByteStreamBufferAdapter.cpp
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
// ======================================================================
|
||||||
|
// \title ByteStreamBufferAdapter.cpp
|
||||||
|
// \author bocchino
|
||||||
|
// \brief cpp file for ByteStreamBufferAdapter component implementation class
|
||||||
|
// ======================================================================
|
||||||
|
|
||||||
|
#include "Drv/ByteStreamBufferAdapter/ByteStreamBufferAdapter.hpp"
|
||||||
|
|
||||||
|
namespace Drv {
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Component construction and destruction
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
ByteStreamBufferAdapter::ByteStreamBufferAdapter(const char* const compName)
|
||||||
|
: ByteStreamBufferAdapterComponentBase(compName) {}
|
||||||
|
|
||||||
|
ByteStreamBufferAdapter::~ByteStreamBufferAdapter() {}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Handler implementations for typed input ports
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
void ByteStreamBufferAdapter::bufferIn_handler(FwIndexType portNum, Fw::Buffer& fwBuffer) {
|
||||||
|
// TODO: If m_driverIsReady then
|
||||||
|
// TODO: Send fwBuffer on toByteStreamDriver_out
|
||||||
|
// TODO: Check the return status. If there is an error, then log it to the Logger.
|
||||||
|
// TODO: Otherwise log the error
|
||||||
|
// TODO: Send fwBuffer on bufferInReturn_out
|
||||||
|
}
|
||||||
|
|
||||||
|
void ByteStreamBufferAdapter::bufferOutReturn_handler(FwIndexType portNum, Fw::Buffer& fwBuffer) {
|
||||||
|
// TODO: Send fwBuffer on fromByteStreamDriverReturn_out
|
||||||
|
}
|
||||||
|
|
||||||
|
void ByteStreamBufferAdapter::fromByteStreamDriver_handler(FwIndexType portNum,
|
||||||
|
Fw::Buffer& buffer,
|
||||||
|
const Drv::ByteStreamStatus& status) {
|
||||||
|
// TODO: If the status is OK, then send buffer on toByteStreamDriver_out
|
||||||
|
// TODO: Otherwise log the error and send buffer on fromByteStreamDriverReturn_out
|
||||||
|
}
|
||||||
|
|
||||||
|
void ByteStreamBufferAdapter::byteStreamDriverReady_handler(FwIndexType portNum) {
|
||||||
|
this->m_driverIsReady = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace Drv
|
||||||
33
Drv/ByteStreamBufferAdapter/ByteStreamBufferAdapter.fpp
Normal file
33
Drv/ByteStreamBufferAdapter/ByteStreamBufferAdapter.fpp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
module Drv {
|
||||||
|
|
||||||
|
@ A passive component for mediating between the ByteStreamDriver
|
||||||
|
@ interface and the PassiveBufferDriver interface
|
||||||
|
@
|
||||||
|
@ Sample topology:
|
||||||
|
@
|
||||||
|
@ -------------------------------------------------
|
||||||
|
@ | |
|
||||||
|
@ | ByteStreamDriver <--> ByteStreamBufferAdapter | <--> PassiveBufferDriverClient
|
||||||
|
@ | |
|
||||||
|
@ -------------------------------------------------
|
||||||
|
@
|
||||||
|
@ The two components in the box function together as a PassiveBufferDriver:
|
||||||
|
@
|
||||||
|
@ -------------------------------------------------
|
||||||
|
@ | |
|
||||||
|
@ | PassiveBufferDriver | <--> PassiveBufferDriverClient
|
||||||
|
@ | |
|
||||||
|
@ -------------------------------------------------
|
||||||
|
@
|
||||||
|
passive component ByteStreamBufferAdapter {
|
||||||
|
|
||||||
|
@ ByteStreamBufferAdapter is a passive client of the ByteStreamDriver
|
||||||
|
@ interface
|
||||||
|
import PassiveByteStreamDriverClient
|
||||||
|
|
||||||
|
@ ByteStreamBufferAdapter is a PassiveBufferDriver
|
||||||
|
import PassiveBufferDriver
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
72
Drv/ByteStreamBufferAdapter/ByteStreamBufferAdapter.hpp
Normal file
72
Drv/ByteStreamBufferAdapter/ByteStreamBufferAdapter.hpp
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
// ======================================================================
|
||||||
|
// \title ByteStreamBufferAdapter.hpp
|
||||||
|
// \author bocchino
|
||||||
|
// \brief hpp file for ByteStreamBufferAdapter component implementation class
|
||||||
|
// ======================================================================
|
||||||
|
|
||||||
|
#ifndef Drv_ByteStreamBufferAdapter_HPP
|
||||||
|
#define Drv_ByteStreamBufferAdapter_HPP
|
||||||
|
|
||||||
|
#include "Drv/ByteStreamBufferAdapter/ByteStreamBufferAdapterComponentAc.hpp"
|
||||||
|
|
||||||
|
namespace Drv {
|
||||||
|
|
||||||
|
class ByteStreamBufferAdapter final : public ByteStreamBufferAdapterComponentBase {
|
||||||
|
public:
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Component construction and destruction
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
//! Construct ByteStreamBufferAdapter object
|
||||||
|
ByteStreamBufferAdapter(const char* const compName //!< The component name
|
||||||
|
);
|
||||||
|
|
||||||
|
//! Destroy ByteStreamBufferAdapter object
|
||||||
|
~ByteStreamBufferAdapter();
|
||||||
|
|
||||||
|
private:
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Handler implementations for typed input ports
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
//! Handler implementation for bufferIn
|
||||||
|
//!
|
||||||
|
//! Port for receiving buffers
|
||||||
|
void bufferIn_handler(FwIndexType portNum, //!< The port number
|
||||||
|
Fw::Buffer& fwBuffer //!< The buffer
|
||||||
|
) override;
|
||||||
|
|
||||||
|
//! Handler implementation for bufferOutReturn
|
||||||
|
//!
|
||||||
|
//! Port for receiving buffers sent on bufferOut and then returned
|
||||||
|
void bufferOutReturn_handler(FwIndexType portNum, //!< The port number
|
||||||
|
Fw::Buffer& fwBuffer //!< The buffer
|
||||||
|
) override;
|
||||||
|
|
||||||
|
//! Handler implementation for byteStreamIn
|
||||||
|
//!
|
||||||
|
//! Port for receiving data from the driver
|
||||||
|
//! Sample connection: byteStreamDriver.$recv -> byteStreamDriverClient.byteStreamIn
|
||||||
|
void fromByteStreamDriver_handler(FwIndexType portNum, //!< The port number
|
||||||
|
Fw::Buffer& buffer,
|
||||||
|
const Drv::ByteStreamStatus& status) override;
|
||||||
|
|
||||||
|
//! Handler implementation for byteStreamReady
|
||||||
|
//!
|
||||||
|
//! Port for receiving ready signals from the driver
|
||||||
|
//! Sample connection: byteStreamDriver.ready -> byteStreamDriverClient.byteStreamDriverReady
|
||||||
|
void byteStreamDriverReady_handler(FwIndexType portNum //!< The port number
|
||||||
|
) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
// Private member variables
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
//! Whether the driver is ready
|
||||||
|
bool m_driverIsReady = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace Drv
|
||||||
|
|
||||||
|
#endif
|
||||||
10
Drv/ByteStreamBufferAdapter/CMakeLists.txt
Normal file
10
Drv/ByteStreamBufferAdapter/CMakeLists.txt
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
set(SOURCE_FILES
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/ByteStreamBufferAdapter.fpp"
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/ByteStreamBufferAdapter.cpp"
|
||||||
|
)
|
||||||
|
|
||||||
|
set(MOD_DEPS
|
||||||
|
"Fw/Logger"
|
||||||
|
)
|
||||||
|
|
||||||
|
register_fprime_module()
|
||||||
@ -1,7 +1,7 @@
|
|||||||
module Drv {
|
module Drv {
|
||||||
|
|
||||||
@ Status returned by the send call
|
@ Status returned by the send call
|
||||||
enum ByteStreamStatus {
|
enum ByteStreamStatus : U8 {
|
||||||
OP_OK @< Operation worked as expected
|
OP_OK @< Operation worked as expected
|
||||||
SEND_RETRY @< Data send should be retried
|
SEND_RETRY @< Data send should be retried
|
||||||
RECV_NO_DATA @< Receive worked, but there was no data
|
RECV_NO_DATA @< Receive worked, but there was no data
|
||||||
|
|||||||
@ -37,7 +37,7 @@ The following components implement the byte stream model using the synchronous i
|
|||||||
- [`Drv::TcpClient`](../../TcpClient/docs/sdd.md): a F´ component wrapper of the tcp client
|
- [`Drv::TcpClient`](../../TcpClient/docs/sdd.md): a F´ component wrapper of the tcp client
|
||||||
- [`Drv::TcpServer`](../../TcpServer/docs/sdd.md): a F´ component wrapper of the tcp server
|
- [`Drv::TcpServer`](../../TcpServer/docs/sdd.md): a F´ component wrapper of the tcp server
|
||||||
- [`Drv::Udp`](../../Udp/docs/sdd.md): a F´ component wrapper of the udp
|
- [`Drv::Udp`](../../Udp/docs/sdd.md): a F´ component wrapper of the udp
|
||||||
- `Drv::LinuxUartDriver`
|
- [`Drv::LinuxUartDriver`](../../LinuxUartDriver/docs/sdd.md): a F´ component wrapper of the Linux UART driver
|
||||||
|
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|||||||
@ -5,11 +5,13 @@ add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Interfaces/")
|
|||||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Ports/")
|
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Ports/")
|
||||||
|
|
||||||
# Components
|
# Components
|
||||||
|
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/AsyncByteStreamBufferAdapter/")
|
||||||
|
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ByteStreamBufferAdapter/")
|
||||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ByteStreamDriverModel/")
|
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/ByteStreamDriverModel/")
|
||||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxGpioDriver/")
|
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxGpioDriver/")
|
||||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxUartDriver/")
|
|
||||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxSpiDriver/")
|
|
||||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxI2cDriver/")
|
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxI2cDriver/")
|
||||||
|
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxSpiDriver/")
|
||||||
|
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/LinuxUartDriver/")
|
||||||
|
|
||||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Ip/")
|
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/Ip/")
|
||||||
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/TcpClient/")
|
add_fprime_subdirectory("${CMAKE_CURRENT_LIST_DIR}/TcpClient/")
|
||||||
|
|||||||
@ -12,6 +12,11 @@ register_fprime_module(
|
|||||||
"${CMAKE_CURRENT_LIST_DIR}/ByteStreamDriver.fpp"
|
"${CMAKE_CURRENT_LIST_DIR}/ByteStreamDriver.fpp"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/Gpio.fpp"
|
"${CMAKE_CURRENT_LIST_DIR}/Gpio.fpp"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/I2c.fpp"
|
"${CMAKE_CURRENT_LIST_DIR}/I2c.fpp"
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/PassiveAsyncByteStreamDriverClient.fpp"
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/PassiveBufferDriver.fpp"
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/PassiveBufferDriverClient.fpp"
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/PassiveByteStreamDriverClient.fpp"
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/PassiveByteStreamDriverClientReadyRecv.fpp"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/Spi.fpp"
|
"${CMAKE_CURRENT_LIST_DIR}/Spi.fpp"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/Tick.fpp"
|
"${CMAKE_CURRENT_LIST_DIR}/Tick.fpp"
|
||||||
INTERFACE
|
INTERFACE
|
||||||
|
|||||||
25
Drv/Interfaces/PassiveAsyncByteStreamDriverClient.fpp
Normal file
25
Drv/Interfaces/PassiveAsyncByteStreamDriverClient.fpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
module Drv {
|
||||||
|
|
||||||
|
@ The send interface of passive client of an asynchronous byte stream driver
|
||||||
|
interface PassiveByteStreamDriverClientSendAsync {
|
||||||
|
|
||||||
|
@ Port for sending data to the driver
|
||||||
|
@ Sample connection: client.toByteStreamDriver -> driver.$send
|
||||||
|
output port toByteStreamDriver: Fw.BufferSend
|
||||||
|
|
||||||
|
@ Port for receiving buffers sent on toByteStreamDriver and then returned
|
||||||
|
@ Sample connection: driver.sendReturnOut -> client.toByteStreamDriverReturn
|
||||||
|
sync input port toByteStreamDriverReturn: Drv.ByteStreamData
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ A passive client of an asynchronous byte stream driver
|
||||||
|
interface PassiveAsyncByteStreamDriverClient {
|
||||||
|
|
||||||
|
import PassiveByteStreamDriverClientReadyRecv
|
||||||
|
|
||||||
|
import PassiveByteStreamDriverClientSendAsync
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
14
Drv/Interfaces/PassiveBufferDriver.fpp
Normal file
14
Drv/Interfaces/PassiveBufferDriver.fpp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
module Drv {
|
||||||
|
|
||||||
|
@ A passive buffer driver
|
||||||
|
interface PassiveBufferDriver {
|
||||||
|
|
||||||
|
@ The interface for sending data to the driver
|
||||||
|
import Fw.PassiveBufferIn
|
||||||
|
|
||||||
|
@ The interface for receiving data from the driver
|
||||||
|
import Fw.PassiveBufferOut
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
40
Drv/Interfaces/PassiveBufferDriverClient.fpp
Normal file
40
Drv/Interfaces/PassiveBufferDriverClient.fpp
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
module Drv {
|
||||||
|
|
||||||
|
@ The send interface of passive client of a buffer driver
|
||||||
|
interface PassiveBufferDriverClientSend {
|
||||||
|
|
||||||
|
@ Port for sending data to the driver
|
||||||
|
@ Sample connection: client.toBufferDriver -> driver.bufferIn
|
||||||
|
output port toBufferDriver: Fw.BufferSend
|
||||||
|
|
||||||
|
@ Port for receiving buffers sent on toBufferDriver and then returned
|
||||||
|
@ Sample connection: driver.bufferInReturn -> client.toBufferDriverReturn
|
||||||
|
sync input port toBufferDriverReturn: Fw.BufferSend
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ The receive interface of passive client of a buffer driver
|
||||||
|
interface PassiveBufferDriverClientRecv {
|
||||||
|
|
||||||
|
@ Port for receiving data from the driver
|
||||||
|
@ Sample connection: driver.bufferOut -> client.fromBufferDriver
|
||||||
|
sync input port fromBufferDriver: Fw.BufferSend
|
||||||
|
|
||||||
|
@ Port for returning buffers received on fromBufferDriver
|
||||||
|
@ Sample connection: client.fromBufferDriverReturn -> driver.bufferOutReturn
|
||||||
|
output port fromBufferDriverReturn: Fw.BufferSend
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ A passive client of a buffer driver
|
||||||
|
interface PassiveBufferDriverClient {
|
||||||
|
|
||||||
|
@ The interface for sending data to the driver
|
||||||
|
import PassiveBufferDriverClientSend
|
||||||
|
|
||||||
|
@ The interface for receiving data from the driver
|
||||||
|
import PassiveBufferDriverClientRecv
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
22
Drv/Interfaces/PassiveByteStreamDriverClient.fpp
Normal file
22
Drv/Interfaces/PassiveByteStreamDriverClient.fpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
module Drv {
|
||||||
|
|
||||||
|
@ The send interface of passive client of a synchronous byte stream driver
|
||||||
|
interface PassiveByteStreamDriverClientSendSync {
|
||||||
|
|
||||||
|
@ Port for sending data to the driver
|
||||||
|
@ Sample connection: client.toByteStreamDriver -> driver.$send
|
||||||
|
output port toByteStreamDriver: Drv.ByteStreamSend
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ A passive client of a synchronous byte stream driver
|
||||||
|
interface PassiveByteStreamDriverClient {
|
||||||
|
|
||||||
|
@ The ready and receive interfaces
|
||||||
|
import PassiveByteStreamDriverClientReadyRecv
|
||||||
|
|
||||||
|
@ The send interface
|
||||||
|
import PassiveByteStreamDriverClientSendSync
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
26
Drv/Interfaces/PassiveByteStreamDriverClientReadyRecv.fpp
Normal file
26
Drv/Interfaces/PassiveByteStreamDriverClientReadyRecv.fpp
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
module Drv {
|
||||||
|
|
||||||
|
@ The ready and receive interfaces for a byte stream driver client
|
||||||
|
interface PassiveByteStreamDriverClientReadyRecv {
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Ready interface
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
@ Port for receiving ready signals from the driver
|
||||||
|
@ Sample connection: byteStreamDriver.ready -> byteStreamDriverClient.byteStreamDriverReady
|
||||||
|
sync input port byteStreamDriverReady: Drv.ByteStreamReady
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
# Receive interface
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
@ Port for receiving data from the driver
|
||||||
|
@ Sample connection: byteStreamDriver.$recv -> byteStreamDriverClient.fromDriver
|
||||||
|
sync input port fromByteStreamDriver: Drv.ByteStreamData
|
||||||
|
|
||||||
|
@ Port for returning ownership of buffers received on fromDriver
|
||||||
|
@ Sample connection: byteStreamDriverClient.byteStreamReturn -> byteStreamDriver.recvReturnIn
|
||||||
|
output port fromByteStreamDriverReturn: Fw.BufferSend
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,5 +1,9 @@
|
|||||||
module Drv {
|
module Drv {
|
||||||
interface Spi {
|
interface Spi {
|
||||||
|
@ Port to perform a synchronous write/read operation over the SPI bus
|
||||||
|
guarded input port SpiWriteRead: Drv.SpiWriteRead
|
||||||
|
|
||||||
|
@ DEPRECATED Use SpiWriteRead port instead (same operation with a return value)
|
||||||
@ Port to perform a synchronous read/write operation over the SPI bus
|
@ Port to perform a synchronous read/write operation over the SPI bus
|
||||||
sync input port SpiReadWrite: Drv.SpiReadWrite
|
sync input port SpiReadWrite: Drv.SpiReadWrite
|
||||||
}
|
}
|
||||||
|
|||||||
@ -129,14 +129,14 @@ SocketIpStatus IpSocket::open(SocketDescriptor& socketDescriptor) {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
SocketIpStatus IpSocket::send(const SocketDescriptor& socketDescriptor, const U8* const data, const U32 size) {
|
SocketIpStatus IpSocket::send(const SocketDescriptor& socketDescriptor, const U8* const data, const FwSizeType size) {
|
||||||
FW_ASSERT(data != nullptr);
|
FW_ASSERT(data != nullptr);
|
||||||
FW_ASSERT(size > 0);
|
FW_ASSERT(size > 0);
|
||||||
|
|
||||||
U32 total = 0;
|
FwSizeType total = 0;
|
||||||
I32 sent = 0;
|
FwSignedSizeType sent = 0;
|
||||||
// Attempt to send out data and retry as necessary
|
// Attempt to send out data and retry as necessary
|
||||||
for (U32 i = 0; (i < SOCKET_MAX_ITERATIONS) && (total < size); i++) {
|
for (FwSizeType i = 0; (i < SOCKET_MAX_ITERATIONS) && (total < size); i++) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
// Send using my specific protocol
|
// Send using my specific protocol
|
||||||
sent = this->sendProtocol(socketDescriptor, data + total, size - total);
|
sent = this->sendProtocol(socketDescriptor, data + total, size - total);
|
||||||
@ -153,7 +153,7 @@ SocketIpStatus IpSocket::send(const SocketDescriptor& socketDescriptor, const U8
|
|||||||
return SOCK_SEND_ERROR;
|
return SOCK_SEND_ERROR;
|
||||||
}
|
}
|
||||||
FW_ASSERT(sent > 0, static_cast<FwAssertArgType>(sent));
|
FW_ASSERT(sent > 0, static_cast<FwAssertArgType>(sent));
|
||||||
total += static_cast<U32>(sent);
|
total += static_cast<FwSizeType>(sent);
|
||||||
}
|
}
|
||||||
// Failed to retry enough to send all data
|
// Failed to retry enough to send all data
|
||||||
if (total < size) {
|
if (total < size) {
|
||||||
@ -164,16 +164,16 @@ SocketIpStatus IpSocket::send(const SocketDescriptor& socketDescriptor, const U8
|
|||||||
return SOCK_SUCCESS;
|
return SOCK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SocketIpStatus IpSocket::recv(const SocketDescriptor& socketDescriptor, U8* data, U32& req_read) {
|
SocketIpStatus IpSocket::recv(const SocketDescriptor& socketDescriptor, U8* data, FwSizeType& req_read) {
|
||||||
// TODO: Uncomment FW_ASSERT for socketDescriptor.fd once we fix TcpClientTester to not pass in uninitialized
|
// TODO: Uncomment FW_ASSERT for socketDescriptor.fd once we fix TcpClientTester to not pass in uninitialized
|
||||||
// socketDescriptor
|
// socketDescriptor
|
||||||
// FW_ASSERT(socketDescriptor.fd != -1, static_cast<FwAssertArgType>(socketDescriptor.fd));
|
// FW_ASSERT(socketDescriptor.fd != -1, static_cast<FwAssertArgType>(socketDescriptor.fd));
|
||||||
FW_ASSERT(data != nullptr);
|
FW_ASSERT(data != nullptr);
|
||||||
|
|
||||||
I32 bytes_received_or_status; // Stores the return value from recvProtocol
|
FwSignedSizeType bytes_received_or_status; // Stores the return value from recvProtocol
|
||||||
|
|
||||||
// Loop primarily for EINTR. Other conditions should lead to an earlier exit.
|
// Loop primarily for EINTR. Other conditions should lead to an earlier exit.
|
||||||
for (U32 i = 0; i < SOCKET_MAX_ITERATIONS; i++) {
|
for (FwSizeType i = 0; i < SOCKET_MAX_ITERATIONS; i++) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
// Pass the current value of req_read (max buffer size) to recvProtocol.
|
// Pass the current value of req_read (max buffer size) to recvProtocol.
|
||||||
// recvProtocol returns bytes read or -1 on error.
|
// recvProtocol returns bytes read or -1 on error.
|
||||||
@ -181,7 +181,7 @@ SocketIpStatus IpSocket::recv(const SocketDescriptor& socketDescriptor, U8* data
|
|||||||
|
|
||||||
if (bytes_received_or_status > 0) {
|
if (bytes_received_or_status > 0) {
|
||||||
// Successfully read data
|
// Successfully read data
|
||||||
req_read = static_cast<U32>(bytes_received_or_status);
|
req_read = static_cast<FwSizeType>(bytes_received_or_status);
|
||||||
return SOCK_SUCCESS;
|
return SOCK_SUCCESS;
|
||||||
} else if (bytes_received_or_status == 0) {
|
} else if (bytes_received_or_status == 0) {
|
||||||
// Handle zero return based on protocol-specific behavior
|
// Handle zero return based on protocol-specific behavior
|
||||||
@ -214,4 +214,22 @@ SocketIpStatus IpSocket::handleZeroReturn() {
|
|||||||
return SOCK_DISCONNECTED;
|
return SOCK_DISCONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SocketIpStatus IpSocket::setupSocketOptions(int socketFd) {
|
||||||
|
// Iterate over the socket options and set them
|
||||||
|
for (const auto& options : IP_SOCKET_OPTIONS) {
|
||||||
|
int status = 0;
|
||||||
|
if (options.type == SOCK_OPT_INT) {
|
||||||
|
status = setsockopt(socketFd, options.level, options.option, &options.value.intVal,
|
||||||
|
sizeof(options.value.intVal));
|
||||||
|
} else {
|
||||||
|
status = setsockopt(socketFd, options.level, options.option, &options.value.sizeVal,
|
||||||
|
sizeof(options.value.sizeVal));
|
||||||
|
}
|
||||||
|
if (status) {
|
||||||
|
return SOCK_FAILED_TO_SET_SOCKET_OPTIONS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return SOCK_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Drv
|
} // namespace Drv
|
||||||
|
|||||||
@ -116,7 +116,7 @@ class IpSocket {
|
|||||||
* \param size: size of data to send
|
* \param size: size of data to send
|
||||||
* \return status of the send, SOCK_DISCONNECTED to reopen, SOCK_SUCCESS on success, something else on error
|
* \return status of the send, SOCK_DISCONNECTED to reopen, SOCK_SUCCESS on success, something else on error
|
||||||
*/
|
*/
|
||||||
virtual SocketIpStatus send(const SocketDescriptor& socketDescriptor, const U8* const data, const U32 size);
|
virtual SocketIpStatus send(const SocketDescriptor& socketDescriptor, const U8* const data, const FwSizeType size);
|
||||||
/**
|
/**
|
||||||
* \brief receive data from the IP socket from the given buffer
|
* \brief receive data from the IP socket from the given buffer
|
||||||
*
|
*
|
||||||
@ -133,7 +133,7 @@ class IpSocket {
|
|||||||
* \param size: maximum size of data buffer to fill
|
* \param size: maximum size of data buffer to fill
|
||||||
* \return status of the send, SOCK_DISCONNECTED to reopen, SOCK_SUCCESS on success, something else on error
|
* \return status of the send, SOCK_DISCONNECTED to reopen, SOCK_SUCCESS on success, something else on error
|
||||||
*/
|
*/
|
||||||
SocketIpStatus recv(const SocketDescriptor& fd, U8* const data, U32& size);
|
SocketIpStatus recv(const SocketDescriptor& fd, U8* const data, FwSizeType& size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief closes the socket
|
* \brief closes the socket
|
||||||
@ -198,7 +198,9 @@ class IpSocket {
|
|||||||
* \param size: size of data to send
|
* \param size: size of data to send
|
||||||
* \return: size of data sent, or -1 on error.
|
* \return: size of data sent, or -1 on error.
|
||||||
*/
|
*/
|
||||||
virtual I32 sendProtocol(const SocketDescriptor& socketDescriptor, const U8* const data, const U32 size) = 0;
|
virtual FwSignedSizeType sendProtocol(const SocketDescriptor& socketDescriptor,
|
||||||
|
const U8* const data,
|
||||||
|
const FwSizeType size) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Protocol specific implementation of recv. Called directly with error handling from recv.
|
* \brief Protocol specific implementation of recv. Called directly with error handling from recv.
|
||||||
@ -207,7 +209,9 @@ class IpSocket {
|
|||||||
* \param size: size of data buffer
|
* \param size: size of data buffer
|
||||||
* \return: size of data received, or -1 on error.
|
* \return: size of data received, or -1 on error.
|
||||||
*/
|
*/
|
||||||
virtual I32 recvProtocol(const SocketDescriptor& socketDescriptor, U8* const data, const U32 size) = 0;
|
virtual FwSignedSizeType recvProtocol(const SocketDescriptor& socketDescriptor,
|
||||||
|
U8* const data,
|
||||||
|
const FwSizeType size) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Handle zero return from recvProtocol
|
* \brief Handle zero return from recvProtocol
|
||||||
@ -220,6 +224,13 @@ class IpSocket {
|
|||||||
*/
|
*/
|
||||||
virtual SocketIpStatus handleZeroReturn();
|
virtual SocketIpStatus handleZeroReturn();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief setup the socket options of the input socket as defined in IpCfg.hpp
|
||||||
|
* \param socketFd: socket file descriptor
|
||||||
|
* \return status of setup options
|
||||||
|
*/
|
||||||
|
SocketIpStatus setupSocketOptions(int socketFd);
|
||||||
|
|
||||||
U32 m_timeoutSeconds;
|
U32 m_timeoutSeconds;
|
||||||
U32 m_timeoutMicroseconds;
|
U32 m_timeoutMicroseconds;
|
||||||
U16 m_port; //!< IP address port used
|
U16 m_port; //!< IP address port used
|
||||||
|
|||||||
@ -21,10 +21,25 @@ SocketComponentHelper::SocketComponentHelper() {}
|
|||||||
|
|
||||||
SocketComponentHelper::~SocketComponentHelper() {}
|
SocketComponentHelper::~SocketComponentHelper() {}
|
||||||
|
|
||||||
void SocketComponentHelper::start(const Fw::StringBase& name,
|
void SocketComponentHelper::start(const Fw::ConstStringBase& name,
|
||||||
const FwTaskPriorityType priority,
|
const FwTaskPriorityType priority,
|
||||||
const Os::Task::ParamType stack,
|
const Os::Task::ParamType stack,
|
||||||
const Os::Task::ParamType cpuAffinity) {
|
const Os::Task::ParamType cpuAffinity,
|
||||||
|
const FwTaskPriorityType priorityReconnect,
|
||||||
|
const Os::Task::ParamType stackReconnect,
|
||||||
|
const Os::Task::ParamType cpuAffinityReconnect) {
|
||||||
|
// Reconnect Thread
|
||||||
|
FW_ASSERT(m_reconnectTask.getState() ==
|
||||||
|
Os::Task::State::NOT_STARTED); // It is a coding error to start this task multiple times
|
||||||
|
this->m_reconnectStop = false;
|
||||||
|
Fw::String reconnectName;
|
||||||
|
reconnectName.format("%s_reconnect", name.toChar());
|
||||||
|
Os::Task::Arguments reconnectArguments(reconnectName, SocketComponentHelper::reconnectTask, this, priorityReconnect,
|
||||||
|
stackReconnect, cpuAffinityReconnect);
|
||||||
|
Os::Task::Status reconnectStat = m_reconnectTask.start(reconnectArguments);
|
||||||
|
FW_ASSERT(Os::Task::OP_OK == reconnectStat, static_cast<FwAssertArgType>(reconnectStat));
|
||||||
|
|
||||||
|
// Read Thread
|
||||||
FW_ASSERT(m_task.getState() ==
|
FW_ASSERT(m_task.getState() ==
|
||||||
Os::Task::State::NOT_STARTED); // It is a coding error to start this task multiple times
|
Os::Task::State::NOT_STARTED); // It is a coding error to start this task multiple times
|
||||||
this->m_stop = false;
|
this->m_stop = false;
|
||||||
@ -80,18 +95,19 @@ void SocketComponentHelper::setAutomaticOpen(bool auto_open) {
|
|||||||
this->m_reopen = auto_open;
|
this->m_reopen = auto_open;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SocketComponentHelper::getAutomaticOpen() {
|
||||||
|
Os::ScopeLock scopedLock(this->m_lock);
|
||||||
|
return this->m_reopen;
|
||||||
|
}
|
||||||
|
|
||||||
SocketIpStatus SocketComponentHelper::reopen() {
|
SocketIpStatus SocketComponentHelper::reopen() {
|
||||||
SocketIpStatus status = SOCK_SUCCESS;
|
SocketIpStatus status = SOCK_SUCCESS;
|
||||||
if (not this->isOpened()) {
|
if (not this->isOpened()) {
|
||||||
// Check for auto-open before attempting to reopen
|
// Check for auto-open before attempting to reopen
|
||||||
bool reopen = false;
|
bool reopen = this->getAutomaticOpen();
|
||||||
{
|
|
||||||
Os::ScopeLock scopedLock(this->m_lock);
|
|
||||||
reopen = this->m_reopen;
|
|
||||||
}
|
|
||||||
// Open a network connection if it has not already been open
|
|
||||||
if (not reopen) {
|
if (not reopen) {
|
||||||
status = SOCK_AUTO_CONNECT_DISABLED;
|
status = SOCK_AUTO_CONNECT_DISABLED;
|
||||||
|
// Open a network connection if it has not already been open
|
||||||
} else {
|
} else {
|
||||||
status = this->open();
|
status = this->open();
|
||||||
if (status == SocketIpStatus::SOCK_ANOTHER_THREAD_OPENING) {
|
if (status == SocketIpStatus::SOCK_ANOTHER_THREAD_OPENING) {
|
||||||
@ -102,22 +118,23 @@ SocketIpStatus SocketComponentHelper::reopen() {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
SocketIpStatus SocketComponentHelper::send(const U8* const data, const U32 size) {
|
SocketIpStatus SocketComponentHelper::send(const U8* const data, const FwSizeType size) {
|
||||||
SocketIpStatus status = SOCK_SUCCESS;
|
SocketIpStatus status = SOCK_SUCCESS;
|
||||||
this->m_lock.lock();
|
this->m_lock.lock();
|
||||||
SocketDescriptor descriptor = this->m_descriptor;
|
SocketDescriptor descriptor = this->m_descriptor;
|
||||||
this->m_lock.unlock();
|
this->m_lock.unlock();
|
||||||
// Prevent transmission before connection, or after a disconnect
|
// Prevent transmission before connection, or after a disconnect
|
||||||
if (descriptor.fd == -1) {
|
if (descriptor.fd == -1) {
|
||||||
status = this->reopen();
|
this->requestReconnect();
|
||||||
// if reopen wasn't successful, pass the that up to the caller
|
SocketIpStatus reconnectStat = this->waitForReconnect();
|
||||||
if (status != SOCK_SUCCESS) {
|
if (reconnectStat == SOCK_SUCCESS) {
|
||||||
return status;
|
// Refresh local copy after reopen
|
||||||
|
this->m_lock.lock();
|
||||||
|
descriptor = this->m_descriptor;
|
||||||
|
this->m_lock.unlock();
|
||||||
|
} else {
|
||||||
|
return reconnectStat;
|
||||||
}
|
}
|
||||||
// Refresh local copy after reopen
|
|
||||||
this->m_lock.lock();
|
|
||||||
descriptor = this->m_descriptor;
|
|
||||||
this->m_lock.unlock();
|
|
||||||
}
|
}
|
||||||
status = this->getSocketHandler().send(descriptor, data, size);
|
status = this->getSocketHandler().send(descriptor, data, size);
|
||||||
if (status == SOCK_DISCONNECTED) {
|
if (status == SOCK_DISCONNECTED) {
|
||||||
@ -138,8 +155,15 @@ void SocketComponentHelper::close() {
|
|||||||
this->m_open = OpenState::NOT_OPEN;
|
this->m_open = OpenState::NOT_OPEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Read Thread */
|
||||||
|
|
||||||
Os::Task::Status SocketComponentHelper::join() {
|
Os::Task::Status SocketComponentHelper::join() {
|
||||||
return m_task.join();
|
Os::Task::Status stat = m_task.join();
|
||||||
|
Os::Task::Status reconnectStat = this->joinReconnect();
|
||||||
|
if (stat == Os::Task::Status::OP_OK) {
|
||||||
|
return reconnectStat;
|
||||||
|
}
|
||||||
|
return stat;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SocketComponentHelper::stop() {
|
void SocketComponentHelper::stop() {
|
||||||
@ -148,6 +172,7 @@ void SocketComponentHelper::stop() {
|
|||||||
Os::ScopeLock scopeLock(m_lock);
|
Os::ScopeLock scopeLock(m_lock);
|
||||||
this->m_stop = true;
|
this->m_stop = true;
|
||||||
}
|
}
|
||||||
|
this->stopReconnect();
|
||||||
this->shutdown(); // Break out of any receives and fully shutdown
|
this->shutdown(); // Break out of any receives and fully shutdown
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +182,7 @@ bool SocketComponentHelper::running() {
|
|||||||
return running;
|
return running;
|
||||||
}
|
}
|
||||||
|
|
||||||
SocketIpStatus SocketComponentHelper::recv(U8* data, U32& size) {
|
SocketIpStatus SocketComponentHelper::recv(U8* data, FwSizeType& size) {
|
||||||
SocketIpStatus status = SOCK_SUCCESS;
|
SocketIpStatus status = SOCK_SUCCESS;
|
||||||
// Check for previously disconnected socket
|
// Check for previously disconnected socket
|
||||||
this->m_lock.lock();
|
this->m_lock.lock();
|
||||||
@ -178,30 +203,25 @@ void SocketComponentHelper::readLoop() {
|
|||||||
do {
|
do {
|
||||||
// Prevent transmission before connection, or after a disconnect
|
// Prevent transmission before connection, or after a disconnect
|
||||||
if ((not this->isOpened()) and this->running()) {
|
if ((not this->isOpened()) and this->running()) {
|
||||||
status = this->reopen();
|
this->requestReconnect();
|
||||||
|
status = this->waitForReconnect();
|
||||||
// When reopen is disabled, just break as this is a exit condition for the loop
|
// When reopen is disabled, just break as this is a exit condition for the loop
|
||||||
if (status == SOCK_AUTO_CONNECT_DISABLED) {
|
if (status == SOCK_AUTO_CONNECT_DISABLED) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// If the reconnection failed in any other way, warn, wait, and retry
|
|
||||||
else if (status != SOCK_SUCCESS) {
|
|
||||||
Fw::Logger::log("[WARNING] Failed to open port with status %d and errno %d\n", status, errno);
|
|
||||||
(void)Os::Task::delay(SOCKET_RETRY_INTERVAL);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// If the network connection is open, read from it
|
// If the network connection is open, read from it
|
||||||
if (this->isOpened() and this->running()) {
|
if (this->isOpened() and this->running()) {
|
||||||
Fw::Buffer buffer = this->getBuffer();
|
Fw::Buffer buffer = this->getBuffer();
|
||||||
U8* data = buffer.getData();
|
U8* data = buffer.getData();
|
||||||
FW_ASSERT(data);
|
FW_ASSERT(data);
|
||||||
FW_ASSERT_NO_OVERFLOW(buffer.getSize(), U32);
|
FwSizeType size = buffer.getSize();
|
||||||
U32 size = static_cast<U32>(buffer.getSize());
|
|
||||||
// recv blocks, so it may have been a while since its done an isOpened check
|
// recv blocks, so it may have been a while since its done an isOpened check
|
||||||
status = this->recv(data, size);
|
status = this->recv(data, size);
|
||||||
if ((status != SOCK_SUCCESS) && (status != SOCK_INTERRUPTED_TRY_AGAIN) &&
|
if ((status != SOCK_SUCCESS) && (status != SOCK_INTERRUPTED_TRY_AGAIN) &&
|
||||||
(status != SOCK_NO_DATA_AVAILABLE)) {
|
(status != SOCK_NO_DATA_AVAILABLE)) {
|
||||||
Fw::Logger::log("[WARNING] Failed to recv from port with status %d and errno %d\n", status, errno);
|
Fw::Logger::log("[WARNING] %s failed to recv from port with status %d and errno %d\n",
|
||||||
|
this->m_task.getName().toChar(), status, errno);
|
||||||
this->close();
|
this->close();
|
||||||
buffer.setSize(0);
|
buffer.setSize(0);
|
||||||
} else {
|
} else {
|
||||||
@ -222,4 +242,124 @@ void SocketComponentHelper::readTask(void* pointer) {
|
|||||||
SocketComponentHelper* self = reinterpret_cast<SocketComponentHelper*>(pointer);
|
SocketComponentHelper* self = reinterpret_cast<SocketComponentHelper*>(pointer);
|
||||||
self->readLoop();
|
self->readLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Reconnect Thread */
|
||||||
|
|
||||||
|
Os::Task::Status SocketComponentHelper::joinReconnect() {
|
||||||
|
return m_reconnectTask.join();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SocketComponentHelper::stopReconnect() {
|
||||||
|
Os::ScopeLock scopeLock(this->m_reconnectLock);
|
||||||
|
this->m_reconnectState = ReconnectState::NOT_RECONNECTING;
|
||||||
|
this->m_reconnectStop = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SocketComponentHelper::runningReconnect() {
|
||||||
|
Os::ScopeLock scopedLock(this->m_reconnectLock);
|
||||||
|
bool running = not this->m_reconnectStop;
|
||||||
|
return running;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SocketComponentHelper::reconnectLoop() {
|
||||||
|
SocketIpStatus status = SOCK_SUCCESS;
|
||||||
|
while (this->runningReconnect()) {
|
||||||
|
// Check if we need to reconnect
|
||||||
|
bool reconnect = false;
|
||||||
|
{
|
||||||
|
Os::ScopeLock scopedLock(this->m_reconnectLock);
|
||||||
|
if (this->m_reconnectState == ReconnectState::REQUEST_RECONNECT) {
|
||||||
|
this->m_reconnectState = ReconnectState::RECONNECT_IN_PROGRESS;
|
||||||
|
reconnect = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
// If we were already in or are now in RECONNECT_IN_PROGRESS we
|
||||||
|
// need to try to reconnect, again
|
||||||
|
else if (this->m_reconnectState == ReconnectState::RECONNECT_IN_PROGRESS) {
|
||||||
|
reconnect = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (reconnect) {
|
||||||
|
status = this->reopen();
|
||||||
|
|
||||||
|
// Reopen Case 1: Auto Connect is disabled, so no longer
|
||||||
|
// try to reconnect
|
||||||
|
if (status == SOCK_AUTO_CONNECT_DISABLED) {
|
||||||
|
Os::ScopeLock scopedLock(this->m_reconnectLock);
|
||||||
|
this->m_reconnectState = ReconnectState::NOT_RECONNECTING;
|
||||||
|
}
|
||||||
|
// Reopen Case 2: Success, so no longer
|
||||||
|
// try to reconnect
|
||||||
|
else if (status == SOCK_SUCCESS) {
|
||||||
|
Os::ScopeLock scopedLock(this->m_reconnectLock);
|
||||||
|
this->m_reconnectState = ReconnectState::NOT_RECONNECTING;
|
||||||
|
}
|
||||||
|
// Reopen Case 3: Keep trying to reconnect - NO reconnect
|
||||||
|
// state change
|
||||||
|
else {
|
||||||
|
Fw::Logger::log("[WARNING] %s failed to open port with status %d and errno %d\n",
|
||||||
|
this->m_task.getName().toChar(), status, errno);
|
||||||
|
(void)Os::Task::delay(SOCKET_RETRY_INTERVAL);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// After a brief delay, we will loop again
|
||||||
|
(void)Os::Task::delay(this->m_reconnectCheckInterval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SocketComponentHelper::reconnectTask(void* pointer) {
|
||||||
|
FW_ASSERT(pointer);
|
||||||
|
SocketComponentHelper* self = reinterpret_cast<SocketComponentHelper*>(pointer);
|
||||||
|
self->reconnectLoop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SocketComponentHelper::requestReconnect() {
|
||||||
|
Os::ScopeLock scopedLock(this->m_reconnectLock);
|
||||||
|
if (m_reconnectState == ReconnectState::NOT_RECONNECTING) {
|
||||||
|
m_reconnectState = ReconnectState::REQUEST_RECONNECT;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SocketIpStatus SocketComponentHelper::waitForReconnect(Fw::TimeInterval timeout) {
|
||||||
|
// Do not attempt to reconnect if auto reconnect config flag is disabled
|
||||||
|
if (!this->getAutomaticOpen()) {
|
||||||
|
return SOCK_AUTO_CONNECT_DISABLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
Fw::TimeInterval elapsed = Fw::TimeInterval(0, 0);
|
||||||
|
|
||||||
|
while (elapsed < timeout) {
|
||||||
|
// If the reconnect thread is NOT reconnecting, we are done waiting
|
||||||
|
// If we are no longer running the reconnect thread, we are done waiting
|
||||||
|
{
|
||||||
|
Os::ScopeLock scopedLock(this->m_reconnectLock);
|
||||||
|
if (this->m_reconnectState == ReconnectState::NOT_RECONNECTING) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (this->m_reconnectStop) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Wait a bit before checking again
|
||||||
|
(void)Os::Task::delay(this->m_reconnectWaitInterval);
|
||||||
|
elapsed.add(this->m_reconnectWaitInterval.getSeconds(), this->m_reconnectWaitInterval.getUSeconds());
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we have completed our loop, check if we are connected or if
|
||||||
|
// auto connect was disabled during our wait
|
||||||
|
if (this->isOpened()) {
|
||||||
|
return SOCK_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check one more time if auto reconnect config flag got disabled
|
||||||
|
if (!this->getAutomaticOpen()) {
|
||||||
|
return SOCK_AUTO_CONNECT_DISABLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
return SOCK_DISCONNECTED; // Indicates failure of this attempt, another reopen needed
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Drv
|
} // namespace Drv
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
#include <Drv/Ip/IpSocket.hpp>
|
#include <Drv/Ip/IpSocket.hpp>
|
||||||
#include <Fw/Buffer/Buffer.hpp>
|
#include <Fw/Buffer/Buffer.hpp>
|
||||||
|
#include <Os/Condition.hpp>
|
||||||
#include <Os/Mutex.hpp>
|
#include <Os/Mutex.hpp>
|
||||||
#include <Os/Task.hpp>
|
#include <Os/Task.hpp>
|
||||||
|
|
||||||
@ -28,6 +29,7 @@ namespace Drv {
|
|||||||
class SocketComponentHelper {
|
class SocketComponentHelper {
|
||||||
public:
|
public:
|
||||||
enum OpenState { NOT_OPEN, OPENING, OPEN, SKIP };
|
enum OpenState { NOT_OPEN, OPENING, OPEN, SKIP };
|
||||||
|
enum ReconnectState { NOT_RECONNECTING, REQUEST_RECONNECT, RECONNECT_IN_PROGRESS };
|
||||||
/**
|
/**
|
||||||
* \brief constructs the socket read task
|
* \brief constructs the socket read task
|
||||||
*/
|
*/
|
||||||
@ -47,15 +49,25 @@ class SocketComponentHelper {
|
|||||||
* default behavior is to automatically open connections.
|
* default behavior is to automatically open connections.
|
||||||
*
|
*
|
||||||
* \param name: name of the task
|
* \param name: name of the task
|
||||||
* \param priority: priority of the started task. See: Os::Task::start. Default: TASK_PRIORITY_DEFAULT, not
|
* \param priority: priority of the started read task. See: Os::Task::start. Default: TASK_PRIORITY_DEFAULT, not
|
||||||
* prioritized
|
* prioritized
|
||||||
* \param stack: stack size provided to the task. See: Os::Task::start. Default: TASK_DEFAULT, posix threads default
|
* \param stack: stack size provided to the read task. See: Os::Task::start. Default: TASK_DEFAULT, posix threads
|
||||||
* \param cpuAffinity: cpu affinity provided to task. See: Os::Task::start. Default: TASK_DEFAULT, don't care
|
* default
|
||||||
|
* \param cpuAffinity: cpu affinity provided to read task. See: Os::Task::start. Default: TASK_DEFAULT, don't care
|
||||||
|
* \param priorityReconnect: priority of the started reconnect task. See: Os::Task::start. Default:
|
||||||
|
* TASK_PRIORITY_DEFAULT, not prioritized
|
||||||
|
* \param stackReconnect: stack size provided to the reconnect task. See: Os::Task::start. Default: TASK_DEFAULT,
|
||||||
|
* posix threads default
|
||||||
|
* \param cpuAffinityReconnect: cpu affinity provided to reconnect task. See: Os::Task::start. Default:
|
||||||
|
* TASK_DEFAULT, don't care
|
||||||
*/
|
*/
|
||||||
void start(const Fw::StringBase& name,
|
void start(const Fw::ConstStringBase& name,
|
||||||
const FwTaskPriorityType priority = Os::Task::TASK_PRIORITY_DEFAULT,
|
const FwTaskPriorityType priority = Os::Task::TASK_PRIORITY_DEFAULT,
|
||||||
const Os::Task::ParamType stack = Os::Task::TASK_DEFAULT,
|
const Os::Task::ParamType stack = Os::Task::TASK_DEFAULT,
|
||||||
const Os::Task::ParamType cpuAffinity = Os::Task::TASK_DEFAULT);
|
const Os::Task::ParamType cpuAffinity = Os::Task::TASK_DEFAULT,
|
||||||
|
const FwTaskPriorityType priorityReconnect = Os::Task::TASK_PRIORITY_DEFAULT,
|
||||||
|
const Os::Task::ParamType stackReconnect = Os::Task::TASK_DEFAULT,
|
||||||
|
const Os::Task::ParamType cpuAffinityReconnect = Os::Task::TASK_DEFAULT);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief open the socket for communications
|
* \brief open the socket for communications
|
||||||
@ -91,6 +103,13 @@ class SocketComponentHelper {
|
|||||||
*/
|
*/
|
||||||
void setAutomaticOpen(bool auto_open);
|
void setAutomaticOpen(bool auto_open);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief get socket automatically open connections status
|
||||||
|
*
|
||||||
|
* \return status of auto_open
|
||||||
|
*/
|
||||||
|
bool getAutomaticOpen();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief send data to the IP socket from the given buffer
|
* \brief send data to the IP socket from the given buffer
|
||||||
*
|
*
|
||||||
@ -99,7 +118,7 @@ class SocketComponentHelper {
|
|||||||
* \param size: size of data to send
|
* \param size: size of data to send
|
||||||
* \return status of send, SOCK_SUCCESS for success, something else on error
|
* \return status of send, SOCK_SUCCESS for success, something else on error
|
||||||
*/
|
*/
|
||||||
SocketIpStatus send(const U8* const data, const U32 size);
|
SocketIpStatus send(const U8* const data, const FwSizeType size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief receive data from the IP socket from the given buffer
|
* \brief receive data from the IP socket from the given buffer
|
||||||
@ -109,7 +128,7 @@ class SocketComponentHelper {
|
|||||||
* \param size: maximum size of data buffer to fill
|
* \param size: maximum size of data buffer to fill
|
||||||
* \return status of the send, SOCK_DISCONNECTED to reopen, SOCK_SUCCESS on success, something else on error
|
* \return status of the send, SOCK_DISCONNECTED to reopen, SOCK_SUCCESS on success, something else on error
|
||||||
*/
|
*/
|
||||||
SocketIpStatus recv(U8* data, U32& size);
|
SocketIpStatus recv(U8* data, FwSizeType& size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief close the socket communications
|
* \brief close the socket communications
|
||||||
@ -134,6 +153,7 @@ class SocketComponentHelper {
|
|||||||
* \brief is the read loop running
|
* \brief is the read loop running
|
||||||
*/
|
*/
|
||||||
bool running();
|
bool running();
|
||||||
|
bool runningReconnect();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief stop the socket read task and close the associated socket.
|
* \brief stop the socket read task and close the associated socket.
|
||||||
@ -143,6 +163,8 @@ class SocketComponentHelper {
|
|||||||
*/
|
*/
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
|
void stopReconnect();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief joins to the stopping read task to wait for it to close
|
* \brief joins to the stopping read task to wait for it to close
|
||||||
*
|
*
|
||||||
@ -153,11 +175,19 @@ class SocketComponentHelper {
|
|||||||
*/
|
*/
|
||||||
Os::Task::Status join();
|
Os::Task::Status join();
|
||||||
|
|
||||||
|
Os::Task::Status joinReconnect();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* \brief receive off the TCP socket
|
* \brief receive off the TCP socket
|
||||||
*/
|
*/
|
||||||
virtual void readLoop();
|
virtual void readLoop();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief reconnect TCP socket
|
||||||
|
*/
|
||||||
|
virtual void reconnectLoop();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief returns a reference to the socket handler
|
* \brief returns a reference to the socket handler
|
||||||
*
|
*
|
||||||
@ -206,6 +236,33 @@ class SocketComponentHelper {
|
|||||||
*/
|
*/
|
||||||
static void readTask(void* pointer);
|
static void readTask(void* pointer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief a task designed for socket reconnection
|
||||||
|
*
|
||||||
|
* \param pointer: pointer to "this" component
|
||||||
|
*/
|
||||||
|
static void reconnectTask(void* pointer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief signal to reconnect task that a reconnect is needed
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void requestReconnect();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief wait method for a task to wait for a reconnect request to complete
|
||||||
|
*
|
||||||
|
* After requesting a reconnect, tasks should call this method
|
||||||
|
* to wait for the reconnect thread to complete
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* \param timeout: timeout so that the wait doesn't hang indefinitely
|
||||||
|
*
|
||||||
|
* \return status of the reconnect request, SOCK_DISCONNECTED for
|
||||||
|
* reopen again, or SOCK_SUCCESS on success, something else on error
|
||||||
|
*/
|
||||||
|
SocketIpStatus waitForReconnect(Fw::TimeInterval timeout = Fw::TimeInterval(1, 0));
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* \brief Re-open port if it has been disconnected
|
* \brief Re-open port if it has been disconnected
|
||||||
@ -219,12 +276,24 @@ class SocketComponentHelper {
|
|||||||
SocketIpStatus reopen();
|
SocketIpStatus reopen();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool m_reopen = true; //!< Force reopen on disconnect
|
||||||
|
SocketDescriptor m_descriptor;
|
||||||
|
|
||||||
|
// Read/recv
|
||||||
Os::Task m_task;
|
Os::Task m_task;
|
||||||
Os::Mutex m_lock;
|
Os::Mutex m_lock;
|
||||||
SocketDescriptor m_descriptor;
|
|
||||||
bool m_reopen = true; //!< Force reopen on disconnect
|
|
||||||
bool m_stop = true; //!< Stops the task when set to true
|
bool m_stop = true; //!< Stops the task when set to true
|
||||||
OpenState m_open = OpenState::NOT_OPEN; //!< Have we successfully opened
|
OpenState m_open = OpenState::NOT_OPEN; //!< Have we successfully opened
|
||||||
|
|
||||||
|
// Reconnect
|
||||||
|
Os::Task m_reconnectTask;
|
||||||
|
Os::Mutex m_reconnectLock;
|
||||||
|
bool m_reconnectStop = true;
|
||||||
|
ReconnectState m_reconnectState = ReconnectState::NOT_RECONNECTING;
|
||||||
|
Fw::TimeInterval m_reconnectCheckInterval =
|
||||||
|
Fw::TimeInterval(0, 50000); // 50 ms, Interval at which reconnect task loop checks for requests
|
||||||
|
Fw::TimeInterval m_reconnectWaitInterval =
|
||||||
|
Fw::TimeInterval(0, 10000); // 10 ms, Interval at which reconnect requesters wait for response
|
||||||
};
|
};
|
||||||
} // namespace Drv
|
} // namespace Drv
|
||||||
#endif // DRV_SocketComponentHelper_HPP
|
#endif // DRV_SocketComponentHelper_HPP
|
||||||
|
|||||||
@ -69,6 +69,11 @@ SocketIpStatus TcpClientSocket::openProtocol(SocketDescriptor& socketDescriptor)
|
|||||||
return SOCK_INVALID_IP_ADDRESS;
|
return SOCK_INVALID_IP_ADDRESS;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (IpSocket::setupSocketOptions(socketFd) != SOCK_SUCCESS) {
|
||||||
|
::close(socketFd);
|
||||||
|
return SOCK_FAILED_TO_SET_SOCKET_OPTIONS;
|
||||||
|
}
|
||||||
|
|
||||||
// Now apply timeouts
|
// Now apply timeouts
|
||||||
if (IpSocket::setupTimeouts(socketFd) != SOCK_SUCCESS) {
|
if (IpSocket::setupTimeouts(socketFd) != SOCK_SUCCESS) {
|
||||||
::close(socketFd);
|
::close(socketFd);
|
||||||
@ -85,12 +90,18 @@ SocketIpStatus TcpClientSocket::openProtocol(SocketDescriptor& socketDescriptor)
|
|||||||
return SOCK_SUCCESS;
|
return SOCK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
I32 TcpClientSocket::sendProtocol(const SocketDescriptor& socketDescriptor, const U8* const data, const U32 size) {
|
FwSignedSizeType TcpClientSocket::sendProtocol(const SocketDescriptor& socketDescriptor,
|
||||||
return static_cast<I32>(::send(socketDescriptor.fd, data, size, SOCKET_IP_SEND_FLAGS));
|
const U8* const data,
|
||||||
|
const FwSizeType size) {
|
||||||
|
return static_cast<FwSignedSizeType>(
|
||||||
|
::send(socketDescriptor.fd, data, static_cast<size_t>(size), SOCKET_IP_SEND_FLAGS));
|
||||||
}
|
}
|
||||||
|
|
||||||
I32 TcpClientSocket::recvProtocol(const SocketDescriptor& socketDescriptor, U8* const data, const U32 size) {
|
FwSignedSizeType TcpClientSocket::recvProtocol(const SocketDescriptor& socketDescriptor,
|
||||||
return static_cast<I32>(::recv(socketDescriptor.fd, data, size, SOCKET_IP_RECV_FLAGS));
|
U8* const data,
|
||||||
|
const FwSizeType size) {
|
||||||
|
return static_cast<FwSignedSizeType>(
|
||||||
|
::recv(socketDescriptor.fd, data, static_cast<size_t>(size), SOCKET_IP_RECV_FLAGS));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Drv
|
} // namespace Drv
|
||||||
|
|||||||
@ -56,7 +56,9 @@ class TcpClientSocket : public IpSocket {
|
|||||||
* \param size: size of data to send
|
* \param size: size of data to send
|
||||||
* \return: size of data sent, or -1 on error.
|
* \return: size of data sent, or -1 on error.
|
||||||
*/
|
*/
|
||||||
I32 sendProtocol(const SocketDescriptor& socketDescriptor, const U8* const data, const U32 size) override;
|
FwSignedSizeType sendProtocol(const SocketDescriptor& socketDescriptor,
|
||||||
|
const U8* const data,
|
||||||
|
const FwSizeType size) override;
|
||||||
/**
|
/**
|
||||||
* \brief Protocol specific implementation of recv. Called directly with error handling from recv.
|
* \brief Protocol specific implementation of recv. Called directly with error handling from recv.
|
||||||
* \param socketDescriptor: descriptor to recv from
|
* \param socketDescriptor: descriptor to recv from
|
||||||
@ -64,7 +66,9 @@ class TcpClientSocket : public IpSocket {
|
|||||||
* \param size: size of data buffer
|
* \param size: size of data buffer
|
||||||
* \return: size of data received, or -1 on error.
|
* \return: size of data received, or -1 on error.
|
||||||
*/
|
*/
|
||||||
I32 recvProtocol(const SocketDescriptor& socketDescriptor, U8* const data, const U32 size) override;
|
FwSignedSizeType recvProtocol(const SocketDescriptor& socketDescriptor,
|
||||||
|
U8* const data,
|
||||||
|
const FwSizeType size) override;
|
||||||
};
|
};
|
||||||
} // namespace Drv
|
} // namespace Drv
|
||||||
|
|
||||||
|
|||||||
@ -66,6 +66,11 @@ SocketIpStatus TcpServerSocket::startup(SocketDescriptor& socketDescriptor) {
|
|||||||
return SOCK_INVALID_IP_ADDRESS;
|
return SOCK_INVALID_IP_ADDRESS;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (IpSocket::setupSocketOptions(serverFd) != SOCK_SUCCESS) {
|
||||||
|
::close(serverFd);
|
||||||
|
return SOCK_FAILED_TO_SET_SOCKET_OPTIONS;
|
||||||
|
}
|
||||||
|
|
||||||
// TCP requires bind to an address to the socket
|
// TCP requires bind to an address to the socket
|
||||||
if (::bind(serverFd, reinterpret_cast<struct sockaddr*>(&address), sizeof(address)) < 0) {
|
if (::bind(serverFd, reinterpret_cast<struct sockaddr*>(&address), sizeof(address)) < 0) {
|
||||||
::close(serverFd);
|
::close(serverFd);
|
||||||
@ -119,15 +124,19 @@ SocketIpStatus TcpServerSocket::openProtocol(SocketDescriptor& socketDescriptor)
|
|||||||
return SOCK_SUCCESS;
|
return SOCK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
I32 TcpServerSocket::sendProtocol(const SocketDescriptor& socketDescriptor, const U8* const data, const U32 size) {
|
FwSignedSizeType TcpServerSocket::sendProtocol(const SocketDescriptor& socketDescriptor,
|
||||||
return static_cast<I32>(::send(socketDescriptor.fd, data, size, SOCKET_IP_SEND_FLAGS));
|
const U8* const data,
|
||||||
|
const FwSizeType size) {
|
||||||
|
return static_cast<FwSignedSizeType>(
|
||||||
|
::send(socketDescriptor.fd, data, static_cast<size_t>(size), SOCKET_IP_SEND_FLAGS));
|
||||||
}
|
}
|
||||||
|
|
||||||
I32 TcpServerSocket::recvProtocol(const SocketDescriptor& socketDescriptor, U8* const data, const U32 size) {
|
FwSignedSizeType TcpServerSocket::recvProtocol(const SocketDescriptor& socketDescriptor,
|
||||||
I32 size_buf;
|
U8* const data,
|
||||||
|
const FwSizeType size) {
|
||||||
// recv will return 0 if the client has done an orderly shutdown
|
// recv will return 0 if the client has done an orderly shutdown
|
||||||
size_buf = static_cast<I32>(::recv(socketDescriptor.fd, data, size, SOCKET_IP_RECV_FLAGS));
|
return static_cast<FwSignedSizeType>(
|
||||||
return size_buf;
|
::recv(socketDescriptor.fd, data, static_cast<size_t>(size), SOCKET_IP_RECV_FLAGS));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Drv
|
} // namespace Drv
|
||||||
|
|||||||
@ -76,7 +76,9 @@ class TcpServerSocket : public IpSocket {
|
|||||||
* \param size: size of data to send
|
* \param size: size of data to send
|
||||||
* \return: size of data sent, or -1 on error.
|
* \return: size of data sent, or -1 on error.
|
||||||
*/
|
*/
|
||||||
I32 sendProtocol(const SocketDescriptor& socketDescriptor, const U8* const data, const U32 size) override;
|
FwSignedSizeType sendProtocol(const SocketDescriptor& socketDescriptor,
|
||||||
|
const U8* const data,
|
||||||
|
const FwSizeType size) override;
|
||||||
/**
|
/**
|
||||||
* \brief Protocol specific implementation of recv. Called directly with error handling from recv.
|
* \brief Protocol specific implementation of recv. Called directly with error handling from recv.
|
||||||
* \param socketDescriptor: descriptor to recv from
|
* \param socketDescriptor: descriptor to recv from
|
||||||
@ -84,7 +86,9 @@ class TcpServerSocket : public IpSocket {
|
|||||||
* \param size: size of data buffer
|
* \param size: size of data buffer
|
||||||
* \return: size of data received, or -1 on error.
|
* \return: size of data received, or -1 on error.
|
||||||
*/
|
*/
|
||||||
I32 recvProtocol(const SocketDescriptor& socketDescriptor, U8* const data, const U32 size) override;
|
FwSignedSizeType recvProtocol(const SocketDescriptor& socketDescriptor,
|
||||||
|
U8* const data,
|
||||||
|
const FwSizeType size) override;
|
||||||
};
|
};
|
||||||
} // namespace Drv
|
} // namespace Drv
|
||||||
|
|
||||||
|
|||||||
@ -151,6 +151,11 @@ SocketIpStatus UdpSocket::openProtocol(SocketDescriptor& socketDescriptor) {
|
|||||||
return status;
|
return status;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (IpSocket::setupSocketOptions(socketFd) != SOCK_SUCCESS) {
|
||||||
|
::close(socketFd);
|
||||||
|
return SOCK_FAILED_TO_SET_SOCKET_OPTIONS;
|
||||||
|
}
|
||||||
|
|
||||||
// Now apply timeouts
|
// Now apply timeouts
|
||||||
status = this->setupTimeouts(socketFd);
|
status = this->setupTimeouts(socketFd);
|
||||||
if (status != SOCK_SUCCESS) {
|
if (status != SOCK_SUCCESS) {
|
||||||
@ -192,17 +197,21 @@ SocketIpStatus UdpSocket::openProtocol(SocketDescriptor& socketDescriptor) {
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
I32 UdpSocket::sendProtocol(const SocketDescriptor& socketDescriptor, const U8* const data, const U32 size) {
|
FwSignedSizeType UdpSocket::sendProtocol(const SocketDescriptor& socketDescriptor,
|
||||||
|
const U8* const data,
|
||||||
|
const FwSizeType size) {
|
||||||
FW_ASSERT(this->m_addr_send.sin_family != 0); // Make sure the address was previously setup
|
FW_ASSERT(this->m_addr_send.sin_family != 0); // Make sure the address was previously setup
|
||||||
FW_ASSERT(socketDescriptor.fd >= 0); // File descriptor should be valid
|
FW_ASSERT(socketDescriptor.fd >= 0); // File descriptor should be valid
|
||||||
FW_ASSERT(data != nullptr); // Data pointer should not be null
|
FW_ASSERT(data != nullptr); // Data pointer should not be null
|
||||||
|
|
||||||
return static_cast<I32>(::sendto(socketDescriptor.fd, data, size, SOCKET_IP_SEND_FLAGS,
|
return static_cast<FwSignedSizeType>(
|
||||||
reinterpret_cast<struct sockaddr*>(&this->m_addr_send),
|
::sendto(socketDescriptor.fd, data, static_cast<size_t>(size), SOCKET_IP_SEND_FLAGS,
|
||||||
sizeof(this->m_addr_send)));
|
reinterpret_cast<struct sockaddr*>(&this->m_addr_send), sizeof(this->m_addr_send)));
|
||||||
}
|
}
|
||||||
|
|
||||||
I32 UdpSocket::recvProtocol(const SocketDescriptor& socketDescriptor, U8* const data, const U32 size) {
|
FwSignedSizeType UdpSocket::recvProtocol(const SocketDescriptor& socketDescriptor,
|
||||||
|
U8* const data,
|
||||||
|
const FwSizeType size) {
|
||||||
FW_ASSERT(this->m_addr_recv.sin_family != 0); // Make sure the address was previously setup
|
FW_ASSERT(this->m_addr_recv.sin_family != 0); // Make sure the address was previously setup
|
||||||
FW_ASSERT(socketDescriptor.fd >= 0); // File descriptor should be valid
|
FW_ASSERT(socketDescriptor.fd >= 0); // File descriptor should be valid
|
||||||
FW_ASSERT(data != nullptr); // Data pointer should not be null
|
FW_ASSERT(data != nullptr); // Data pointer should not be null
|
||||||
@ -212,8 +221,9 @@ I32 UdpSocket::recvProtocol(const SocketDescriptor& socketDescriptor, U8* const
|
|||||||
(void)::memset(&sender_addr, 0, sizeof(sender_addr));
|
(void)::memset(&sender_addr, 0, sizeof(sender_addr));
|
||||||
|
|
||||||
socklen_t sender_addr_len = sizeof(sender_addr);
|
socklen_t sender_addr_len = sizeof(sender_addr);
|
||||||
I32 received = static_cast<I32>(::recvfrom(socketDescriptor.fd, data, size, SOCKET_IP_RECV_FLAGS,
|
FwSignedSizeType received = static_cast<FwSignedSizeType>(
|
||||||
reinterpret_cast<struct sockaddr*>(&sender_addr), &sender_addr_len));
|
::recvfrom(socketDescriptor.fd, data, static_cast<size_t>(size), SOCKET_IP_RECV_FLAGS,
|
||||||
|
reinterpret_cast<struct sockaddr*>(&sender_addr), &sender_addr_len));
|
||||||
// If we have not configured a send port, set it to the source of the last received packet
|
// If we have not configured a send port, set it to the source of the last received packet
|
||||||
if (received >= 0 && this->m_addr_send.sin_port == 0) {
|
if (received >= 0 && this->m_addr_send.sin_port == 0) {
|
||||||
this->m_addr_send = sender_addr;
|
this->m_addr_send = sender_addr;
|
||||||
@ -223,14 +233,14 @@ I32 UdpSocket::recvProtocol(const SocketDescriptor& socketDescriptor, U8* const
|
|||||||
return received;
|
return received;
|
||||||
}
|
}
|
||||||
|
|
||||||
SocketIpStatus UdpSocket::send(const SocketDescriptor& socketDescriptor, const U8* const data, const U32 size) {
|
SocketIpStatus UdpSocket::send(const SocketDescriptor& socketDescriptor, const U8* const data, const FwSizeType size) {
|
||||||
// Note: socketDescriptor.fd can be -1 in some test cases
|
// Note: socketDescriptor.fd can be -1 in some test cases
|
||||||
FW_ASSERT((size == 0) || (data != nullptr));
|
FW_ASSERT((size == 0) || (data != nullptr));
|
||||||
|
|
||||||
// Special case for zero-length datagrams in UDP
|
// Special case for zero-length datagrams in UDP
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
I32 sent = this->sendProtocol(socketDescriptor, data, 0);
|
FwSignedSizeType sent = this->sendProtocol(socketDescriptor, data, 0);
|
||||||
if (sent == -1) {
|
if (sent == -1) {
|
||||||
if (errno == EINTR) {
|
if (errno == EINTR) {
|
||||||
// For zero-length datagrams, we'll just try once more if interrupted
|
// For zero-length datagrams, we'll just try once more if interrupted
|
||||||
|
|||||||
@ -20,6 +20,14 @@
|
|||||||
#ifdef TGT_OS_TYPE_VXWORKS
|
#ifdef TGT_OS_TYPE_VXWORKS
|
||||||
#include <inetLib.h>
|
#include <inetLib.h>
|
||||||
#include <socket.h>
|
#include <socket.h>
|
||||||
|
|
||||||
|
// Undefine these Vxworks-defined macros because
|
||||||
|
// they collide with member variables in F Prime.
|
||||||
|
// These macros are defined somewhere in inetLib.h.
|
||||||
|
#undef m_type
|
||||||
|
#undef m_data
|
||||||
|
#undef m_len
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
@ -109,7 +117,7 @@ class UdpSocket : public IpSocket {
|
|||||||
* \param size: size of data to send
|
* \param size: size of data to send
|
||||||
* \return: status of the send operation
|
* \return: status of the send operation
|
||||||
*/
|
*/
|
||||||
SocketIpStatus send(const SocketDescriptor& socketDescriptor, const U8* const data, const U32 size) override;
|
SocketIpStatus send(const SocketDescriptor& socketDescriptor, const U8* const data, const FwSizeType size) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
@ -131,7 +139,9 @@ class UdpSocket : public IpSocket {
|
|||||||
* \param size: size of data to send
|
* \param size: size of data to send
|
||||||
* \return: size of data sent, or -1 on error.
|
* \return: size of data sent, or -1 on error.
|
||||||
*/
|
*/
|
||||||
I32 sendProtocol(const SocketDescriptor& socketDescriptor, const U8* const data, const U32 size) override;
|
FwSignedSizeType sendProtocol(const SocketDescriptor& socketDescriptor,
|
||||||
|
const U8* const data,
|
||||||
|
const FwSizeType size) override;
|
||||||
/**
|
/**
|
||||||
* \brief Protocol specific implementation of recv. Called directly with error handling from recv.
|
* \brief Protocol specific implementation of recv. Called directly with error handling from recv.
|
||||||
* \param socketDescriptor: descriptor to recv from
|
* \param socketDescriptor: descriptor to recv from
|
||||||
@ -139,7 +149,9 @@ class UdpSocket : public IpSocket {
|
|||||||
* \param size: size of data buffer
|
* \param size: size of data buffer
|
||||||
* \return: size of data received, or -1 on error.
|
* \return: size of data received, or -1 on error.
|
||||||
*/
|
*/
|
||||||
I32 recvProtocol(const SocketDescriptor& socketDescriptor, U8* const data, const U32 size) override;
|
FwSignedSizeType recvProtocol(const SocketDescriptor& socketDescriptor,
|
||||||
|
U8* const data,
|
||||||
|
const FwSizeType size) override;
|
||||||
/**
|
/**
|
||||||
* \brief Handle zero return from recvProtocol for UDP
|
* \brief Handle zero return from recvProtocol for UDP
|
||||||
*
|
*
|
||||||
|
|||||||
@ -154,11 +154,11 @@ socketBoth.configureRecv(127.0.0.1, 60212);
|
|||||||
```
|
```
|
||||||
### Support for Ephemeral Ports
|
### Support for Ephemeral Ports
|
||||||
|
|
||||||
Drv::UdpSocket supports ephemeral ports through passing a 0 as the port argument for either `Drv::UdpSocket::configureSend`
|
Drv::UdpSocket supports ephemeral ports through passing a 0 as the port argument for either `Drv::UdpSocket::configureSend`
|
||||||
or `Drv::UdpSocket::configureRecv`.
|
or `Drv::UdpSocket::configureRecv`.
|
||||||
|
|
||||||
For `Drv::UdpSocket::configureSend` this means that you would like to set up the UdpSocket to be able to respond to the source
|
For `Drv::UdpSocket::configureSend` this means that you would like to set up the UdpSocket to be able to respond to the source
|
||||||
port that is indicated in the UDP datagrams you receive. Note that this configuration will set up the send port to the port
|
port that is indicated in the UDP datagrams you receive. Note that this configuration will set up the send port to the port
|
||||||
specified only in the first message received.
|
specified only in the first message received.
|
||||||
|
|
||||||
For `Drv::UdpSocket::configureRecv` this means that you would like to be assigned an ephemeral port. This would generally be used
|
For `Drv::UdpSocket::configureRecv` this means that you would like to be assigned an ephemeral port. This would generally be used
|
||||||
@ -168,16 +168,17 @@ for setting up a sender that would like to receive responses to messages on an e
|
|||||||
|
|
||||||
The Drv::SocketComponentHelper is intended as a base class used to add in the functionality of an automatically reconnecting
|
The Drv::SocketComponentHelper is intended as a base class used to add in the functionality of an automatically reconnecting
|
||||||
receive thread to another class (typically an F´ component) as well as an interface between the component using an IP socket
|
receive thread to another class (typically an F´ component) as well as an interface between the component using an IP socket
|
||||||
and the IP socket library functions implemented in this folder. In order for this thread to function, the inheritor must
|
and the IP socket library functions implemented in this folder. In order for the receive thread to function, the inheritor must
|
||||||
implement several methods to provide the necessary interaction of this thread. These functions are described in the next
|
implement several methods to provide the necessary interaction of this thread. These functions are described in the next
|
||||||
section.
|
section. The automatic reconnection is handled by a separate dedicated thread upon request from either the receive thread
|
||||||
|
or a send request.
|
||||||
|
|
||||||
In order to start the receiving thread a call to the `Drv::SocketComponentHelper::start` method is performed passing
|
In order to start the receiving thread a call to the `Drv::SocketComponentHelper::start` method is performed passing
|
||||||
in a name, and all arguments to `Os::Task::start` to start the task. An optional parameter, reconnect, will determine if
|
in a name, and all arguments to `Os::Task::start` to start the receive and reconnect tasks. An optional parameter, reconnect,
|
||||||
this read task will reconnect to sockets should a disconnect or error occur. Once started the read task will continue
|
will determine if this read task will request reconnects to sockets should a disconnect or error occur. Once started, the read task will continue
|
||||||
until a `Drv::SocketComponentHelper::stop` has been called or an error occurred when started without reconnect set to
|
until a `Drv::SocketComponentHelper::stop` has been called or an error occurred when started without reconnect set to
|
||||||
`true`. Once the socket stop call has been made, the user should call `Drv::SocketComponentHelper::join` in order to
|
`true`. Once the socket stop call has been made, the user should call `Drv::SocketComponentHelper::join` in order to
|
||||||
wait until the full task has finished. `Drv::SocketComponentHelper::stop` will call `Drv::SocketComponentHelper::close` on the
|
wait until the full tasks have finished. `Drv::SocketComponentHelper::stop` will call `Drv::SocketComponentHelper::close` on the
|
||||||
provided Drv::IpSocket to ensure that any blocking reads exit freeing the thread to completely stop. Normal usage of
|
provided Drv::IpSocket to ensure that any blocking reads exit freeing the thread to completely stop. Normal usage of
|
||||||
a Drv::SocketComponentHelper derived class is shown below.
|
a Drv::SocketComponentHelper derived class is shown below.
|
||||||
|
|
||||||
@ -187,7 +188,7 @@ uplinkComm.start(name); // Default reconnect=true
|
|||||||
...
|
...
|
||||||
|
|
||||||
uplinkComm.stop();
|
uplinkComm.stop();
|
||||||
(void) uplinkComm.join();
|
(void) uplinkComm.join(); // this will join the receive and reconnect tasks
|
||||||
```
|
```
|
||||||
|
|
||||||
`Drv::SocketComponentHelper::open` and `Drv::SocketComponentHelper::close` convenience methods are also provided to open and close the
|
`Drv::SocketComponentHelper::open` and `Drv::SocketComponentHelper::close` convenience methods are also provided to open and close the
|
||||||
|
|||||||
@ -15,7 +15,7 @@
|
|||||||
namespace Drv {
|
namespace Drv {
|
||||||
namespace Test {
|
namespace Test {
|
||||||
|
|
||||||
const U32 MAX_DRV_TEST_MESSAGE_SIZE = 1024;
|
const FwSizeType MAX_DRV_TEST_MESSAGE_SIZE = 1024;
|
||||||
|
|
||||||
void force_recv_timeout(int fd, Drv::IpSocket& socket) {
|
void force_recv_timeout(int fd, Drv::IpSocket& socket) {
|
||||||
// Set timeout socket option
|
// Set timeout socket option
|
||||||
@ -43,10 +43,10 @@ void validate_random_buffer(Fw::Buffer& buffer, U8* data) {
|
|||||||
buffer.setSize(0);
|
buffer.setSize(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
U32 fill_random_buffer(Fw::Buffer& buffer) {
|
FwSizeType fill_random_buffer(Fw::Buffer& buffer) {
|
||||||
buffer.setSize(static_cast<FwSizeType>(STest::Pick::lowerUpper(1, static_cast<U32>(buffer.getSize()))));
|
buffer.setSize(static_cast<FwSizeType>(STest::Pick::lowerUpper(1, static_cast<U32>(buffer.getSize()))));
|
||||||
fill_random_data(buffer.getData(), buffer.getSize());
|
fill_random_data(buffer.getData(), buffer.getSize());
|
||||||
return static_cast<U32>(buffer.getSize());
|
return buffer.getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void drain(Drv::IpSocket& receiver, Drv::SocketDescriptor& receiver_fd) {
|
void drain(Drv::IpSocket& receiver, Drv::SocketDescriptor& receiver_fd) {
|
||||||
@ -54,18 +54,18 @@ void drain(Drv::IpSocket& receiver, Drv::SocketDescriptor& receiver_fd) {
|
|||||||
// Drain the server in preparation for close
|
// Drain the server in preparation for close
|
||||||
while (status == Drv::SOCK_SUCCESS || status == Drv::SOCK_NO_DATA_AVAILABLE) {
|
while (status == Drv::SOCK_SUCCESS || status == Drv::SOCK_NO_DATA_AVAILABLE) {
|
||||||
U8 buffer[1];
|
U8 buffer[1];
|
||||||
U32 size = sizeof buffer;
|
FwSizeType size = sizeof buffer;
|
||||||
status = receiver.recv(receiver_fd, buffer, size);
|
status = receiver.recv(receiver_fd, buffer, size);
|
||||||
}
|
}
|
||||||
ASSERT_EQ(status, Drv::SocketIpStatus::SOCK_DISCONNECTED) << "Socket did not disconnect as expected";
|
ASSERT_EQ(status, Drv::SocketIpStatus::SOCK_DISCONNECTED) << "Socket did not disconnect as expected";
|
||||||
}
|
}
|
||||||
|
|
||||||
void receive_all(Drv::IpSocket& receiver, Drv::SocketDescriptor& receiver_fd, U8* buffer, U32 size) {
|
void receive_all(Drv::IpSocket& receiver, Drv::SocketDescriptor& receiver_fd, U8* buffer, FwSizeType size) {
|
||||||
ASSERT_NE(buffer, nullptr);
|
ASSERT_NE(buffer, nullptr);
|
||||||
U32 received_size = 0;
|
FwSizeType received_size = 0;
|
||||||
Drv::SocketIpStatus status;
|
Drv::SocketIpStatus status;
|
||||||
do {
|
do {
|
||||||
U32 size_in_out = size - received_size;
|
FwSizeType size_in_out = size - received_size;
|
||||||
status = receiver.recv(receiver_fd, buffer + received_size, size_in_out);
|
status = receiver.recv(receiver_fd, buffer + received_size, size_in_out);
|
||||||
ASSERT_TRUE((status == Drv::SOCK_NO_DATA_AVAILABLE || status == Drv::SOCK_SUCCESS));
|
ASSERT_TRUE((status == Drv::SOCK_NO_DATA_AVAILABLE || status == Drv::SOCK_SUCCESS));
|
||||||
received_size += size_in_out;
|
received_size += size_in_out;
|
||||||
@ -77,7 +77,7 @@ void send_recv(Drv::IpSocket& sender,
|
|||||||
Drv::IpSocket& receiver,
|
Drv::IpSocket& receiver,
|
||||||
Drv::SocketDescriptor& sender_fd,
|
Drv::SocketDescriptor& sender_fd,
|
||||||
Drv::SocketDescriptor& receiver_fd) {
|
Drv::SocketDescriptor& receiver_fd) {
|
||||||
U32 size = MAX_DRV_TEST_MESSAGE_SIZE;
|
FwSizeType size = MAX_DRV_TEST_MESSAGE_SIZE;
|
||||||
|
|
||||||
U8 buffer_out[MAX_DRV_TEST_MESSAGE_SIZE] = {0};
|
U8 buffer_out[MAX_DRV_TEST_MESSAGE_SIZE] = {0};
|
||||||
U8 buffer_in[MAX_DRV_TEST_MESSAGE_SIZE] = {0};
|
U8 buffer_in[MAX_DRV_TEST_MESSAGE_SIZE] = {0};
|
||||||
|
|||||||
@ -47,7 +47,7 @@ void validate_random_buffer(Fw::Buffer& buffer, U8* data);
|
|||||||
* Fill random data into the buffer (using a random length).
|
* Fill random data into the buffer (using a random length).
|
||||||
* @param buffer: buffer to fill.
|
* @param buffer: buffer to fill.
|
||||||
*/
|
*/
|
||||||
U32 fill_random_buffer(Fw::Buffer& buffer);
|
FwSizeType fill_random_buffer(Fw::Buffer& buffer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send/receive pair.
|
* Send/receive pair.
|
||||||
@ -75,7 +75,7 @@ void drain(Drv::IpSocket& receiver, Drv::SocketDescriptor& drain_fd);
|
|||||||
* @param buffer: buffer
|
* @param buffer: buffer
|
||||||
* @param size: size to receive
|
* @param size: size to receive
|
||||||
*/
|
*/
|
||||||
void receive_all(Drv::IpSocket& receiver, Drv::SocketDescriptor& receiver_fd, U8* buffer, U32 size);
|
void receive_all(Drv::IpSocket& receiver, Drv::SocketDescriptor& receiver_fd, U8* buffer, FwSizeType size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wait on socket change.
|
* Wait on socket change.
|
||||||
|
|||||||
@ -120,8 +120,8 @@ TEST(UdpZeroLength, TestZeroLengthUdpDatagram) {
|
|||||||
|
|
||||||
// Receive the zero-length datagram using the F' socket wrapper
|
// Receive the zero-length datagram using the F' socket wrapper
|
||||||
U8 recv_buf[1] = {0xFF};
|
U8 recv_buf[1] = {0xFF};
|
||||||
U32 recv_buf_len = 1;
|
FwSizeType recv_buf_len = 1;
|
||||||
I32 recv_status = receiver.recv(recv_fd, recv_buf, recv_buf_len);
|
FwSignedSizeType recv_status = receiver.recv(recv_fd, recv_buf, recv_buf_len);
|
||||||
|
|
||||||
// Expect 0 (success) for a zero-length datagram.
|
// Expect 0 (success) for a zero-length datagram.
|
||||||
ASSERT_EQ(recv_status, 0) << "Expected recv_status 0 for zero-length datagram, but got " << recv_status
|
ASSERT_EQ(recv_status, 0) << "Expected recv_status 0 for zero-length datagram, but got " << recv_status
|
||||||
@ -159,23 +159,23 @@ TEST(Ephemeral, TestEphemeralPorts) {
|
|||||||
|
|
||||||
// Send a test message
|
// Send a test message
|
||||||
const char* msg = "hello from ephemeral sender";
|
const char* msg = "hello from ephemeral sender";
|
||||||
U32 msg_len = static_cast<U32>(strlen(msg) + 1);
|
FwSizeType msg_len = static_cast<FwSizeType>(strlen(msg) + 1);
|
||||||
ASSERT_EQ(sender.send(send_fd, reinterpret_cast<const U8*>(msg), msg_len), Drv::SOCK_SUCCESS);
|
ASSERT_EQ(sender.send(send_fd, reinterpret_cast<const U8*>(msg), msg_len), Drv::SOCK_SUCCESS);
|
||||||
|
|
||||||
// Receive the message and capture sender's port
|
// Receive the message and capture sender's port
|
||||||
char recv_buf[64] = {0};
|
char recv_buf[64] = {0};
|
||||||
U32 recv_buf_len = sizeof(recv_buf);
|
FwSizeType recv_buf_len = sizeof(recv_buf);
|
||||||
ASSERT_EQ(receiver.recv(recv_fd, reinterpret_cast<U8*>(recv_buf), recv_buf_len), Drv::SOCK_SUCCESS);
|
ASSERT_EQ(receiver.recv(recv_fd, reinterpret_cast<U8*>(recv_buf), recv_buf_len), Drv::SOCK_SUCCESS);
|
||||||
ASSERT_STREQ(msg, recv_buf);
|
ASSERT_STREQ(msg, recv_buf);
|
||||||
|
|
||||||
// Receiver sends a response back to sender
|
// Receiver sends a response back to sender
|
||||||
const char* reply = "reply from receiver";
|
const char* reply = "reply from receiver";
|
||||||
U32 reply_len = static_cast<U32>(strlen(reply) + 1);
|
FwSizeType reply_len = static_cast<FwSizeType>(strlen(reply) + 1);
|
||||||
ASSERT_EQ(receiver.send(recv_fd, reinterpret_cast<const U8*>(reply), reply_len), Drv::SOCK_SUCCESS);
|
ASSERT_EQ(receiver.send(recv_fd, reinterpret_cast<const U8*>(reply), reply_len), Drv::SOCK_SUCCESS);
|
||||||
|
|
||||||
// Sender receives the response
|
// Sender receives the response
|
||||||
char reply_buf[64] = {0};
|
char reply_buf[64] = {0};
|
||||||
U32 reply_buf_len = sizeof(reply_buf);
|
FwSizeType reply_buf_len = sizeof(reply_buf);
|
||||||
ASSERT_EQ(sender.recv(send_fd, reinterpret_cast<U8*>(reply_buf), reply_buf_len), Drv::SOCK_SUCCESS);
|
ASSERT_EQ(sender.recv(send_fd, reinterpret_cast<U8*>(reply_buf), reply_buf_len), Drv::SOCK_SUCCESS);
|
||||||
ASSERT_STREQ(reply, reply_buf);
|
ASSERT_STREQ(reply, reply_buf);
|
||||||
|
|
||||||
|
|||||||
@ -20,6 +20,7 @@
|
|||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
#include <cstring>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
|
||||||
namespace Drv {
|
namespace Drv {
|
||||||
|
|||||||
@ -29,6 +29,18 @@ event SPI_WriteError(
|
|||||||
format "Error writing/reading SPI device {}.{}: {}" \
|
format "Error writing/reading SPI device {}.{}: {}" \
|
||||||
throttle 5
|
throttle 5
|
||||||
|
|
||||||
|
@ SPI configuration mismatch
|
||||||
|
event SPI_ConfigMismatch(
|
||||||
|
device: I32 @< The device
|
||||||
|
select: I32 @< The chip select
|
||||||
|
parameter: string @< The parameter being configured
|
||||||
|
write_value: U32 @< The value written
|
||||||
|
read_value: U32 @< The value read
|
||||||
|
) \
|
||||||
|
severity warning low \
|
||||||
|
id 3 \
|
||||||
|
format "SPI device {}.{} configuration mismatch for {}: wrote {}, read {}"
|
||||||
|
|
||||||
@ SPI open notification
|
@ SPI open notification
|
||||||
event SPI_PortOpened(
|
event SPI_PortOpened(
|
||||||
device: I32 @< The device
|
device: I32 @< The device
|
||||||
|
|||||||
@ -19,10 +19,12 @@
|
|||||||
#include <Fw/FPrimeBasicTypes.hpp>
|
#include <Fw/FPrimeBasicTypes.hpp>
|
||||||
#include <Fw/Types/Assert.hpp>
|
#include <Fw/Types/Assert.hpp>
|
||||||
#include <Fw/Types/FileNameString.hpp>
|
#include <Fw/Types/FileNameString.hpp>
|
||||||
|
#include <Fw/Types/String.hpp>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
static_assert(FW_USE_PRINTF_FAMILY_FUNCTIONS_IN_STRING_FORMATTING,
|
static_assert(FW_USE_PRINTF_FAMILY_FUNCTIONS_IN_STRING_FORMATTING,
|
||||||
"Cannot use SPI driver without full string formatting");
|
"Cannot use SPI driver without full string formatting");
|
||||||
@ -33,11 +35,26 @@ namespace Drv {
|
|||||||
// Handler implementations for user-defined typed input ports
|
// Handler implementations for user-defined typed input ports
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
// @ DEPRECATED: Use SpiWriteRead port instead (same operation with a return value)
|
||||||
void LinuxSpiDriverComponentImpl::SpiReadWrite_handler(const FwIndexType portNum,
|
void LinuxSpiDriverComponentImpl::SpiReadWrite_handler(const FwIndexType portNum,
|
||||||
Fw::Buffer& writeBuffer,
|
Fw::Buffer& writeBuffer,
|
||||||
Fw::Buffer& readBuffer) {
|
Fw::Buffer& readBuffer) {
|
||||||
|
FW_ASSERT(portNum >= 0, static_cast<FwAssertArgType>(portNum));
|
||||||
|
FW_ASSERT(writeBuffer.isValid());
|
||||||
|
FW_ASSERT(readBuffer.isValid());
|
||||||
|
(void)SpiWriteRead_handler(portNum, writeBuffer, readBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
SpiStatus LinuxSpiDriverComponentImpl::SpiWriteRead_handler(const FwIndexType portNum,
|
||||||
|
Fw::Buffer& writeBuffer,
|
||||||
|
Fw::Buffer& readBuffer) {
|
||||||
|
FW_ASSERT(portNum >= 0, static_cast<FwAssertArgType>(portNum));
|
||||||
|
FW_ASSERT(writeBuffer.isValid());
|
||||||
|
FW_ASSERT(readBuffer.isValid());
|
||||||
|
FW_ASSERT(writeBuffer.getSize() == readBuffer.getSize());
|
||||||
|
|
||||||
if (this->m_fd == -1) {
|
if (this->m_fd == -1) {
|
||||||
return;
|
return SpiStatus::SPI_OPEN_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
spi_ioc_transfer tr;
|
spi_ioc_transfer tr;
|
||||||
@ -61,9 +78,12 @@ void LinuxSpiDriverComponentImpl::SpiReadWrite_handler(const FwIndexType portNum
|
|||||||
|
|
||||||
if (stat < 1) {
|
if (stat < 1) {
|
||||||
this->log_WARNING_HI_SPI_WriteError(this->m_device, this->m_select, stat);
|
this->log_WARNING_HI_SPI_WriteError(this->m_device, this->m_select, stat);
|
||||||
|
return SpiStatus::SPI_OTHER_ERR;
|
||||||
}
|
}
|
||||||
this->m_bytes += readBuffer.getSize();
|
this->m_bytes += readBuffer.getSize();
|
||||||
this->tlmWrite_SPI_Bytes(this->m_bytes);
|
this->tlmWrite_SPI_Bytes(this->m_bytes);
|
||||||
|
|
||||||
|
return SpiStatus::SPI_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LinuxSpiDriverComponentImpl::open(FwIndexType device, FwIndexType select, SpiFrequency clock, SpiMode spiMode) {
|
bool LinuxSpiDriverComponentImpl::open(FwIndexType device, FwIndexType select, SpiFrequency clock, SpiMode spiMode) {
|
||||||
@ -120,12 +140,17 @@ bool LinuxSpiDriverComponentImpl::open(FwIndexType device, FwIndexType select, S
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ioctl(fd, SPI_IOC_RD_MODE, &mode);
|
U8 read_mode = 0;
|
||||||
|
ret = ioctl(fd, SPI_IOC_RD_MODE, &read_mode);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
this->log_WARNING_HI_SPI_ConfigError(device, select, ret);
|
this->log_WARNING_HI_SPI_ConfigError(device, select, ret);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mode != read_mode) {
|
||||||
|
this->log_WARNING_LO_SPI_ConfigMismatch(device, select, Fw::String("MODE"), mode, read_mode);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 8 bits per word
|
* 8 bits per word
|
||||||
*/
|
*/
|
||||||
@ -136,12 +161,17 @@ bool LinuxSpiDriverComponentImpl::open(FwIndexType device, FwIndexType select, S
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits);
|
U8 read_bits = 0;
|
||||||
|
ret = ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &read_bits);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
this->log_WARNING_HI_SPI_ConfigError(device, select, ret);
|
this->log_WARNING_HI_SPI_ConfigError(device, select, ret);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bits != read_bits) {
|
||||||
|
this->log_WARNING_LO_SPI_ConfigMismatch(device, select, Fw::String("BITS_PER_WORD"), bits, read_bits);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Max speed in Hz
|
* Max speed in Hz
|
||||||
*/
|
*/
|
||||||
@ -151,12 +181,17 @@ bool LinuxSpiDriverComponentImpl::open(FwIndexType device, FwIndexType select, S
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &clock);
|
SpiFrequency read_clock;
|
||||||
|
ret = ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &read_clock);
|
||||||
if (ret == -1) {
|
if (ret == -1) {
|
||||||
this->log_WARNING_HI_SPI_ConfigError(device, select, ret);
|
this->log_WARNING_HI_SPI_ConfigError(device, select, ret);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (clock != read_clock) {
|
||||||
|
this->log_WARNING_LO_SPI_ConfigMismatch(device, select, Fw::String("MAX_SPEED_HZ"), clock, read_clock);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -76,6 +76,13 @@ class LinuxSpiDriverComponentImpl final : public LinuxSpiDriverComponentBase {
|
|||||||
// Handler implementations for user-defined typed input ports
|
// Handler implementations for user-defined typed input ports
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
//! Handler implementation for SpiWriteRead
|
||||||
|
//!
|
||||||
|
SpiStatus SpiWriteRead_handler(const FwIndexType portNum, /*!< The port number*/
|
||||||
|
Fw::Buffer& WriteBuffer,
|
||||||
|
Fw::Buffer& readBuffer);
|
||||||
|
|
||||||
|
// @ DEPRECATED: Use SpiWriteRead port instead (same operation with a return value)
|
||||||
//! Handler implementation for SpiReadWrite
|
//! Handler implementation for SpiReadWrite
|
||||||
//!
|
//!
|
||||||
void SpiReadWrite_handler(const FwIndexType portNum, /*!< The port number*/
|
void SpiReadWrite_handler(const FwIndexType portNum, /*!< The port number*/
|
||||||
|
|||||||
@ -23,6 +23,13 @@ bool LinuxSpiDriverComponentImpl::open(FwIndexType device, FwIndexType select, S
|
|||||||
// Handler implementations for user-defined typed input ports
|
// Handler implementations for user-defined typed input ports
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
SpiStatus LinuxSpiDriverComponentImpl::SpiWriteRead_handler(const FwIndexType portNum,
|
||||||
|
Fw::Buffer& WriteBuffer,
|
||||||
|
Fw::Buffer& readBuffer) {
|
||||||
|
return SpiStatus::SPI_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
// @ DEPRECATED: Use SpiWriteRead port instead (same operation with a return value)
|
||||||
void LinuxSpiDriverComponentImpl::SpiReadWrite_handler(const FwIndexType portNum,
|
void LinuxSpiDriverComponentImpl::SpiReadWrite_handler(const FwIndexType portNum,
|
||||||
Fw::Buffer& WriteBuffer,
|
Fw::Buffer& WriteBuffer,
|
||||||
Fw::Buffer& readBuffer) {}
|
Fw::Buffer& readBuffer) {}
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <cerrno>
|
#include <cerrno>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
namespace Drv {
|
namespace Drv {
|
||||||
|
|
||||||
|
|||||||
177
Drv/LinuxUartDriver/docs/sdd.md
Normal file
177
Drv/LinuxUartDriver/docs/sdd.md
Normal file
@ -0,0 +1,177 @@
|
|||||||
|
# Drv::LinuxUartDriver
|
||||||
|
|
||||||
|
## 1. Introduction
|
||||||
|
|
||||||
|
The LinuxUartDriver component provides a Linux-specific implementation of a UART (Universal Asynchronous Receiver-Transmitter) serial communication driver. It implements the byte stream driver model interface (see [`Drv.ByteStreamDriver`](../../Interfaces/ByteStreamDriver.fpp)) to enable serial communication with external devices through UART ports on Linux systems.
|
||||||
|
|
||||||
|
The component wraps Linux termios API functionality to provide configurable serial communication with support for various baud rates, flow control options, and parity settings. It implements bidirectional communication using a dedicated receive thread and synchronous send operations.
|
||||||
|
|
||||||
|
For more information on the ByteStreamDriverModel see: [`Drv::ByteStreamDriverModel`](../../ByteStreamDriverModel/docs/sdd.md).
|
||||||
|
|
||||||
|
## 2. Requirements
|
||||||
|
|
||||||
|
| Name | Description | Validation |
|
||||||
|
|---|---|---|
|
||||||
|
| LINUX-UART-COMP-001 | The LinuxUartDriver component shall implement the Drv.ByteStreamDriver interface | inspection |
|
||||||
|
| LINUX-UART-COMP-002 | The LinuxUartDriver component shall provide configurable baud rates from 9600 to 4MHz | inspection |
|
||||||
|
| LINUX-UART-COMP-003 | The LinuxUartDriver component shall provide configurable flow control (none/hardware) | inspection |
|
||||||
|
| LINUX-UART-COMP-004 | The LinuxUartDriver component shall provide configurable parity (none/odd/even) | inspection |
|
||||||
|
| LINUX-UART-COMP-005 | The LinuxUartDriver component shall provide a dedicated read thread for receiving data | inspection |
|
||||||
|
| LINUX-UART-COMP-006 | The LinuxUartDriver component shall report telemetry for bytes sent and received | inspection |
|
||||||
|
| LINUX-UART-COMP-007 | The LinuxUartDriver component shall handle UART errors and report them via events | inspection |
|
||||||
|
| LINUX-UART-COMP-008 | The LinuxUartDriver component shall support buffer allocation for receive operations | inspection |
|
||||||
|
|
||||||
|
## 3. Design
|
||||||
|
|
||||||
|
The LinuxUartDriver component implements the design specified by the [`Drv.ByteStreamDriver`](../../Interfaces/ByteStreamDriver.fpp) interface.
|
||||||
|
|
||||||
|
### 3.1 Architecture
|
||||||
|
|
||||||
|
The component consists of the following key elements:
|
||||||
|
|
||||||
|
- **UART Configuration**: Handles device opening, baud rate, flow control, and parity settings using Linux termios API
|
||||||
|
- **Send Handler**: Synchronous transmission of data via the `send` port (guarded input port)
|
||||||
|
- **Receive Thread**: Asynchronous reception of data via a dedicated thread that calls the `recv` output port
|
||||||
|
- **Buffer Management**: Integration with F´ buffer allocation system for memory management
|
||||||
|
- **Telemetry Reporting**: Tracks and reports bytes sent and received statistics
|
||||||
|
- **Error Handling**: Comprehensive error detection and event reporting
|
||||||
|
|
||||||
|
### 3.2 Send Operation
|
||||||
|
|
||||||
|
When data is sent via the `send` input port:
|
||||||
|
1. The component validates the file descriptor and buffer
|
||||||
|
2. Data is written to the UART device using the Linux `write()` system call
|
||||||
|
3. Bytes sent counter is updated for telemetry
|
||||||
|
4. Status is returned indicating success or failure
|
||||||
|
|
||||||
|
### 3.3 Receive Operation
|
||||||
|
|
||||||
|
The receive operation runs in a separate thread:
|
||||||
|
1. A buffer is allocated from the buffer manager
|
||||||
|
2. The thread blocks on `read()` waiting for incoming data
|
||||||
|
3. Received data is packaged in the buffer and sent via `recv` output port
|
||||||
|
4. Bytes received counter is updated for telemetry
|
||||||
|
5. Errors are logged and reported via events
|
||||||
|
|
||||||
|
### 3.4 Threading Model
|
||||||
|
|
||||||
|
The component uses a single dedicated thread for receive operations (`serialReadTaskEntry`). This thread:
|
||||||
|
- Runs continuously until `quitReadThread()` is called
|
||||||
|
- Allocates buffers for each receive operation
|
||||||
|
- Handles timeouts and errors gracefully
|
||||||
|
- Can be started with configurable priority and stack size
|
||||||
|
|
||||||
|
## 4. Usage
|
||||||
|
|
||||||
|
The LinuxUartDriver must be configured with device parameters before use. The typical usage pattern is:
|
||||||
|
|
||||||
|
1. **Open Device**: Configure the UART device with desired parameters
|
||||||
|
2. **Start Receive Thread**: Begin the receive thread for incoming data
|
||||||
|
3. **Send/Receive Data**: Use the ByteStreamDriverModel ports for communication
|
||||||
|
4. **Shutdown**: Stop the receive thread and close the device
|
||||||
|
|
||||||
|
### 4.1 Configuration Example
|
||||||
|
|
||||||
|
The LinuxUartDriver should be instantiated in the FPP topology and configured using separate functions following F´ patterns:
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
// Configuration function - called during topology setup
|
||||||
|
void configureTopology() {
|
||||||
|
// Open UART device with configuration
|
||||||
|
bool success = uart.open("/dev/ttyUSB0", // Device path
|
||||||
|
Drv::LinuxUartDriver::BAUD_115K, // 115200 baud rate
|
||||||
|
Drv::LinuxUartDriver::NO_FLOW, // No flow control
|
||||||
|
Drv::LinuxUartDriver::PARITY_NONE, // No parity
|
||||||
|
1024); // Buffer size
|
||||||
|
if (!success) {
|
||||||
|
// Handle configuration error
|
||||||
|
}
|
||||||
|
...
|
||||||
|
}
|
||||||
|
|
||||||
|
// Startup function - called when starting tasks
|
||||||
|
void setupTopology() {
|
||||||
|
// Start receive thread
|
||||||
|
uart.start(UART_PRIORITY, // Thread priority
|
||||||
|
32 * 1024, // Thread stack size
|
||||||
|
Os::Task::TASK_DEFAULT); // Thread CPU affinity mask
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shutdown function - called during teardown
|
||||||
|
void teardownTopology() {
|
||||||
|
uart.quitReadThread();
|
||||||
|
uart.join();
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4.2 Integration with Rate Groups
|
||||||
|
|
||||||
|
The component includes a `run` input port for telemetry reporting that should be connected to a rate group in the FPP topology:
|
||||||
|
|
||||||
|
```fpp
|
||||||
|
# In topology.fpp connections section
|
||||||
|
connections RateGroups {
|
||||||
|
# Connect UART driver to rate group for telemetry
|
||||||
|
rateGroup1Comp.RateGroupMemberOut[N] -> uart.run
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 5. Configuration
|
||||||
|
|
||||||
|
### 5.1 Device Parameters
|
||||||
|
|
||||||
|
| Parameter | Type | Description | Valid Values |
|
||||||
|
|-----------|------|-------------|--------------|
|
||||||
|
| device | const char* | Path to UART device | Linux device path (e.g., "/dev/ttyUSB0") |
|
||||||
|
| baud | Drv::LinuxUartDriver::UartBaudRate | Communication baud rate | See baud rate enumeration |
|
||||||
|
| fc | Drv::LinuxUartDriver::UartFlowControl | Flow control setting | NO_FLOW, HW_FLOW |
|
||||||
|
| parity | Drv::LinuxUartDriver::UartParity | Parity setting | PARITY_NONE, PARITY_ODD, PARITY_EVEN |
|
||||||
|
| allocationSize | FwSizeType | Receive buffer size | Positive integer (bytes) |
|
||||||
|
|
||||||
|
### 5.2 Baud Rate Options
|
||||||
|
|
||||||
|
The component supports the following baud rates:
|
||||||
|
|
||||||
|
| Enumeration | Numeric Value | Availability |
|
||||||
|
|-------------|---------------|--------------|
|
||||||
|
| BAUD_9600 | 9600 | All platforms |
|
||||||
|
| BAUD_19200 | 19200 | All platforms |
|
||||||
|
| BAUD_38400 | 38400 | All platforms |
|
||||||
|
| BAUD_57600 | 57600 | All platforms |
|
||||||
|
| BAUD_115K | 115200 | All platforms |
|
||||||
|
| BAUD_230K | 230400 | All platforms |
|
||||||
|
| BAUD_460K | 460800 | Linux only |
|
||||||
|
| BAUD_921K | 921600 | Linux only |
|
||||||
|
| BAUD_1000K | 1000000 | Linux only |
|
||||||
|
| BAUD_1152K | 1152000 | Linux only |
|
||||||
|
| BAUD_1500K | 1500000 | Linux only |
|
||||||
|
| BAUD_2000K | 2000000 | Linux only |
|
||||||
|
| BAUD_2500K | 2500000 | Linux only (if supported) |
|
||||||
|
| BAUD_3000K | 3000000 | Linux only (if supported) |
|
||||||
|
| BAUD_3500K | 3500000 | Linux only (if supported) |
|
||||||
|
| BAUD_4000K | 4000000 | Linux only (if supported) |
|
||||||
|
|
||||||
|
### 5.3 Thread Configuration
|
||||||
|
|
||||||
|
The receive thread can be configured with:
|
||||||
|
|
||||||
|
| Parameter | Type | Default | Description |
|
||||||
|
|-----------|------|---------|-------------|
|
||||||
|
| priority | FwTaskPriorityType | TASK_PRIORITY_DEFAULT | Thread priority |
|
||||||
|
| stackSize | Os::Task::ParamType | TASK_DEFAULT | Thread stack size |
|
||||||
|
| cpuAffinity | Os::Task::ParamType | TASK_DEFAULT | CPU affinity mask |
|
||||||
|
|
||||||
|
### 5.4 Events and Telemetry
|
||||||
|
|
||||||
|
The component generates the following events:
|
||||||
|
- **OpenError**: UART device open failures
|
||||||
|
- **ConfigError**: UART configuration failures
|
||||||
|
- **WriteError**: Data transmission errors
|
||||||
|
- **ReadError**: Data reception errors
|
||||||
|
- **PortOpened**: Successful device configuration
|
||||||
|
- **NoBuffers**: Buffer allocation failures
|
||||||
|
- **BufferTooSmall**: Insufficient buffer size
|
||||||
|
|
||||||
|
The component reports the following telemetry:
|
||||||
|
- **BytesSent**: Total bytes transmitted
|
||||||
|
- **BytesRecv**: Total bytes received
|
||||||
@ -13,7 +13,7 @@ DataBuffer::DataBuffer() {}
|
|||||||
DataBuffer::~DataBuffer() {}
|
DataBuffer::~DataBuffer() {}
|
||||||
|
|
||||||
DataBuffer::DataBuffer(const DataBuffer& other) : Fw::SerializeBufferBase() {
|
DataBuffer::DataBuffer(const DataBuffer& other) : Fw::SerializeBufferBase() {
|
||||||
Fw::SerializeStatus stat = Fw::SerializeBufferBase::setBuff(other.m_data, other.getBuffLength());
|
Fw::SerializeStatus stat = Fw::SerializeBufferBase::setBuff(other.m_data, other.getSize());
|
||||||
FW_ASSERT(Fw::FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
|
FW_ASSERT(Fw::FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,15 +22,19 @@ DataBuffer& DataBuffer::operator=(const DataBuffer& other) {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
Fw::SerializeStatus stat = Fw::SerializeBufferBase::setBuff(other.m_data, other.getBuffLength());
|
Fw::SerializeStatus stat = Fw::SerializeBufferBase::setBuff(other.m_data, other.getSize());
|
||||||
FW_ASSERT(Fw::FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
|
FW_ASSERT(Fw::FW_SERIALIZE_OK == stat, static_cast<FwAssertArgType>(stat));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
FwSizeType DataBuffer::getBuffCapacity() const {
|
FwSizeType DataBuffer::getCapacity() const {
|
||||||
return sizeof(this->m_data);
|
return sizeof(this->m_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FwSizeType DataBuffer::getBuffCapacity() const {
|
||||||
|
return this->getCapacity();
|
||||||
|
}
|
||||||
|
|
||||||
const U8* DataBuffer::getBuffAddr() const {
|
const U8* DataBuffer::getBuffAddr() const {
|
||||||
return this->m_data;
|
return this->m_data;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,7 +20,9 @@ class DataBuffer : public Fw::SerializeBufferBase {
|
|||||||
virtual ~DataBuffer();
|
virtual ~DataBuffer();
|
||||||
DataBuffer& operator=(const DataBuffer& other);
|
DataBuffer& operator=(const DataBuffer& other);
|
||||||
|
|
||||||
FwSizeType getBuffCapacity() const; // !< returns capacity, not current size, of buffer
|
DEPRECATED(FwSizeType getBuffCapacity() const, "Use getCapacity() instead");
|
||||||
|
FwSizeType getCapacity() const;
|
||||||
|
|
||||||
U8* getBuffAddr();
|
U8* getBuffAddr();
|
||||||
const U8* getBuffAddr() const;
|
const U8* getBuffAddr() const;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
module Drv {
|
module Drv {
|
||||||
enum GpioStatus {
|
enum GpioStatus : U8 {
|
||||||
OP_OK @< Operation succeeded
|
OP_OK @< Operation succeeded
|
||||||
NOT_OPENED @< Pin was never opened
|
NOT_OPENED @< Pin was never opened
|
||||||
INVALID_MODE @< Operation not permitted with current configuration
|
INVALID_MODE @< Operation not permitted with current configuration
|
||||||
|
|||||||
@ -11,7 +11,7 @@ module Drv {
|
|||||||
|
|
||||||
module Drv {
|
module Drv {
|
||||||
|
|
||||||
enum I2cStatus {
|
enum I2cStatus : U8 {
|
||||||
I2C_OK = 0 @< Transaction okay
|
I2C_OK = 0 @< Transaction okay
|
||||||
I2C_ADDRESS_ERR = 1 @< I2C address invalid
|
I2C_ADDRESS_ERR = 1 @< I2C address invalid
|
||||||
I2C_WRITE_ERR = 2 @< I2C write failed
|
I2C_WRITE_ERR = 2 @< I2C write failed
|
||||||
|
|||||||
@ -1,8 +1,28 @@
|
|||||||
module Drv {
|
module Drv {
|
||||||
|
|
||||||
|
port SpiWriteRead(
|
||||||
|
ref writeBuffer: Fw.Buffer
|
||||||
|
ref readBuffer: Fw.Buffer
|
||||||
|
) -> Drv.SpiStatus
|
||||||
|
|
||||||
|
@ DEPRECATED: Use SpiWriteRead port instead (same operation with a return value)
|
||||||
port SpiReadWrite(
|
port SpiReadWrite(
|
||||||
ref writeBuffer: Fw.Buffer
|
ref writeBuffer: Fw.Buffer
|
||||||
ref readBuffer: Fw.Buffer
|
ref readBuffer: Fw.Buffer
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
module Drv {
|
||||||
|
|
||||||
|
enum SpiStatus : U8 {
|
||||||
|
SPI_OK = 0 @< Transaction okay
|
||||||
|
SPI_OPEN_ERR = 1 @< SPI driver failed to open device
|
||||||
|
SPI_CONFIG_ERR = 2 @< SPI read failed
|
||||||
|
SPI_MISMATCH_ERR = 3 @< SPI read failed
|
||||||
|
SPI_WRITE_ERR = 4 @< SPI write failed
|
||||||
|
SPI_OTHER_ERR = 5 @< Other errors that do not fit
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -28,8 +28,6 @@ SocketIpStatus TcpClientComponentImpl::configure(const char* hostname,
|
|||||||
const U32 send_timeout_seconds,
|
const U32 send_timeout_seconds,
|
||||||
const U32 send_timeout_microseconds,
|
const U32 send_timeout_microseconds,
|
||||||
FwSizeType buffer_size) {
|
FwSizeType buffer_size) {
|
||||||
// Check that ensures the configured buffer size fits within the limits fixed-width type, U32
|
|
||||||
FW_ASSERT(buffer_size <= std::numeric_limits<U32>::max(), static_cast<FwAssertArgType>(buffer_size));
|
|
||||||
m_allocation_size = buffer_size; // Store the buffer size
|
m_allocation_size = buffer_size; // Store the buffer size
|
||||||
return m_socket.configure(hostname, port, send_timeout_seconds, send_timeout_microseconds);
|
return m_socket.configure(hostname, port, send_timeout_seconds, send_timeout_microseconds);
|
||||||
}
|
}
|
||||||
@ -45,7 +43,7 @@ IpSocket& TcpClientComponentImpl::getSocketHandler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Fw::Buffer TcpClientComponentImpl::getBuffer() {
|
Fw::Buffer TcpClientComponentImpl::getBuffer() {
|
||||||
return allocate_out(0, static_cast<U32>(m_allocation_size));
|
return allocate_out(0, m_allocation_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TcpClientComponentImpl::sendBuffer(Fw::Buffer buffer, SocketIpStatus status) {
|
void TcpClientComponentImpl::sendBuffer(Fw::Buffer buffer, SocketIpStatus status) {
|
||||||
@ -71,8 +69,7 @@ void TcpClientComponentImpl::connected() {
|
|||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
Drv::ByteStreamStatus TcpClientComponentImpl::send_handler(const FwIndexType portNum, Fw::Buffer& fwBuffer) {
|
Drv::ByteStreamStatus TcpClientComponentImpl::send_handler(const FwIndexType portNum, Fw::Buffer& fwBuffer) {
|
||||||
FW_ASSERT_NO_OVERFLOW(fwBuffer.getSize(), U32);
|
Drv::SocketIpStatus status = send(fwBuffer.getData(), fwBuffer.getSize());
|
||||||
Drv::SocketIpStatus status = send(fwBuffer.getData(), static_cast<U32>(fwBuffer.getSize()));
|
|
||||||
Drv::ByteStreamStatus returnStatus;
|
Drv::ByteStreamStatus returnStatus;
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case SOCK_INTERRUPTED_TRY_AGAIN:
|
case SOCK_INTERRUPTED_TRY_AGAIN:
|
||||||
|
|||||||
@ -57,7 +57,7 @@ void TcpClientTester ::test_with_loop(U32 iterations, bool recv_thread) {
|
|||||||
|
|
||||||
// Loop through a bunch of client disconnects
|
// Loop through a bunch of client disconnects
|
||||||
for (U32 i = 0; i < iterations; i++) {
|
for (U32 i = 0; i < iterations; i++) {
|
||||||
U32 size = sizeof(m_data_storage);
|
FwSizeType size = sizeof(m_data_storage);
|
||||||
|
|
||||||
// Not testing with reconnect thread, we will need to open ourselves
|
// Not testing with reconnect thread, we will need to open ourselves
|
||||||
if (not recv_thread) {
|
if (not recv_thread) {
|
||||||
|
|||||||
@ -23,7 +23,7 @@ namespace Drv {
|
|||||||
|
|
||||||
class TcpClientTester : public TcpClientGTestBase {
|
class TcpClientTester : public TcpClientGTestBase {
|
||||||
// Maximum size of histories storing events, telemetry, and port outputs
|
// Maximum size of histories storing events, telemetry, and port outputs
|
||||||
static const U32 MAX_HISTORY_SIZE = 1000;
|
static const FwSizeType MAX_HISTORY_SIZE = 1000;
|
||||||
// Instance ID supplied to the component instance under test
|
// Instance ID supplied to the component instance under test
|
||||||
static const FwEnumStoreType TEST_INSTANCE_ID = 0;
|
static const FwEnumStoreType TEST_INSTANCE_ID = 0;
|
||||||
// Queue depth supplied to component instance under test
|
// Queue depth supplied to component instance under test
|
||||||
|
|||||||
@ -29,11 +29,7 @@ SocketIpStatus TcpServerComponentImpl::configure(const char* hostname,
|
|||||||
const U32 send_timeout_seconds,
|
const U32 send_timeout_seconds,
|
||||||
const U32 send_timeout_microseconds,
|
const U32 send_timeout_microseconds,
|
||||||
FwSizeType buffer_size) {
|
FwSizeType buffer_size) {
|
||||||
// Check that ensures the configured buffer size fits within the limits fixed-width type, U32
|
|
||||||
|
|
||||||
FW_ASSERT(buffer_size <= std::numeric_limits<U32>::max(), static_cast<FwAssertArgType>(buffer_size));
|
|
||||||
m_allocation_size = buffer_size; // Store the buffer size
|
m_allocation_size = buffer_size; // Store the buffer size
|
||||||
//
|
|
||||||
(void)m_socket.configure(hostname, port, send_timeout_seconds, send_timeout_microseconds);
|
(void)m_socket.configure(hostname, port, send_timeout_seconds, send_timeout_microseconds);
|
||||||
return startup();
|
return startup();
|
||||||
}
|
}
|
||||||
@ -53,7 +49,7 @@ IpSocket& TcpServerComponentImpl::getSocketHandler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Fw::Buffer TcpServerComponentImpl::getBuffer() {
|
Fw::Buffer TcpServerComponentImpl::getBuffer() {
|
||||||
return allocate_out(0, static_cast<U32>(m_allocation_size));
|
return allocate_out(0, m_allocation_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TcpServerComponentImpl::sendBuffer(Fw::Buffer buffer, SocketIpStatus status) {
|
void TcpServerComponentImpl::sendBuffer(Fw::Buffer buffer, SocketIpStatus status) {
|
||||||
@ -120,8 +116,7 @@ void TcpServerComponentImpl::readLoop() {
|
|||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
Drv::ByteStreamStatus TcpServerComponentImpl::send_handler(const FwIndexType portNum, Fw::Buffer& fwBuffer) {
|
Drv::ByteStreamStatus TcpServerComponentImpl::send_handler(const FwIndexType portNum, Fw::Buffer& fwBuffer) {
|
||||||
FW_ASSERT_NO_OVERFLOW(fwBuffer.getSize(), U32);
|
Drv::SocketIpStatus status = this->send(fwBuffer.getData(), fwBuffer.getSize());
|
||||||
Drv::SocketIpStatus status = this->send(fwBuffer.getData(), static_cast<U32>(fwBuffer.getSize()));
|
|
||||||
Drv::ByteStreamStatus returnStatus;
|
Drv::ByteStreamStatus returnStatus;
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case SOCK_INTERRUPTED_TRY_AGAIN:
|
case SOCK_INTERRUPTED_TRY_AGAIN:
|
||||||
|
|||||||
@ -58,7 +58,7 @@ void TcpServerTester ::test_with_loop(U32 iterations, bool recv_thread) {
|
|||||||
client.configure("127.0.0.1", this->component.getListenPort(), 0, 100);
|
client.configure("127.0.0.1", this->component.getListenPort(), 0, 100);
|
||||||
status2 = client.open(client_fd);
|
status2 = client.open(client_fd);
|
||||||
EXPECT_EQ(status2, Drv::SocketIpStatus::SOCK_SUCCESS) << "Failed to connect client";
|
EXPECT_EQ(status2, Drv::SocketIpStatus::SOCK_SUCCESS) << "Failed to connect client";
|
||||||
U32 size = sizeof(m_data_storage);
|
FwSizeType size = sizeof(m_data_storage);
|
||||||
|
|
||||||
// Not testing with reconnect thread, we will need to open ourselves
|
// Not testing with reconnect thread, we will need to open ourselves
|
||||||
if (not recv_thread) {
|
if (not recv_thread) {
|
||||||
@ -151,7 +151,10 @@ TcpServerTester ::TcpServerTester()
|
|||||||
::memset(m_data_storage, 0, sizeof(m_data_storage));
|
::memset(m_data_storage, 0, sizeof(m_data_storage));
|
||||||
}
|
}
|
||||||
|
|
||||||
TcpServerTester ::~TcpServerTester() {}
|
TcpServerTester ::~TcpServerTester() {
|
||||||
|
this->component.stop();
|
||||||
|
this->component.join();
|
||||||
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Tests
|
// Tests
|
||||||
|
|||||||
@ -23,7 +23,7 @@ namespace Drv {
|
|||||||
|
|
||||||
class TcpServerTester : public TcpServerGTestBase {
|
class TcpServerTester : public TcpServerGTestBase {
|
||||||
// Maximum size of histories storing events, telemetry, and port outputs
|
// Maximum size of histories storing events, telemetry, and port outputs
|
||||||
static const U32 MAX_HISTORY_SIZE = 1000;
|
static const FwSizeType MAX_HISTORY_SIZE = 1000;
|
||||||
// Instance ID supplied to the component instance under test
|
// Instance ID supplied to the component instance under test
|
||||||
static const FwEnumStoreType TEST_INSTANCE_ID = 0;
|
static const FwEnumStoreType TEST_INSTANCE_ID = 0;
|
||||||
// Queue depth supplied to component instance under test
|
// Queue depth supplied to component instance under test
|
||||||
|
|||||||
@ -32,9 +32,7 @@ SocketIpStatus UdpComponentImpl::configureSend(const char* hostname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
SocketIpStatus UdpComponentImpl::configureRecv(const char* hostname, const U16 port, FwSizeType buffer_size) {
|
SocketIpStatus UdpComponentImpl::configureRecv(const char* hostname, const U16 port, FwSizeType buffer_size) {
|
||||||
FW_ASSERT(buffer_size <= std::numeric_limits<U32>::max(), static_cast<FwAssertArgType>(buffer_size));
|
|
||||||
m_allocation_size = buffer_size; // Store the buffer size
|
m_allocation_size = buffer_size; // Store the buffer size
|
||||||
|
|
||||||
return m_socket.configureRecv(hostname, port);
|
return m_socket.configureRecv(hostname, port);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +51,7 @@ IpSocket& UdpComponentImpl::getSocketHandler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Fw::Buffer UdpComponentImpl::getBuffer() {
|
Fw::Buffer UdpComponentImpl::getBuffer() {
|
||||||
return allocate_out(0, static_cast<U32>(m_allocation_size));
|
return allocate_out(0, m_allocation_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UdpComponentImpl::sendBuffer(Fw::Buffer buffer, SocketIpStatus status) {
|
void UdpComponentImpl::sendBuffer(Fw::Buffer buffer, SocketIpStatus status) {
|
||||||
@ -79,8 +77,7 @@ void UdpComponentImpl::connected() {
|
|||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
Drv::ByteStreamStatus UdpComponentImpl::send_handler(const FwIndexType portNum, Fw::Buffer& fwBuffer) {
|
Drv::ByteStreamStatus UdpComponentImpl::send_handler(const FwIndexType portNum, Fw::Buffer& fwBuffer) {
|
||||||
FW_ASSERT_NO_OVERFLOW(fwBuffer.getSize(), U32);
|
Drv::SocketIpStatus status = send(fwBuffer.getData(), fwBuffer.getSize());
|
||||||
Drv::SocketIpStatus status = send(fwBuffer.getData(), static_cast<U32>(fwBuffer.getSize()));
|
|
||||||
Drv::ByteStreamStatus returnStatus;
|
Drv::ByteStreamStatus returnStatus;
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case SOCK_INTERRUPTED_TRY_AGAIN:
|
case SOCK_INTERRUPTED_TRY_AGAIN:
|
||||||
|
|||||||
@ -9,6 +9,11 @@ TEST(Nominal, UdpBasicMessaging) {
|
|||||||
tester.test_basic_messaging();
|
tester.test_basic_messaging();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Nominal, UdpBasicUnidirectionalMessaging) {
|
||||||
|
Drv::UdpTester tester;
|
||||||
|
tester.test_basic_unidirectional_messaging();
|
||||||
|
}
|
||||||
|
|
||||||
TEST(Nominal, UdpBasicReceiveThread) {
|
TEST(Nominal, UdpBasicReceiveThread) {
|
||||||
Drv::UdpTester tester;
|
Drv::UdpTester tester;
|
||||||
tester.test_receive_thread();
|
tester.test_receive_thread();
|
||||||
@ -19,6 +24,11 @@ TEST(Reconnect, UdpMultiMessaging) {
|
|||||||
tester.test_multiple_messaging();
|
tester.test_multiple_messaging();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(Reconnect, UdpMultiUnidirectionalMessaging) {
|
||||||
|
Drv::UdpTester tester;
|
||||||
|
tester.test_multiple_unidirectional_messaging();
|
||||||
|
}
|
||||||
|
|
||||||
TEST(Reconnect, UdpReceiveThreadReconnect) {
|
TEST(Reconnect, UdpReceiveThreadReconnect) {
|
||||||
Drv::UdpTester tester;
|
Drv::UdpTester tester;
|
||||||
tester.test_advanced_reconnect();
|
tester.test_advanced_reconnect();
|
||||||
|
|||||||
@ -24,7 +24,7 @@ namespace Drv {
|
|||||||
// Construction and destruction
|
// Construction and destruction
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
void UdpTester::test_with_loop(U32 iterations, bool recv_thread) {
|
void UdpTester::test_with_loop(U32 iterations, bool recv_thread, bool send_only) {
|
||||||
U8 buffer[sizeof(m_data_storage)] = {};
|
U8 buffer[sizeof(m_data_storage)] = {};
|
||||||
Drv::SocketIpStatus status1 = Drv::SOCK_SUCCESS;
|
Drv::SocketIpStatus status1 = Drv::SOCK_SUCCESS;
|
||||||
Drv::SocketIpStatus status2 = Drv::SOCK_SUCCESS;
|
Drv::SocketIpStatus status2 = Drv::SOCK_SUCCESS;
|
||||||
@ -47,8 +47,9 @@ void UdpTester::test_with_loop(U32 iterations, bool recv_thread) {
|
|||||||
|
|
||||||
// Configure the component
|
// Configure the component
|
||||||
this->component.configureSend("127.0.0.1", port1, 0, 100);
|
this->component.configureSend("127.0.0.1", port1, 0, 100);
|
||||||
this->component.configureRecv("127.0.0.1", port2);
|
if (not send_only) {
|
||||||
|
this->component.configureRecv("127.0.0.1", port2);
|
||||||
|
}
|
||||||
// Start up a receive thread
|
// Start up a receive thread
|
||||||
if (recv_thread) {
|
if (recv_thread) {
|
||||||
Os::TaskString name("receiver thread");
|
Os::TaskString name("receiver thread");
|
||||||
@ -58,7 +59,7 @@ void UdpTester::test_with_loop(U32 iterations, bool recv_thread) {
|
|||||||
// Loop through a bunch of client disconnects
|
// Loop through a bunch of client disconnects
|
||||||
for (U32 i = 0; i < iterations; i++) {
|
for (U32 i = 0; i < iterations; i++) {
|
||||||
Drv::UdpSocket udp2;
|
Drv::UdpSocket udp2;
|
||||||
U32 size = sizeof(m_data_storage);
|
FwSizeType size = sizeof(m_data_storage);
|
||||||
|
|
||||||
// Not testing with reconnect thread, we will need to open ourselves
|
// Not testing with reconnect thread, we will need to open ourselves
|
||||||
if (not recv_thread) {
|
if (not recv_thread) {
|
||||||
@ -72,8 +73,10 @@ void UdpTester::test_with_loop(U32 iterations, bool recv_thread) {
|
|||||||
Drv::Test::get_configured_delay_ms() / 10 + 1));
|
Drv::Test::get_configured_delay_ms() / 10 + 1));
|
||||||
}
|
}
|
||||||
EXPECT_TRUE(this->component.isOpened());
|
EXPECT_TRUE(this->component.isOpened());
|
||||||
|
// Other side socket only receives when component is send-only
|
||||||
udp2.configureSend("127.0.0.1", port2, 0, 100);
|
if (not send_only) {
|
||||||
|
udp2.configureSend("127.0.0.1", port2, 0, 100);
|
||||||
|
}
|
||||||
udp2.configureRecv("127.0.0.1", port1);
|
udp2.configureRecv("127.0.0.1", port1);
|
||||||
status2 = udp2.open(udp2_fd);
|
status2 = udp2.open(udp2_fd);
|
||||||
|
|
||||||
@ -93,7 +96,7 @@ void UdpTester::test_with_loop(U32 iterations, bool recv_thread) {
|
|||||||
Drv::Test::receive_all(udp2, udp2_fd, buffer, size);
|
Drv::Test::receive_all(udp2, udp2_fd, buffer, size);
|
||||||
Drv::Test::validate_random_buffer(m_data_buffer, buffer);
|
Drv::Test::validate_random_buffer(m_data_buffer, buffer);
|
||||||
// If receive thread is live, try the other way
|
// If receive thread is live, try the other way
|
||||||
if (recv_thread) {
|
if (recv_thread and not send_only) {
|
||||||
m_spinner = false;
|
m_spinner = false;
|
||||||
m_data_buffer.setSize(sizeof(m_data_storage));
|
m_data_buffer.setSize(sizeof(m_data_storage));
|
||||||
udp2.send(udp2_fd, m_data_buffer.getData(), m_data_buffer.getSize());
|
udp2.send(udp2_fd, m_data_buffer.getData(), m_data_buffer.getSize());
|
||||||
@ -144,6 +147,14 @@ void UdpTester ::test_multiple_messaging() {
|
|||||||
test_with_loop(100);
|
test_with_loop(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UdpTester ::test_basic_unidirectional_messaging() {
|
||||||
|
test_with_loop(1, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UdpTester ::test_multiple_unidirectional_messaging() {
|
||||||
|
test_with_loop(100, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
void UdpTester ::test_receive_thread() {
|
void UdpTester ::test_receive_thread() {
|
||||||
test_with_loop(1, true);
|
test_with_loop(1, true);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ namespace Drv {
|
|||||||
|
|
||||||
class UdpTester : public UdpGTestBase {
|
class UdpTester : public UdpGTestBase {
|
||||||
// Maximum size of histories storing events, telemetry, and port outputs
|
// Maximum size of histories storing events, telemetry, and port outputs
|
||||||
static const U32 MAX_HISTORY_SIZE = 1000;
|
static const FwSizeType MAX_HISTORY_SIZE = 1000;
|
||||||
// Instance ID supplied to the component instance under test
|
// Instance ID supplied to the component instance under test
|
||||||
static const FwEnumStoreType TEST_INSTANCE_ID = 0;
|
static const FwEnumStoreType TEST_INSTANCE_ID = 0;
|
||||||
// Queue depth supplied to component instance under test
|
// Queue depth supplied to component instance under test
|
||||||
@ -57,6 +57,14 @@ class UdpTester : public UdpGTestBase {
|
|||||||
//!
|
//!
|
||||||
void test_multiple_messaging();
|
void test_multiple_messaging();
|
||||||
|
|
||||||
|
//! Test basic messaging in unidirectional mode
|
||||||
|
//!
|
||||||
|
void test_basic_unidirectional_messaging();
|
||||||
|
|
||||||
|
//! Test basic reconnection behavior in unidirectional mode
|
||||||
|
//!
|
||||||
|
void test_multiple_unidirectional_messaging();
|
||||||
|
|
||||||
//! Test receive via thread
|
//! Test receive via thread
|
||||||
//!
|
//!
|
||||||
void test_receive_thread();
|
void test_receive_thread();
|
||||||
@ -69,7 +77,7 @@ class UdpTester : public UdpGTestBase {
|
|||||||
void test_buffer_deallocation();
|
void test_buffer_deallocation();
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
void test_with_loop(U32 iterations, bool recv_thread = false);
|
void test_with_loop(U32 iterations, bool recv_thread = false, bool send_only = false);
|
||||||
|
|
||||||
bool wait_on_change(Drv::IpSocket& socket, bool open, U32 iterations);
|
bool wait_on_change(Drv::IpSocket& socket, bool open, U32 iterations);
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ module Fpp {
|
|||||||
|
|
||||||
module ToCpp {
|
module ToCpp {
|
||||||
|
|
||||||
enum Phases {
|
enum Phases : U8 {
|
||||||
configConstants
|
configConstants
|
||||||
configObjects
|
configObjects
|
||||||
instances
|
instances
|
||||||
|
|||||||
@ -24,6 +24,7 @@ set(MOD_DEPS
|
|||||||
${PROJECT_NAME}/state_machine/external_instance
|
${PROJECT_NAME}/state_machine/external_instance
|
||||||
${PROJECT_NAME}/state_machine/internal/initial
|
${PROJECT_NAME}/state_machine/internal/initial
|
||||||
${PROJECT_NAME}/state_machine/internal/state
|
${PROJECT_NAME}/state_machine/internal/state
|
||||||
|
${PROJECT_NAME}/state_machine/internal_instance/choice
|
||||||
${PROJECT_NAME}/state_machine/internal_instance/initial
|
${PROJECT_NAME}/state_machine/internal_instance/initial
|
||||||
${PROJECT_NAME}/state_machine/internal_instance/state
|
${PROJECT_NAME}/state_machine/internal_instance/state
|
||||||
${PROJECT_NAME}/struct
|
${PROJECT_NAME}/struct
|
||||||
|
|||||||
@ -10,12 +10,12 @@
|
|||||||
//
|
//
|
||||||
// ======================================================================
|
// ======================================================================
|
||||||
|
|
||||||
|
#include "FppTest/array/AliasOfArrayAliasAc.hpp"
|
||||||
|
#include "FppTest/array/AliasStringArrayAc.hpp"
|
||||||
#include "FppTest/array/EnumArrayAc.hpp"
|
#include "FppTest/array/EnumArrayAc.hpp"
|
||||||
#include "FppTest/array/StringArrayAc.hpp"
|
#include "FppTest/array/StringArrayAc.hpp"
|
||||||
#include "FppTest/array/StructArrayAc.hpp"
|
#include "FppTest/array/StructArrayAc.hpp"
|
||||||
#include "FppTest/array/Uint32ArrayArrayAc.hpp"
|
#include "FppTest/array/Uint32ArrayArrayAc.hpp"
|
||||||
#include "FppTest/array/AliasOfArrayAliasAc.hpp"
|
|
||||||
#include "FppTest/array/AliasStringArrayAc.hpp"
|
|
||||||
|
|
||||||
#include "FppTest/typed_tests/ArrayTest.hpp"
|
#include "FppTest/typed_tests/ArrayTest.hpp"
|
||||||
|
|
||||||
@ -26,22 +26,13 @@
|
|||||||
// Test array string functions
|
// Test array string functions
|
||||||
template <typename ArrayType>
|
template <typename ArrayType>
|
||||||
class ArrayToStringTest : public ::testing::Test {
|
class ArrayToStringTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
void SetUp() override {
|
void SetUp() override { FppTest::Array::setTestVals<ArrayType>(testVals); }
|
||||||
FppTest::Array::setTestVals<ArrayType>(testVals);
|
|
||||||
}
|
|
||||||
|
|
||||||
typename ArrayType::ElementType testVals[ArrayType::SIZE];
|
typename ArrayType::ElementType testVals[ArrayType::SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
using ArrayTypes = ::testing::Types<
|
using ArrayTypes = ::testing::Types<Enum, String, Struct, Uint32Array, AliasString, AliasOfArray>;
|
||||||
Enum,
|
|
||||||
String,
|
|
||||||
Struct,
|
|
||||||
Uint32Array,
|
|
||||||
AliasString,
|
|
||||||
AliasOfArray
|
|
||||||
>;
|
|
||||||
TYPED_TEST_SUITE(ArrayToStringTest, ArrayTypes);
|
TYPED_TEST_SUITE(ArrayToStringTest, ArrayTypes);
|
||||||
|
|
||||||
// Test array toString() and ostream operator functions
|
// Test array toString() and ostream operator functions
|
||||||
@ -60,8 +51,5 @@ TYPED_TEST(ArrayToStringTest, ToString) {
|
|||||||
}
|
}
|
||||||
buf2 << " ]";
|
buf2 << " ]";
|
||||||
|
|
||||||
ASSERT_STREQ(
|
ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str());
|
||||||
buf1.str().c_str(),
|
|
||||||
buf2.str().c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,15 +28,13 @@
|
|||||||
|
|
||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
#include <sstream>
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
// Tests FPP format strings
|
// Tests FPP format strings
|
||||||
class FormatTest : public ::testing::Test {
|
class FormatTest : public ::testing::Test {
|
||||||
protected:
|
protected:
|
||||||
void SetUp() override {
|
void SetUp() override { buf2 << "[ "; }
|
||||||
buf2 << "[ ";
|
|
||||||
}
|
|
||||||
|
|
||||||
std::stringstream buf1, buf2;
|
std::stringstream buf1, buf2;
|
||||||
};
|
};
|
||||||
@ -54,10 +52,7 @@ TEST_F(FormatTest, Bool) {
|
|||||||
}
|
}
|
||||||
buf2 << " ]";
|
buf2 << " ]";
|
||||||
|
|
||||||
ASSERT_STREQ(
|
ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str());
|
||||||
buf1.str().c_str(),
|
|
||||||
buf2.str().c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FormatTest, U8) {
|
TEST_F(FormatTest, U8) {
|
||||||
@ -73,16 +68,13 @@ TEST_F(FormatTest, U8) {
|
|||||||
}
|
}
|
||||||
buf2 << " ]";
|
buf2 << " ]";
|
||||||
|
|
||||||
ASSERT_STREQ(
|
ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str());
|
||||||
buf1.str().c_str(),
|
|
||||||
buf2.str().c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FormatTest, U16Dec) {
|
TEST_F(FormatTest, U16Dec) {
|
||||||
U16 testVals[FormatU16Dec::SIZE] = {0, 100, std::numeric_limits<U16>::max()};
|
U16 testVals[FormatU16Dec::SIZE] = {0, 100, std::numeric_limits<U16>::max()};
|
||||||
FormatU16Dec a(testVals);
|
FormatU16Dec a(testVals);
|
||||||
|
|
||||||
buf1 << a;
|
buf1 << a;
|
||||||
for (U32 i = 0; i < FormatU16Dec::SIZE; i++) {
|
for (U32 i = 0; i < FormatU16Dec::SIZE; i++) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
@ -92,16 +84,13 @@ TEST_F(FormatTest, U16Dec) {
|
|||||||
}
|
}
|
||||||
buf2 << " ]";
|
buf2 << " ]";
|
||||||
|
|
||||||
ASSERT_STREQ(
|
ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str());
|
||||||
buf1.str().c_str(),
|
|
||||||
buf2.str().c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FormatTest, U32Oct) {
|
TEST_F(FormatTest, U32Oct) {
|
||||||
U32 testVals[FormatU32Oct::SIZE] = {0, 100, std::numeric_limits<U32>::max()};
|
U32 testVals[FormatU32Oct::SIZE] = {0, 100, std::numeric_limits<U32>::max()};
|
||||||
FormatU32Oct a(testVals);
|
FormatU32Oct a(testVals);
|
||||||
|
|
||||||
buf1 << a;
|
buf1 << a;
|
||||||
for (U32 i = 0; i < FormatU32Oct::SIZE; i++) {
|
for (U32 i = 0; i < FormatU32Oct::SIZE; i++) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
@ -111,17 +100,13 @@ TEST_F(FormatTest, U32Oct) {
|
|||||||
}
|
}
|
||||||
buf2 << " ]";
|
buf2 << " ]";
|
||||||
|
|
||||||
ASSERT_STREQ(
|
ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str());
|
||||||
buf1.str().c_str(),
|
|
||||||
buf2.str().c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FormatTest, U64Hex) {
|
TEST_F(FormatTest, U64Hex) {
|
||||||
U64 testVals[FormatU64Hex::SIZE] =
|
U64 testVals[FormatU64Hex::SIZE] = {0, 100, std::numeric_limits<U64>::max()};
|
||||||
{0, 100, std::numeric_limits<U64>::max()};
|
|
||||||
FormatU64Hex a(testVals);
|
FormatU64Hex a(testVals);
|
||||||
|
|
||||||
buf1 << a;
|
buf1 << a;
|
||||||
for (U32 i = 0; i < FormatU64Hex::SIZE; i++) {
|
for (U32 i = 0; i < FormatU64Hex::SIZE; i++) {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
@ -131,15 +116,11 @@ TEST_F(FormatTest, U64Hex) {
|
|||||||
}
|
}
|
||||||
buf2 << " ]";
|
buf2 << " ]";
|
||||||
|
|
||||||
ASSERT_STREQ(
|
ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str());
|
||||||
buf1.str().c_str(),
|
|
||||||
buf2.str().c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FormatTest, I8) {
|
TEST_F(FormatTest, I8) {
|
||||||
I8 testVals[FormatI8::SIZE] =
|
I8 testVals[FormatI8::SIZE] = {std::numeric_limits<I8>::min(), 0, std::numeric_limits<I8>::max()};
|
||||||
{std::numeric_limits<I8>::min(), 0, std::numeric_limits<I8>::max()};
|
|
||||||
FormatI8 a(testVals);
|
FormatI8 a(testVals);
|
||||||
|
|
||||||
buf1 << a;
|
buf1 << a;
|
||||||
@ -151,15 +132,11 @@ TEST_F(FormatTest, I8) {
|
|||||||
}
|
}
|
||||||
buf2 << " ]";
|
buf2 << " ]";
|
||||||
|
|
||||||
ASSERT_STREQ(
|
ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str());
|
||||||
buf1.str().c_str(),
|
|
||||||
buf2.str().c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FormatTest, I16Dec) {
|
TEST_F(FormatTest, I16Dec) {
|
||||||
I16 testVals[FormatI16Dec::SIZE] =
|
I16 testVals[FormatI16Dec::SIZE] = {std::numeric_limits<I16>::min(), 0, std::numeric_limits<I16>::max()};
|
||||||
{std::numeric_limits<I16>::min(), 0, std::numeric_limits<I16>::max()};
|
|
||||||
FormatI16Dec a(testVals);
|
FormatI16Dec a(testVals);
|
||||||
|
|
||||||
buf1 << a;
|
buf1 << a;
|
||||||
@ -171,15 +148,11 @@ TEST_F(FormatTest, I16Dec) {
|
|||||||
}
|
}
|
||||||
buf2 << " ]";
|
buf2 << " ]";
|
||||||
|
|
||||||
ASSERT_STREQ(
|
ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str());
|
||||||
buf1.str().c_str(),
|
|
||||||
buf2.str().c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FormatTest, I32Oct) {
|
TEST_F(FormatTest, I32Oct) {
|
||||||
I32 testVals[FormatI32Oct::SIZE] =
|
I32 testVals[FormatI32Oct::SIZE] = {std::numeric_limits<I32>::min(), 0, std::numeric_limits<I32>::max()};
|
||||||
{std::numeric_limits<I32>::min(), 0, std::numeric_limits<I32>::max()};
|
|
||||||
FormatI32Oct a(testVals);
|
FormatI32Oct a(testVals);
|
||||||
|
|
||||||
buf1 << a;
|
buf1 << a;
|
||||||
@ -191,16 +164,11 @@ TEST_F(FormatTest, I32Oct) {
|
|||||||
}
|
}
|
||||||
buf2 << " ]";
|
buf2 << " ]";
|
||||||
|
|
||||||
ASSERT_STREQ(
|
ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str());
|
||||||
buf1.str().c_str(),
|
|
||||||
buf2.str().c_str()
|
|
||||||
);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FormatTest, I64Hex) {
|
TEST_F(FormatTest, I64Hex) {
|
||||||
I64 testVals[FormatI64Hex::SIZE] =
|
I64 testVals[FormatI64Hex::SIZE] = {std::numeric_limits<I64>::min(), 0, std::numeric_limits<I64>::max()};
|
||||||
{std::numeric_limits<I64>::min(), 0, std::numeric_limits<I64>::max()};
|
|
||||||
FormatI64Hex a(testVals);
|
FormatI64Hex a(testVals);
|
||||||
|
|
||||||
buf1 << a;
|
buf1 << a;
|
||||||
@ -212,15 +180,11 @@ TEST_F(FormatTest, I64Hex) {
|
|||||||
}
|
}
|
||||||
buf2 << " ]";
|
buf2 << " ]";
|
||||||
|
|
||||||
ASSERT_STREQ(
|
ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str());
|
||||||
buf1.str().c_str(),
|
|
||||||
buf2.str().c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FormatTest, F32E) {
|
TEST_F(FormatTest, F32E) {
|
||||||
F32 testVals[FormatF32e::SIZE] =
|
F32 testVals[FormatF32e::SIZE] = {std::numeric_limits<F32>::min(), 0.0, std::numeric_limits<F32>::max()};
|
||||||
{std::numeric_limits<F32>::min(), 0.0, std::numeric_limits<F32>::max()};
|
|
||||||
FormatF32e a(testVals);
|
FormatF32e a(testVals);
|
||||||
|
|
||||||
buf1 << a;
|
buf1 << a;
|
||||||
@ -232,15 +196,11 @@ TEST_F(FormatTest, F32E) {
|
|||||||
}
|
}
|
||||||
buf2 << " ]";
|
buf2 << " ]";
|
||||||
|
|
||||||
ASSERT_STREQ(
|
ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str());
|
||||||
buf1.str().c_str(),
|
|
||||||
buf2.str().c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FormatTest, F32F) {
|
TEST_F(FormatTest, F32F) {
|
||||||
F32 testVals[FormatF32f::SIZE] =
|
F32 testVals[FormatF32f::SIZE] = {std::numeric_limits<F32>::min(), 0.0, std::numeric_limits<F32>::max()};
|
||||||
{std::numeric_limits<F32>::min(), 0.0, std::numeric_limits<F32>::max()};
|
|
||||||
FormatF32f a(testVals);
|
FormatF32f a(testVals);
|
||||||
|
|
||||||
buf1 << a;
|
buf1 << a;
|
||||||
@ -252,15 +212,11 @@ TEST_F(FormatTest, F32F) {
|
|||||||
}
|
}
|
||||||
buf2 << " ]";
|
buf2 << " ]";
|
||||||
|
|
||||||
ASSERT_STREQ(
|
ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str());
|
||||||
buf1.str().c_str(),
|
|
||||||
buf2.str().c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FormatTest, F64G) {
|
TEST_F(FormatTest, F64G) {
|
||||||
F64 testVals[FormatF64g::SIZE] =
|
F64 testVals[FormatF64g::SIZE] = {std::numeric_limits<F64>::min(), 0.0, std::numeric_limits<F64>::max()};
|
||||||
{std::numeric_limits<F64>::min(), 0.0, std::numeric_limits<F64>::max()};
|
|
||||||
FormatF64g a(testVals);
|
FormatF64g a(testVals);
|
||||||
|
|
||||||
buf1 << a;
|
buf1 << a;
|
||||||
@ -272,10 +228,7 @@ TEST_F(FormatTest, F64G) {
|
|||||||
}
|
}
|
||||||
buf2 << " ]";
|
buf2 << " ]";
|
||||||
|
|
||||||
ASSERT_STREQ(
|
ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str());
|
||||||
buf1.str().c_str(),
|
|
||||||
buf2.str().c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FormatTest, String) {
|
TEST_F(FormatTest, String) {
|
||||||
@ -297,15 +250,12 @@ TEST_F(FormatTest, String) {
|
|||||||
}
|
}
|
||||||
buf2 << " ]";
|
buf2 << " ]";
|
||||||
|
|
||||||
ASSERT_STREQ(
|
ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str());
|
||||||
buf1.str().c_str(),
|
|
||||||
buf2.str().c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(FormatTest, Char) {
|
TEST_F(FormatTest, Char) {
|
||||||
U8 testVals[FormatChar::SIZE] =
|
U8 testVals[FormatChar::SIZE] = {FppTest::Utils::getNonzeroU8(), FppTest::Utils::getNonzeroU8(),
|
||||||
{FppTest::Utils::getNonzeroU8(), FppTest::Utils::getNonzeroU8(), FppTest::Utils::getNonzeroU8()};
|
FppTest::Utils::getNonzeroU8()};
|
||||||
FormatChar a(testVals);
|
FormatChar a(testVals);
|
||||||
|
|
||||||
buf1 << a;
|
buf1 << a;
|
||||||
@ -317,8 +267,5 @@ TEST_F(FormatTest, Char) {
|
|||||||
}
|
}
|
||||||
buf2 << " ]";
|
buf2 << " ]";
|
||||||
|
|
||||||
ASSERT_STREQ(
|
ASSERT_STREQ(buf1.str().c_str(), buf2.str().c_str());
|
||||||
buf1.str().c_str(),
|
|
||||||
buf2.str().c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,12 +10,12 @@
|
|||||||
//
|
//
|
||||||
// ======================================================================
|
// ======================================================================
|
||||||
|
|
||||||
|
#include "FppTest/array/AliasOfArrayAliasAc.hpp"
|
||||||
|
#include "FppTest/array/AliasStringArrayAc.hpp"
|
||||||
#include "FppTest/array/EnumArrayAc.hpp"
|
#include "FppTest/array/EnumArrayAc.hpp"
|
||||||
#include "FppTest/array/StringArrayAc.hpp"
|
#include "FppTest/array/StringArrayAc.hpp"
|
||||||
#include "FppTest/array/StructArrayAc.hpp"
|
#include "FppTest/array/StructArrayAc.hpp"
|
||||||
#include "FppTest/array/Uint32ArrayArrayAc.hpp"
|
#include "FppTest/array/Uint32ArrayArrayAc.hpp"
|
||||||
#include "FppTest/array/AliasOfArrayAliasAc.hpp"
|
|
||||||
#include "FppTest/array/AliasStringArrayAc.hpp"
|
|
||||||
#include "FppTest/typed_tests/ArrayTest.hpp"
|
#include "FppTest/typed_tests/ArrayTest.hpp"
|
||||||
#include "FppTest/typed_tests/StringTest.hpp"
|
#include "FppTest/typed_tests/StringTest.hpp"
|
||||||
#include "FppTest/utils/Utils.hpp"
|
#include "FppTest/utils/Utils.hpp"
|
||||||
@ -25,12 +25,7 @@
|
|||||||
#include "gtest/gtest.h"
|
#include "gtest/gtest.h"
|
||||||
|
|
||||||
// Instantiate array tests
|
// Instantiate array tests
|
||||||
using ArrayTestImplementations = ::testing::Types<
|
using ArrayTestImplementations = ::testing::Types<Enum, String, Struct, Uint32Array>;
|
||||||
Enum,
|
|
||||||
String,
|
|
||||||
Struct,
|
|
||||||
Uint32Array
|
|
||||||
>;
|
|
||||||
INSTANTIATE_TYPED_TEST_SUITE_P(FppTest, ArrayTest, ArrayTestImplementations);
|
INSTANTIATE_TYPED_TEST_SUITE_P(FppTest, ArrayTest, ArrayTestImplementations);
|
||||||
|
|
||||||
// Specializations for default values
|
// Specializations for default values
|
||||||
@ -42,52 +37,35 @@ void FppTest::Array::setDefaultVals<Enum>(E (&a)[Enum::SIZE]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Specialization for test values
|
// Specialization for test values
|
||||||
template<>
|
template <>
|
||||||
void FppTest::Array::setTestVals<Enum>(E (&a)[Enum::SIZE]) {
|
void FppTest::Array::setTestVals<Enum>(E (&a)[Enum::SIZE]) {
|
||||||
a[0] = static_cast<E::T>(STest::Pick::startLength(
|
a[0] = static_cast<E::T>(STest::Pick::startLength(E::B, E::NUM_CONSTANTS - 1));
|
||||||
E::B,
|
|
||||||
E::NUM_CONSTANTS - 1
|
|
||||||
));
|
|
||||||
|
|
||||||
for (U32 i = 1; i < Enum::SIZE; i++) {
|
for (U32 i = 1; i < Enum::SIZE; i++) {
|
||||||
a[i] = static_cast<E::T>(STest::Pick::startLength(
|
a[i] = static_cast<E::T>(STest::Pick::startLength(E::A, E::NUM_CONSTANTS - 1));
|
||||||
E::A,
|
|
||||||
E::NUM_CONSTANTS - 1
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char stringDefaultValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE];
|
static char stringDefaultValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE];
|
||||||
|
|
||||||
template<>
|
template <>
|
||||||
void FppTest::Array::setDefaultVals<String>
|
void FppTest::Array::setDefaultVals<String>(Fw::ExternalString (&a)[::String::SIZE]) {
|
||||||
(Fw::ExternalString (&a)[::String::SIZE]) {
|
|
||||||
for (U32 i = 0; i < ::String::SIZE; i++) {
|
for (U32 i = 0; i < ::String::SIZE; i++) {
|
||||||
a[i].setBuffer(
|
a[i].setBuffer(stringDefaultValsBuffer[i], ::String::ELEMENT_BUFFER_SIZE);
|
||||||
stringDefaultValsBuffer[i],
|
|
||||||
::String::ELEMENT_BUFFER_SIZE
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char stringTestValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE];
|
static char stringTestValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE];
|
||||||
|
|
||||||
template<>
|
template <>
|
||||||
void FppTest::Array::setTestVals<String>
|
void FppTest::Array::setTestVals<String>(Fw::ExternalString (&a)[::String::SIZE]) {
|
||||||
(Fw::ExternalString (&a)[::String::SIZE]) {
|
|
||||||
for (U32 i = 0; i < ::String::SIZE; i++) {
|
for (U32 i = 0; i < ::String::SIZE; i++) {
|
||||||
a[i].setBuffer(
|
a[i].setBuffer(stringTestValsBuffer[i], ::String::ELEMENT_BUFFER_SIZE);
|
||||||
stringTestValsBuffer[i],
|
FppTest::Utils::setString(stringTestValsBuffer[i], ::String::ELEMENT_BUFFER_SIZE, 1);
|
||||||
::String::ELEMENT_BUFFER_SIZE
|
|
||||||
);
|
|
||||||
FppTest::Utils::setString(
|
|
||||||
stringTestValsBuffer[i],
|
|
||||||
::String::ELEMENT_BUFFER_SIZE, 1
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template <>
|
||||||
void FppTest::Array::setTestVals<Struct>(S (&a)[Struct::SIZE]) {
|
void FppTest::Array::setTestVals<Struct>(S (&a)[Struct::SIZE]) {
|
||||||
U32 b[3];
|
U32 b[3];
|
||||||
for (U32 i = 0; i < Struct::SIZE; i++) {
|
for (U32 i = 0; i < Struct::SIZE; i++) {
|
||||||
@ -98,7 +76,7 @@ void FppTest::Array::setTestVals<Struct>(S (&a)[Struct::SIZE]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template <>
|
||||||
void FppTest::Array::setTestVals<Uint32Array>(Uint32 (&a)[Uint32Array::SIZE]) {
|
void FppTest::Array::setTestVals<Uint32Array>(Uint32 (&a)[Uint32Array::SIZE]) {
|
||||||
Uint32 b;
|
Uint32 b;
|
||||||
for (U32 i = 0; i < Uint32Array::SIZE; i++) {
|
for (U32 i = 0; i < Uint32Array::SIZE; i++) {
|
||||||
@ -111,77 +89,56 @@ void FppTest::Array::setTestVals<Uint32Array>(Uint32 (&a)[Uint32Array::SIZE]) {
|
|||||||
|
|
||||||
static char stringAliasDefaultValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE];
|
static char stringAliasDefaultValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE];
|
||||||
|
|
||||||
template<>
|
template <>
|
||||||
void FppTest::Array::setDefaultVals<AliasString>
|
void FppTest::Array::setDefaultVals<AliasString>(Fw::ExternalString (&a)[::AliasString::SIZE]) {
|
||||||
(Fw::ExternalString (&a)[::AliasString::SIZE]) {
|
|
||||||
for (U32 i = 0; i < ::AliasString::SIZE; i++) {
|
for (U32 i = 0; i < ::AliasString::SIZE; i++) {
|
||||||
a[i].setBuffer(
|
a[i].setBuffer(stringAliasDefaultValsBuffer[i], ::AliasString::ELEMENT_BUFFER_SIZE);
|
||||||
stringAliasDefaultValsBuffer[i],
|
|
||||||
::AliasString::ELEMENT_BUFFER_SIZE
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static char stringAliasTestValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE];
|
static char stringAliasTestValsBuffer[::String::SIZE][::String::ELEMENT_BUFFER_SIZE];
|
||||||
|
|
||||||
template<>
|
template <>
|
||||||
void FppTest::Array::setTestVals<AliasString>(Fw::ExternalString (&a)[AliasString::SIZE]) {
|
void FppTest::Array::setTestVals<AliasString>(Fw::ExternalString (&a)[AliasString::SIZE]) {
|
||||||
for (U32 i = 0; i < ::AliasString::SIZE; i++) {
|
for (U32 i = 0; i < ::AliasString::SIZE; i++) {
|
||||||
a[i].setBuffer(
|
a[i].setBuffer(stringAliasTestValsBuffer[i], ::AliasString::ELEMENT_BUFFER_SIZE);
|
||||||
stringAliasTestValsBuffer[i],
|
FppTest::Utils::setString(stringAliasTestValsBuffer[i], ::AliasString::ELEMENT_BUFFER_SIZE, 1);
|
||||||
::AliasString::ELEMENT_BUFFER_SIZE
|
|
||||||
);
|
|
||||||
FppTest::Utils::setString(
|
|
||||||
stringAliasTestValsBuffer[i],
|
|
||||||
::AliasString::ELEMENT_BUFFER_SIZE, 1
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template <>
|
||||||
void FppTest::Array::setTestVals<AliasOfArray>(EA (&a)[AliasOfArray::SIZE]) {
|
void FppTest::Array::setTestVals<AliasOfArray>(EA (&a)[AliasOfArray::SIZE]) {
|
||||||
a[0] = static_cast<EA::T>(STest::Pick::startLength(
|
a[0] = static_cast<EA::T>(STest::Pick::startLength(EA::B, EA::NUM_CONSTANTS - 1));
|
||||||
EA::B,
|
|
||||||
EA::NUM_CONSTANTS - 1
|
|
||||||
));
|
|
||||||
|
|
||||||
for (U32 i = 1; i < Enum::SIZE; i++) {
|
for (U32 i = 1; i < Enum::SIZE; i++) {
|
||||||
a[i] = static_cast<EA::T>(STest::Pick::startLength(
|
a[i] = static_cast<EA::T>(STest::Pick::startLength(EA::A, EA::NUM_CONSTANTS - 1));
|
||||||
EA::A,
|
|
||||||
EA::NUM_CONSTANTS - 1
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specializations for multi element constructor
|
// Specializations for multi element constructor
|
||||||
template<>
|
template <>
|
||||||
Enum FppTest::Array::getMultiElementConstructedArray<Enum>
|
Enum FppTest::Array::getMultiElementConstructedArray<Enum>(E (&a)[Enum::SIZE]) {
|
||||||
(E (&a)[Enum::SIZE]) {
|
return Enum({a[0], a[1], a[2]});
|
||||||
return Enum(a[0], a[1], a[2]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template <>
|
||||||
::String FppTest::Array::getMultiElementConstructedArray<::String>
|
::String FppTest::Array::getMultiElementConstructedArray<::String>(Fw::ExternalString (&a)[::String::SIZE]) {
|
||||||
(Fw::ExternalString (&a)[::String::SIZE]) {
|
return ::String({Fw::String(a[0]), Fw::String(a[1]), Fw::String(a[2])});
|
||||||
return ::String(a[0], a[1], a[2]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template <>
|
||||||
Struct FppTest::Array::getMultiElementConstructedArray<Struct>
|
Struct FppTest::Array::getMultiElementConstructedArray<Struct>(S (&a)[Struct::SIZE]) {
|
||||||
(S (&a)[Struct::SIZE]) {
|
return Struct({a[0], a[1], a[2]});
|
||||||
return Struct(a[0], a[1], a[2]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<>
|
template <>
|
||||||
Uint32Array FppTest::Array::getMultiElementConstructedArray<Uint32Array>
|
Uint32Array FppTest::Array::getMultiElementConstructedArray<Uint32Array>(Uint32 (&a)[Uint32Array::SIZE]) {
|
||||||
(Uint32 (&a)[Uint32Array::SIZE]) {
|
return Uint32Array({a[0], a[1], a[2]});
|
||||||
return Uint32Array(a[0], a[1], a[2]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Specializations for serialized size
|
// Specializations for serialized size
|
||||||
template <>
|
template <>
|
||||||
U32 FppTest::Array::getSerializedSize<::String>
|
U32 FppTest::Array::getSerializedSize<::String>(Fw::ExternalString (&a)[::String::SIZE]) {
|
||||||
(Fw::ExternalString (&a)[::String::SIZE]) {
|
|
||||||
U32 serializedSize = 0;
|
U32 serializedSize = 0;
|
||||||
|
|
||||||
for (U32 i = 0; i < ::String::SIZE; i++) {
|
for (U32 i = 0; i < ::String::SIZE; i++) {
|
||||||
@ -192,10 +149,7 @@ U32 FppTest::Array::getSerializedSize<::String>
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Instantiate string tests for arrays
|
// Instantiate string tests for arrays
|
||||||
using StringTestImplementations = ::testing::Types<
|
using StringTestImplementations = ::testing::Types<Fw::StringTemplate<80>, Fw::StringTemplate<100>>;
|
||||||
Fw::StringTemplate<80>,
|
|
||||||
Fw::StringTemplate<100>
|
|
||||||
>;
|
|
||||||
INSTANTIATE_TYPED_TEST_SUITE_P(Array, StringTest, StringTestImplementations);
|
INSTANTIATE_TYPED_TEST_SUITE_P(Array, StringTest, StringTestImplementations);
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
|
|||||||
@ -4,117 +4,79 @@
|
|||||||
// \brief cpp file for ActiveTest component implementation class
|
// \brief cpp file for ActiveTest component implementation class
|
||||||
// ======================================================================
|
// ======================================================================
|
||||||
|
|
||||||
|
|
||||||
#include "ActiveTest.hpp"
|
#include "ActiveTest.hpp"
|
||||||
#include <Fw/FPrimeBasicTypes.hpp>
|
#include <Fw/FPrimeBasicTypes.hpp>
|
||||||
|
|
||||||
#include "FppTest/component/active/SerialPortIndexEnumAc.hpp"
|
#include "FppTest/component/active/SerialPortIndexEnumAc.hpp"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Construction, initialization, and destruction
|
// Construction, initialization, and destruction
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
ActiveTest ::
|
ActiveTest ::ActiveTest(const char* const compName) : ActiveTestComponentBase(compName) {}
|
||||||
ActiveTest(
|
|
||||||
const char *const compName
|
|
||||||
) : ActiveTestComponentBase(compName)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
ActiveTest ::~ActiveTest() {}
|
||||||
|
|
||||||
ActiveTest ::
|
#define TestComponentName ActiveTest
|
||||||
~ActiveTest()
|
#include "FppTest/component/common/typed.cpp"
|
||||||
{
|
#include "FppTest/component/common/typed_async.cpp"
|
||||||
|
|
||||||
}
|
// ----------------------------------------------------------------------
|
||||||
|
// Handler implementations for user-defined serial input ports
|
||||||
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
#define TestComponentName ActiveTest
|
void ActiveTest ::serialAsync_handler(FwIndexType portNum, //!< The port number
|
||||||
#include "FppTest/component/common/typed_async.cpp"
|
Fw::LinearBufferBase& Buffer //!< The serialization buffer
|
||||||
#include "FppTest/component/common/typed.cpp"
|
) {
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// Handler implementations for user-defined serial input ports
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
void ActiveTest ::
|
|
||||||
serialAsync_handler(
|
|
||||||
FwIndexType portNum, //!< The port number
|
|
||||||
Fw::SerializeBufferBase &Buffer //!< The serialization buffer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->serializeStatus = this->serialOut_out(portNum, Buffer);
|
this->serializeStatus = this->serialOut_out(portNum, Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActiveTest ::
|
void ActiveTest ::serialAsyncAssert_handler(FwIndexType portNum, //!< The port number
|
||||||
serialAsyncAssert_handler(
|
Fw::LinearBufferBase& Buffer //!< The serialization buffer
|
||||||
FwIndexType portNum, //!< The port number
|
) {
|
||||||
Fw::SerializeBufferBase &Buffer //!< The serialization buffer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->serializeStatus = this->serialOut_out(SerialPortIndex::ENUM, Buffer);
|
this->serializeStatus = this->serialOut_out(SerialPortIndex::ENUM, Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActiveTest ::
|
void ActiveTest ::serialAsyncBlockPriority_handler(FwIndexType portNum, //!< The port number
|
||||||
serialAsyncBlockPriority_handler(
|
Fw::LinearBufferBase& Buffer //!< The serialization buffer
|
||||||
FwIndexType portNum, //!< The port number
|
) {
|
||||||
Fw::SerializeBufferBase &Buffer //!< The serialization buffer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->serializeStatus = this->serialOut_out(SerialPortIndex::ARRAY, Buffer);
|
this->serializeStatus = this->serialOut_out(SerialPortIndex::ARRAY, Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActiveTest ::
|
void ActiveTest ::serialAsyncDropPriority_handler(FwIndexType portNum, //!< The port number
|
||||||
serialAsyncDropPriority_handler(
|
Fw::LinearBufferBase& Buffer //!< The serialization buffer
|
||||||
FwIndexType portNum, //!< The port number
|
) {
|
||||||
Fw::SerializeBufferBase &Buffer //!< The serialization buffer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->serializeStatus = this->serialOut_out(SerialPortIndex::STRUCT, Buffer);
|
this->serializeStatus = this->serialOut_out(SerialPortIndex::STRUCT, Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActiveTest ::
|
void ActiveTest ::serialGuarded_handler(FwIndexType portNum, //!< The port number
|
||||||
serialGuarded_handler(
|
Fw::LinearBufferBase& Buffer //!< The serialization buffer
|
||||||
FwIndexType portNum, //!< The port number
|
) {
|
||||||
Fw::SerializeBufferBase &Buffer //!< The serialization buffer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->serializeStatus = this->serialOut_out(portNum, Buffer);
|
this->serializeStatus = this->serialOut_out(portNum, Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActiveTest ::
|
void ActiveTest ::serialSync_handler(FwIndexType portNum, //!< The port number
|
||||||
serialSync_handler(
|
Fw::LinearBufferBase& Buffer //!< The serialization buffer
|
||||||
FwIndexType portNum, //!< The port number
|
) {
|
||||||
Fw::SerializeBufferBase &Buffer //!< The serialization buffer
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->serializeStatus = this->serialOut_out(portNum, Buffer);
|
this->serializeStatus = this->serialOut_out(portNum, Buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Command handler implementations
|
// Command handler implementations
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
void ActiveTest ::
|
void ActiveTest ::CMD_ASYNC_NO_ARGS_cmdHandler(const FwOpcodeType opCode, const U32 cmdSeq) {
|
||||||
CMD_ASYNC_NO_ARGS_cmdHandler(
|
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
|
||||||
const FwOpcodeType opCode,
|
}
|
||||||
const U32 cmdSeq
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActiveTest ::
|
void ActiveTest ::CMD_ASYNC_PRIMITIVE_cmdHandler(const FwOpcodeType opCode,
|
||||||
CMD_ASYNC_PRIMITIVE_cmdHandler(
|
const U32 cmdSeq,
|
||||||
const FwOpcodeType opCode,
|
U32 u32_1,
|
||||||
const U32 cmdSeq,
|
U32 u32_2,
|
||||||
U32 u32_1,
|
F32 f32_1,
|
||||||
U32 u32_2,
|
F32 f32_2,
|
||||||
F32 f32_1,
|
bool b1,
|
||||||
F32 f32_2,
|
bool b2) {
|
||||||
bool b1,
|
|
||||||
bool b2
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->primitiveCmd.args.val1 = u32_1;
|
this->primitiveCmd.args.val1 = u32_1;
|
||||||
this->primitiveCmd.args.val2 = u32_2;
|
this->primitiveCmd.args.val2 = u32_2;
|
||||||
this->primitiveCmd.args.val3 = f32_1;
|
this->primitiveCmd.args.val3 = f32_1;
|
||||||
@ -122,80 +84,49 @@
|
|||||||
this->primitiveCmd.args.val5 = b1;
|
this->primitiveCmd.args.val5 = b1;
|
||||||
this->primitiveCmd.args.val6 = b2;
|
this->primitiveCmd.args.val6 = b2;
|
||||||
|
|
||||||
this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::OK);
|
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActiveTest ::
|
void ActiveTest ::CMD_ASYNC_STRINGS_cmdHandler(const FwOpcodeType opCode,
|
||||||
CMD_ASYNC_STRINGS_cmdHandler(
|
const U32 cmdSeq,
|
||||||
const FwOpcodeType opCode,
|
const Fw::CmdStringArg& str1,
|
||||||
const U32 cmdSeq,
|
const Fw::CmdStringArg& str2) {
|
||||||
const Fw::CmdStringArg& str1,
|
|
||||||
const Fw::CmdStringArg& str2
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->stringCmd.args.val1 = str1;
|
this->stringCmd.args.val1 = str1;
|
||||||
this->stringCmd.args.val2 = str2;
|
this->stringCmd.args.val2 = str2;
|
||||||
|
|
||||||
this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::OK);
|
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActiveTest ::
|
void ActiveTest ::CMD_ASYNC_ENUM_cmdHandler(const FwOpcodeType opCode, const U32 cmdSeq, FormalParamEnum en) {
|
||||||
CMD_ASYNC_ENUM_cmdHandler(
|
|
||||||
const FwOpcodeType opCode,
|
|
||||||
const U32 cmdSeq,
|
|
||||||
FormalParamEnum en
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->enumCmd.args.val = en;
|
this->enumCmd.args.val = en;
|
||||||
|
|
||||||
this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::OK);
|
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActiveTest ::
|
void ActiveTest ::CMD_ASYNC_ARRAY_cmdHandler(const FwOpcodeType opCode, const U32 cmdSeq, FormalParamArray arr) {
|
||||||
CMD_ASYNC_ARRAY_cmdHandler(
|
|
||||||
const FwOpcodeType opCode,
|
|
||||||
const U32 cmdSeq,
|
|
||||||
FormalParamArray arr
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->arrayCmd.args.val = arr;
|
this->arrayCmd.args.val = arr;
|
||||||
|
|
||||||
this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::OK);
|
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActiveTest ::
|
void ActiveTest ::CMD_ASYNC_STRUCT_cmdHandler(const FwOpcodeType opCode, const U32 cmdSeq, FormalParamStruct str) {
|
||||||
CMD_ASYNC_STRUCT_cmdHandler(
|
|
||||||
const FwOpcodeType opCode,
|
|
||||||
const U32 cmdSeq,
|
|
||||||
FormalParamStruct str
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->structCmd.args.val = str;
|
this->structCmd.args.val = str;
|
||||||
|
|
||||||
this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::OK);
|
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActiveTest ::
|
void ActiveTest ::CMD_NO_ARGS_cmdHandler(const FwOpcodeType opCode, const U32 cmdSeq) {
|
||||||
CMD_NO_ARGS_cmdHandler(
|
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
|
||||||
const FwOpcodeType opCode,
|
}
|
||||||
const U32 cmdSeq
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActiveTest ::
|
void ActiveTest ::CMD_PRIMITIVE_cmdHandler(const FwOpcodeType opCode,
|
||||||
CMD_PRIMITIVE_cmdHandler(
|
const U32 cmdSeq,
|
||||||
const FwOpcodeType opCode,
|
U32 u32_1,
|
||||||
const U32 cmdSeq,
|
U32 u32_2,
|
||||||
U32 u32_1,
|
F32 f32_1,
|
||||||
U32 u32_2,
|
F32 f32_2,
|
||||||
F32 f32_1,
|
bool b1,
|
||||||
F32 f32_2,
|
bool b2) {
|
||||||
bool b1,
|
|
||||||
bool b2
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->primitiveCmd.args.val1 = u32_1;
|
this->primitiveCmd.args.val1 = u32_1;
|
||||||
this->primitiveCmd.args.val2 = u32_2;
|
this->primitiveCmd.args.val2 = u32_2;
|
||||||
this->primitiveCmd.args.val3 = f32_1;
|
this->primitiveCmd.args.val3 = f32_1;
|
||||||
@ -203,138 +134,94 @@
|
|||||||
this->primitiveCmd.args.val5 = b1;
|
this->primitiveCmd.args.val5 = b1;
|
||||||
this->primitiveCmd.args.val6 = b2;
|
this->primitiveCmd.args.val6 = b2;
|
||||||
|
|
||||||
this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::OK);
|
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActiveTest ::
|
void ActiveTest ::CMD_STRINGS_cmdHandler(const FwOpcodeType opCode,
|
||||||
CMD_STRINGS_cmdHandler(
|
const U32 cmdSeq,
|
||||||
const FwOpcodeType opCode,
|
const Fw::CmdStringArg& str1,
|
||||||
const U32 cmdSeq,
|
const Fw::CmdStringArg& str2) {
|
||||||
const Fw::CmdStringArg& str1,
|
|
||||||
const Fw::CmdStringArg& str2
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->stringCmd.args.val1 = str1;
|
this->stringCmd.args.val1 = str1;
|
||||||
this->stringCmd.args.val2 = str2;
|
this->stringCmd.args.val2 = str2;
|
||||||
|
|
||||||
this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::OK);
|
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActiveTest ::
|
void ActiveTest ::CMD_ENUM_cmdHandler(const FwOpcodeType opCode, const U32 cmdSeq, FormalParamEnum en) {
|
||||||
CMD_ENUM_cmdHandler(
|
|
||||||
const FwOpcodeType opCode,
|
|
||||||
const U32 cmdSeq,
|
|
||||||
FormalParamEnum en
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->enumCmd.args.val = en;
|
this->enumCmd.args.val = en;
|
||||||
|
|
||||||
this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::OK);
|
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActiveTest ::
|
void ActiveTest ::CMD_ARRAY_cmdHandler(const FwOpcodeType opCode, const U32 cmdSeq, FormalParamArray arr) {
|
||||||
CMD_ARRAY_cmdHandler(
|
|
||||||
const FwOpcodeType opCode,
|
|
||||||
const U32 cmdSeq,
|
|
||||||
FormalParamArray arr
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->arrayCmd.args.val = arr;
|
this->arrayCmd.args.val = arr;
|
||||||
|
|
||||||
this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::OK);
|
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActiveTest ::
|
void ActiveTest ::CMD_STRUCT_cmdHandler(const FwOpcodeType opCode, const U32 cmdSeq, FormalParamStruct str) {
|
||||||
CMD_STRUCT_cmdHandler(
|
|
||||||
const FwOpcodeType opCode,
|
|
||||||
const U32 cmdSeq,
|
|
||||||
FormalParamStruct str
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->structCmd.args.val = str;
|
this->structCmd.args.val = str;
|
||||||
|
|
||||||
this->cmdResponse_out(opCode,cmdSeq,Fw::CmdResponse::OK);
|
this->cmdResponse_out(opCode, cmdSeq, Fw::CmdResponse::OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Internal interface handlers
|
// Internal interface handlers
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
//! Internal interface handler for internalArray
|
//! Internal interface handler for internalArray
|
||||||
void ActiveTest ::
|
void ActiveTest ::internalArray_internalInterfaceHandler(const FormalParamArray& arr //!< An array
|
||||||
internalArray_internalInterfaceHandler(
|
) {
|
||||||
const FormalParamArray& arr //!< An array
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->arrayInterface.args.val = arr;
|
this->arrayInterface.args.val = arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Internal interface handler for internalEnum
|
//! Internal interface handler for internalEnum
|
||||||
void ActiveTest ::
|
void ActiveTest ::internalEnum_internalInterfaceHandler(const FormalParamEnum& en //!< An enum
|
||||||
internalEnum_internalInterfaceHandler(
|
) {
|
||||||
const FormalParamEnum& en //!< An enum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->enumInterface.args.val = en;
|
this->enumInterface.args.val = en;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Internal interface handler for internalNoArgs
|
//! Internal interface handler for internalNoArgs
|
||||||
void ActiveTest ::
|
void ActiveTest ::internalNoArgs_internalInterfaceHandler() {}
|
||||||
internalNoArgs_internalInterfaceHandler()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Internal interface handler for internalPrimitive
|
//! Internal interface handler for internalPrimitive
|
||||||
void ActiveTest ::
|
void ActiveTest ::internalPrimitive_internalInterfaceHandler(U32 u32_1, //!< A U32
|
||||||
internalPrimitive_internalInterfaceHandler(
|
U32 u32_2, //!< A U32
|
||||||
U32 u32_1, //!< A U32
|
F32 f32_1, //!< An F32
|
||||||
U32 u32_2, //!< A U32
|
F32 f32_2, //!< An F32
|
||||||
F32 f32_1, //!< An F32
|
bool b1, //!< A boolean
|
||||||
F32 f32_2, //!< An F32
|
bool b2 //!< A boolean
|
||||||
bool b1, //!< A boolean
|
) {
|
||||||
bool b2 //!< A boolean
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->primitiveInterface.args.val1 = u32_1;
|
this->primitiveInterface.args.val1 = u32_1;
|
||||||
this->primitiveInterface.args.val2 = u32_2;
|
this->primitiveInterface.args.val2 = u32_2;
|
||||||
this->primitiveInterface.args.val3 = f32_1;
|
this->primitiveInterface.args.val3 = f32_1;
|
||||||
this->primitiveInterface.args.val4 = f32_2;
|
this->primitiveInterface.args.val4 = f32_2;
|
||||||
this->primitiveInterface.args.val5 = b1;
|
this->primitiveInterface.args.val5 = b1;
|
||||||
this->primitiveInterface.args.val6 = b2;
|
this->primitiveInterface.args.val6 = b2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Internal interface handler for internalString
|
//! Internal interface handler for internalString
|
||||||
void ActiveTest ::
|
void ActiveTest ::internalString_internalInterfaceHandler(const Fw::InternalInterfaceString& str1, //!< A string
|
||||||
internalString_internalInterfaceHandler(
|
const Fw::InternalInterfaceString& str2 //!< Another string
|
||||||
const Fw::InternalInterfaceString& str1, //!< A string
|
) {
|
||||||
const Fw::InternalInterfaceString& str2 //!< Another string
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->stringInterface.args.val1 = str1;
|
this->stringInterface.args.val1 = str1;
|
||||||
this->stringInterface.args.val2 = str2;
|
this->stringInterface.args.val2 = str2;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Internal interface handler for internalStruct
|
//! Internal interface handler for internalStruct
|
||||||
void ActiveTest ::
|
void ActiveTest ::internalStruct_internalInterfaceHandler(const FormalParamStruct& str //!< A struct
|
||||||
internalStruct_internalInterfaceHandler(
|
) {
|
||||||
const FormalParamStruct& str //!< A struct
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->structInterface.args.val = str;
|
this->structInterface.args.val = str;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Overflow hook implementations for user-defined async ports interfaces
|
// Overflow hook implementations for user-defined async ports interfaces
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
void ActiveTest ::
|
void ActiveTest ::enumArgsHook_overflowHook(const FwIndexType portNum,
|
||||||
enumArgsHook_overflowHook(
|
const FormalParamEnum& en,
|
||||||
const FwIndexType portNum,
|
FormalParamEnum& enRef,
|
||||||
const FormalParamEnum &en,
|
const FormalAliasEnum& enA,
|
||||||
FormalParamEnum &enRef,
|
FormalAliasEnum& enARef) {
|
||||||
const FormalAliasEnum& enA,
|
this->enumArgsHookOverflowed_out(portNum, en, enRef, enA, enARef);
|
||||||
FormalAliasEnum& enARef
|
}
|
||||||
)
|
|
||||||
{
|
|
||||||
this->enumArgsHookOverflowed_out(portNum, en, enRef, enA, enARef);
|
|
||||||
}
|
|
||||||
|
|||||||
@ -10,230 +10,194 @@
|
|||||||
#include "FppTest/component/active/ActiveTestComponentAc.hpp"
|
#include "FppTest/component/active/ActiveTestComponentAc.hpp"
|
||||||
#include "FppTest/component/types/FormalParamTypes.hpp"
|
#include "FppTest/component/types/FormalParamTypes.hpp"
|
||||||
|
|
||||||
|
class ActiveTest : public ActiveTestComponentBase {
|
||||||
class ActiveTest :
|
|
||||||
public ActiveTestComponentBase
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Component construction and destruction
|
// Component construction and destruction
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
//! Construct ActiveTest object
|
//! Construct ActiveTest object
|
||||||
ActiveTest(
|
ActiveTest(const char* const compName //!< The component name
|
||||||
const char* const compName //!< The component name
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//! Destroy ActiveTest object
|
//! Destroy ActiveTest object
|
||||||
~ActiveTest();
|
~ActiveTest();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
#define HAS_ASYNC
|
||||||
#define HAS_ASYNC
|
#include "FppTest/component/common/typed.hpp"
|
||||||
#include "FppTest/component/common/typed_async.hpp"
|
#include "FppTest/component/common/typed_async.hpp"
|
||||||
#include "FppTest/component/common/typed.hpp"
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Handler implementations for user-defined serial input ports
|
// Handler implementations for user-defined serial input ports
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
//! Handler implementation for serialAsync
|
//! Handler implementation for serialAsync
|
||||||
void serialAsync_handler(
|
void serialAsync_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
Fw::LinearBufferBase& buffer //!< The serialization buffer
|
||||||
Fw::SerializeBufferBase& buffer //!< The serialization buffer
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for serialAsyncAssert
|
//! Handler implementation for serialAsyncAssert
|
||||||
void serialAsyncAssert_handler(
|
void serialAsyncAssert_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
Fw::LinearBufferBase& buffer //!< The serialization buffer
|
||||||
Fw::SerializeBufferBase& buffer //!< The serialization buffer
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for serialAsyncBlockPriority
|
//! Handler implementation for serialAsyncBlockPriority
|
||||||
void serialAsyncBlockPriority_handler(
|
void serialAsyncBlockPriority_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
Fw::LinearBufferBase& buffer //!< The serialization buffer
|
||||||
Fw::SerializeBufferBase& buffer //!< The serialization buffer
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for serialAsyncDropPriority
|
//! Handler implementation for serialAsyncDropPriority
|
||||||
void serialAsyncDropPriority_handler(
|
void serialAsyncDropPriority_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
Fw::LinearBufferBase& buffer //!< The serialization buffer
|
||||||
Fw::SerializeBufferBase& buffer //!< The serialization buffer
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for serialGuarded
|
//! Handler implementation for serialGuarded
|
||||||
void serialGuarded_handler(
|
void serialGuarded_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
Fw::LinearBufferBase& buffer //!< The serialization buffer
|
||||||
Fw::SerializeBufferBase& buffer //!< The serialization buffer
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for serialSync
|
//! Handler implementation for serialSync
|
||||||
void serialSync_handler(
|
void serialSync_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
Fw::LinearBufferBase& buffer //!< The serialization buffer
|
||||||
Fw::SerializeBufferBase& buffer //!< The serialization buffer
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Handler implementations for commands
|
// Handler implementations for commands
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
//! Handler implementation for command CMD_NO_ARGS
|
//! Handler implementation for command CMD_NO_ARGS
|
||||||
void CMD_NO_ARGS_cmdHandler(
|
void CMD_NO_ARGS_cmdHandler(FwOpcodeType opCode, //!< The opcode
|
||||||
FwOpcodeType opCode, //!< The opcode
|
U32 cmdSeq //!< The command sequence number
|
||||||
U32 cmdSeq //!< The command sequence number
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for command CMD_PRIMITIVE
|
//! Handler implementation for command CMD_PRIMITIVE
|
||||||
void CMD_PRIMITIVE_cmdHandler(
|
void CMD_PRIMITIVE_cmdHandler(FwOpcodeType opCode, //!< The opcode
|
||||||
FwOpcodeType opCode, //!< The opcode
|
U32 cmdSeq, //!< The command sequence number
|
||||||
U32 cmdSeq, //!< The command sequence number
|
U32 u32_1, //!< A U32
|
||||||
U32 u32_1, //!< A U32
|
U32 u32_2, //!< A U32
|
||||||
U32 u32_2, //!< A U32
|
F32 f32_1, //!< An F32
|
||||||
F32 f32_1, //!< An F32
|
F32 f32_2, //!< An F32
|
||||||
F32 f32_2, //!< An F32
|
bool b1, //!< A boolean
|
||||||
bool b1, //!< A boolean
|
bool b2 //!< A boolean
|
||||||
bool b2 //!< A boolean
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for command CMD_STRINGS
|
//! Handler implementation for command CMD_STRINGS
|
||||||
void CMD_STRINGS_cmdHandler(
|
void CMD_STRINGS_cmdHandler(FwOpcodeType opCode, //!< The opcode
|
||||||
FwOpcodeType opCode, //!< The opcode
|
U32 cmdSeq, //!< The command sequence number
|
||||||
U32 cmdSeq, //!< The command sequence number
|
const Fw::CmdStringArg& str1, //!< A string
|
||||||
const Fw::CmdStringArg& str1, //!< A string
|
const Fw::CmdStringArg& str2 //!< Another string
|
||||||
const Fw::CmdStringArg& str2 //!< Another string
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for command CMD_ENUM
|
//! Handler implementation for command CMD_ENUM
|
||||||
void CMD_ENUM_cmdHandler(
|
void CMD_ENUM_cmdHandler(FwOpcodeType opCode, //!< The opcode
|
||||||
FwOpcodeType opCode, //!< The opcode
|
U32 cmdSeq, //!< The command sequence number
|
||||||
U32 cmdSeq, //!< The command sequence number
|
FormalParamEnum en //!< An enum
|
||||||
FormalParamEnum en //!< An enum
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for command CMD_ARRAY
|
//! Handler implementation for command CMD_ARRAY
|
||||||
void CMD_ARRAY_cmdHandler(
|
void CMD_ARRAY_cmdHandler(FwOpcodeType opCode, //!< The opcode
|
||||||
FwOpcodeType opCode, //!< The opcode
|
U32 cmdSeq, //!< The command sequence number
|
||||||
U32 cmdSeq, //!< The command sequence number
|
FormalParamArray arr //!< An array
|
||||||
FormalParamArray arr //!< An array
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for command CMD_STRUCT
|
//! Handler implementation for command CMD_STRUCT
|
||||||
void CMD_STRUCT_cmdHandler(
|
void CMD_STRUCT_cmdHandler(FwOpcodeType opCode, //!< The opcode
|
||||||
FwOpcodeType opCode, //!< The opcode
|
U32 cmdSeq, //!< The command sequence number
|
||||||
U32 cmdSeq, //!< The command sequence number
|
FormalParamStruct str //!< A struct
|
||||||
FormalParamStruct str //!< A struct
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for command CMD_ASYNC_NO_ARGS
|
//! Handler implementation for command CMD_ASYNC_NO_ARGS
|
||||||
void CMD_ASYNC_NO_ARGS_cmdHandler(
|
void CMD_ASYNC_NO_ARGS_cmdHandler(FwOpcodeType opCode, //!< The opcode
|
||||||
FwOpcodeType opCode, //!< The opcode
|
U32 cmdSeq //!< The command sequence number
|
||||||
U32 cmdSeq //!< The command sequence number
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for command CMD_ASYNC_PRIMITIVE
|
//! Handler implementation for command CMD_ASYNC_PRIMITIVE
|
||||||
void CMD_ASYNC_PRIMITIVE_cmdHandler(
|
void CMD_ASYNC_PRIMITIVE_cmdHandler(FwOpcodeType opCode, //!< The opcode
|
||||||
FwOpcodeType opCode, //!< The opcode
|
U32 cmdSeq, //!< The command sequence number
|
||||||
U32 cmdSeq, //!< The command sequence number
|
U32 u32_1, //!< A U32
|
||||||
U32 u32_1, //!< A U32
|
U32 u32_2, //!< A U32
|
||||||
U32 u32_2, //!< A U32
|
F32 f32_1, //!< An F32
|
||||||
F32 f32_1, //!< An F32
|
F32 f32_2, //!< An F32
|
||||||
F32 f32_2, //!< An F32
|
bool b1, //!< A boolean
|
||||||
bool b1, //!< A boolean
|
bool b2 //!< A boolean
|
||||||
bool b2 //!< A boolean
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for command CMD_ASYNC_STRINGS
|
//! Handler implementation for command CMD_ASYNC_STRINGS
|
||||||
void CMD_ASYNC_STRINGS_cmdHandler(
|
void CMD_ASYNC_STRINGS_cmdHandler(FwOpcodeType opCode, //!< The opcode
|
||||||
FwOpcodeType opCode, //!< The opcode
|
U32 cmdSeq, //!< The command sequence number
|
||||||
U32 cmdSeq, //!< The command sequence number
|
const Fw::CmdStringArg& str1, //!< A string
|
||||||
const Fw::CmdStringArg& str1, //!< A string
|
const Fw::CmdStringArg& str2 //!< Another string
|
||||||
const Fw::CmdStringArg& str2 //!< Another string
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for command CMD_ASYNC_ENUM
|
//! Handler implementation for command CMD_ASYNC_ENUM
|
||||||
void CMD_ASYNC_ENUM_cmdHandler(
|
void CMD_ASYNC_ENUM_cmdHandler(FwOpcodeType opCode, //!< The opcode
|
||||||
FwOpcodeType opCode, //!< The opcode
|
U32 cmdSeq, //!< The command sequence number
|
||||||
U32 cmdSeq, //!< The command sequence number
|
FormalParamEnum en //!< An enum
|
||||||
FormalParamEnum en //!< An enum
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for command CMD_ASYNC_ARRAY
|
//! Handler implementation for command CMD_ASYNC_ARRAY
|
||||||
void CMD_ASYNC_ARRAY_cmdHandler(
|
void CMD_ASYNC_ARRAY_cmdHandler(FwOpcodeType opCode, //!< The opcode
|
||||||
FwOpcodeType opCode, //!< The opcode
|
U32 cmdSeq, //!< The command sequence number
|
||||||
U32 cmdSeq, //!< The command sequence number
|
FormalParamArray arr //!< An array
|
||||||
FormalParamArray arr //!< An array
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for command CMD_ASYNC_STRUCT
|
//! Handler implementation for command CMD_ASYNC_STRUCT
|
||||||
void CMD_ASYNC_STRUCT_cmdHandler(
|
void CMD_ASYNC_STRUCT_cmdHandler(FwOpcodeType opCode, //!< The opcode
|
||||||
FwOpcodeType opCode, //!< The opcode
|
U32 cmdSeq, //!< The command sequence number
|
||||||
U32 cmdSeq, //!< The command sequence number
|
FormalParamStruct str //!< A struct
|
||||||
FormalParamStruct str //!< A struct
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Handler implementations for user-defined internal interfaces
|
// Handler implementations for user-defined internal interfaces
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
//! Handler implementation for internalArray
|
//! Handler implementation for internalArray
|
||||||
void internalArray_internalInterfaceHandler(
|
void internalArray_internalInterfaceHandler(const FormalParamArray& arr //!< An array
|
||||||
const FormalParamArray& arr //!< An array
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for internalEnum
|
//! Handler implementation for internalEnum
|
||||||
void internalEnum_internalInterfaceHandler(
|
void internalEnum_internalInterfaceHandler(const FormalParamEnum& en //!< An enum
|
||||||
const FormalParamEnum& en //!< An enum
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for internalNoArgs
|
//! Handler implementation for internalNoArgs
|
||||||
void internalNoArgs_internalInterfaceHandler() override;
|
void internalNoArgs_internalInterfaceHandler() override;
|
||||||
|
|
||||||
//! Handler implementation for internalPrimitive
|
//! Handler implementation for internalPrimitive
|
||||||
void internalPrimitive_internalInterfaceHandler(
|
void internalPrimitive_internalInterfaceHandler(U32 u32_1, //!< A U32
|
||||||
U32 u32_1, //!< A U32
|
U32 u32_2, //!< A U32
|
||||||
U32 u32_2, //!< A U32
|
F32 f32_1, //!< An F32
|
||||||
F32 f32_1, //!< An F32
|
F32 f32_2, //!< An F32
|
||||||
F32 f32_2, //!< An F32
|
bool b1, //!< A boolean
|
||||||
bool b1, //!< A boolean
|
bool b2 //!< A boolean
|
||||||
bool b2 //!< A boolean
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for internalString
|
//! Handler implementation for internalString
|
||||||
void internalString_internalInterfaceHandler(
|
void internalString_internalInterfaceHandler(const Fw::InternalInterfaceString& str1, //!< A string
|
||||||
const Fw::InternalInterfaceString& str1, //!< A string
|
const Fw::InternalInterfaceString& str2 //!< Another string
|
||||||
const Fw::InternalInterfaceString& str2 //!< Another string
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for internalStruct
|
//! Handler implementation for internalStruct
|
||||||
void internalStruct_internalInterfaceHandler(
|
void internalStruct_internalInterfaceHandler(const FormalParamStruct& str //!< A struct
|
||||||
const FormalParamStruct& str //!< A struct
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Overflow hook implementations for user-defined async ports interfaces
|
// Overflow hook implementations for user-defined async ports interfaces
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
//! Overflow hook implementation for enumArgsOverflow
|
//! Overflow hook implementation for enumArgsOverflow
|
||||||
void enumArgsHook_overflowHook(
|
void enumArgsHook_overflowHook(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamEnum& en, //!< An enum
|
||||||
const FormalParamEnum& en, //!< An enum
|
FormalParamEnum& enRef, //!< An enum ref
|
||||||
FormalParamEnum& enRef, //!< An enum ref
|
const FormalAliasEnum& enA, //!< An enum alias
|
||||||
const FormalAliasEnum& enA, //!< An enum alias
|
FormalAliasEnum& enARef //!< An enum alias ref
|
||||||
FormalAliasEnum& enARef //!< An enum alias ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Enables checking the serialization status of serial port invocations
|
//! Enables checking the serialization status of serial port invocations
|
||||||
Fw::SerializeStatus serializeStatus;
|
Fw::SerializeStatus serializeStatus;
|
||||||
|
|
||||||
@ -250,8 +214,6 @@ class ActiveTest :
|
|||||||
FppTest::Types::EnumParam enumInterface;
|
FppTest::Types::EnumParam enumInterface;
|
||||||
FppTest::Types::ArrayParam arrayInterface;
|
FppTest::Types::ArrayParam arrayInterface;
|
||||||
FppTest::Types::StructParam structInterface;
|
FppTest::Types::StructParam structInterface;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -20,14 +20,16 @@ ActiveTestTester ::ActiveTestTester()
|
|||||||
arrayBuf(arrayData, sizeof(arrayData)),
|
arrayBuf(arrayData, sizeof(arrayData)),
|
||||||
structBuf(structData, sizeof(structData)),
|
structBuf(structData, sizeof(structData)),
|
||||||
serialBuf(serialData, sizeof(serialData)),
|
serialBuf(serialData, sizeof(serialData)),
|
||||||
time(STest::Pick::any(), STest::Pick::any()) {
|
time(STest::Pick::any(), STest::Pick::lowerUpper(0, 999999)) {
|
||||||
this->initComponents();
|
this->initComponents();
|
||||||
this->connectPorts();
|
this->connectPorts();
|
||||||
this->connectAsyncPorts();
|
this->connectAsyncPorts();
|
||||||
this->component.registerExternalParameters(&this->paramTesterDelegate);
|
this->component.registerExternalParameters(&this->paramTesterDelegate);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActiveTestTester ::~ActiveTestTester() {}
|
ActiveTestTester ::~ActiveTestTester() {
|
||||||
|
this->component.deinit();
|
||||||
|
}
|
||||||
|
|
||||||
void ActiveTestTester ::initComponents() {
|
void ActiveTestTester ::initComponents() {
|
||||||
this->init();
|
this->init();
|
||||||
@ -46,32 +48,32 @@ Fw::ParamValid ActiveTestTester ::from_prmGetIn_handler(const FwIndexType portNu
|
|||||||
|
|
||||||
switch (id - id_base) {
|
switch (id - id_base) {
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMBOOL:
|
case ActiveTestComponentBase::PARAMID_PARAMBOOL:
|
||||||
status = val.serialize(boolPrm.args.val);
|
status = val.serializeFrom(boolPrm.args.val);
|
||||||
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMU32:
|
case ActiveTestComponentBase::PARAMID_PARAMU32:
|
||||||
status = val.serialize(u32Prm.args.val);
|
status = val.serializeFrom(u32Prm.args.val);
|
||||||
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMSTRING:
|
case ActiveTestComponentBase::PARAMID_PARAMSTRING:
|
||||||
status = val.serialize(stringPrm.args.val);
|
status = val.serializeFrom(stringPrm.args.val);
|
||||||
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMENUM:
|
case ActiveTestComponentBase::PARAMID_PARAMENUM:
|
||||||
status = val.serialize(enumPrm.args.val);
|
status = val.serializeFrom(enumPrm.args.val);
|
||||||
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMARRAY:
|
case ActiveTestComponentBase::PARAMID_PARAMARRAY:
|
||||||
status = val.serialize(arrayPrm.args.val);
|
status = val.serializeFrom(arrayPrm.args.val);
|
||||||
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMSTRUCT:
|
case ActiveTestComponentBase::PARAMID_PARAMSTRUCT:
|
||||||
status = val.serialize(structPrm.args.val);
|
status = val.serializeFrom(structPrm.args.val);
|
||||||
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -89,32 +91,32 @@ void ActiveTestTester ::from_prmSetIn_handler(const FwIndexType portNum, FwPrmId
|
|||||||
|
|
||||||
switch (id - id_base) {
|
switch (id - id_base) {
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMBOOL:
|
case ActiveTestComponentBase::PARAMID_PARAMBOOL:
|
||||||
status = val.deserialize(boolPrm.args.val);
|
status = val.deserializeTo(boolPrm.args.val);
|
||||||
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMU32:
|
case ActiveTestComponentBase::PARAMID_PARAMU32:
|
||||||
status = val.deserialize(u32Prm.args.val);
|
status = val.deserializeTo(u32Prm.args.val);
|
||||||
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMSTRING:
|
case ActiveTestComponentBase::PARAMID_PARAMSTRING:
|
||||||
status = val.deserialize(stringPrm.args.val);
|
status = val.deserializeTo(stringPrm.args.val);
|
||||||
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMENUM:
|
case ActiveTestComponentBase::PARAMID_PARAMENUM:
|
||||||
status = val.deserialize(enumPrm.args.val);
|
status = val.deserializeTo(enumPrm.args.val);
|
||||||
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMARRAY:
|
case ActiveTestComponentBase::PARAMID_PARAMARRAY:
|
||||||
status = val.deserialize(arrayPrm.args.val);
|
status = val.deserializeTo(arrayPrm.args.val);
|
||||||
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMSTRUCT:
|
case ActiveTestComponentBase::PARAMID_PARAMSTRUCT:
|
||||||
status = val.deserialize(structPrm.args.val);
|
status = val.deserializeTo(structPrm.args.val);
|
||||||
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
FW_ASSERT(status == Fw::FW_SERIALIZE_OK);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -130,7 +132,7 @@ Fw::SerializeStatus ActiveTestTester::ActiveTestComponentBaseParamExternalDelega
|
|||||||
const FwPrmIdType base_id,
|
const FwPrmIdType base_id,
|
||||||
const FwPrmIdType local_id,
|
const FwPrmIdType local_id,
|
||||||
const Fw::ParamValid prmStat,
|
const Fw::ParamValid prmStat,
|
||||||
Fw::SerializeBufferBase& buff) {
|
Fw::SerialBufferBase& buff) {
|
||||||
Fw::SerializeStatus stat;
|
Fw::SerializeStatus stat;
|
||||||
(void)base_id;
|
(void)base_id;
|
||||||
|
|
||||||
@ -138,27 +140,27 @@ Fw::SerializeStatus ActiveTestTester::ActiveTestComponentBaseParamExternalDelega
|
|||||||
switch (local_id) {
|
switch (local_id) {
|
||||||
// ParamBoolExternal
|
// ParamBoolExternal
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMBOOLEXTERNAL:
|
case ActiveTestComponentBase::PARAMID_PARAMBOOLEXTERNAL:
|
||||||
stat = buff.deserialize(this->m_param_ParamBoolExternal);
|
stat = buff.deserializeTo(this->m_param_ParamBoolExternal);
|
||||||
break;
|
break;
|
||||||
// ParamI32External
|
// ParamI32External
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMI32EXTERNAL:
|
case ActiveTestComponentBase::PARAMID_PARAMI32EXTERNAL:
|
||||||
stat = buff.deserialize(this->m_param_ParamI32External);
|
stat = buff.deserializeTo(this->m_param_ParamI32External);
|
||||||
break;
|
break;
|
||||||
// ParamStringExternal
|
// ParamStringExternal
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMSTRINGEXTERNAL:
|
case ActiveTestComponentBase::PARAMID_PARAMSTRINGEXTERNAL:
|
||||||
stat = buff.deserialize(this->m_param_ParamStringExternal);
|
stat = buff.deserializeTo(this->m_param_ParamStringExternal);
|
||||||
break;
|
break;
|
||||||
// ParamEnumExternal
|
// ParamEnumExternal
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMENUMEXTERNAL:
|
case ActiveTestComponentBase::PARAMID_PARAMENUMEXTERNAL:
|
||||||
stat = buff.deserialize(this->m_param_ParamEnumExternal);
|
stat = buff.deserializeTo(this->m_param_ParamEnumExternal);
|
||||||
break;
|
break;
|
||||||
// ParamArrayExternal
|
// ParamArrayExternal
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMARRAYEXTERNAL:
|
case ActiveTestComponentBase::PARAMID_PARAMARRAYEXTERNAL:
|
||||||
stat = buff.deserialize(this->m_param_ParamArrayExternal);
|
stat = buff.deserializeTo(this->m_param_ParamArrayExternal);
|
||||||
break;
|
break;
|
||||||
// ParamStructExternal
|
// ParamStructExternal
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMSTRUCTEXTERNAL:
|
case ActiveTestComponentBase::PARAMID_PARAMSTRUCTEXTERNAL:
|
||||||
stat = buff.deserialize(this->m_param_ParamStructExternal);
|
stat = buff.deserializeTo(this->m_param_ParamStructExternal);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Unknown ID should not have gotten here
|
// Unknown ID should not have gotten here
|
||||||
@ -171,7 +173,7 @@ Fw::SerializeStatus ActiveTestTester::ActiveTestComponentBaseParamExternalDelega
|
|||||||
Fw::SerializeStatus ActiveTestTester::ActiveTestComponentBaseParamExternalDelegate ::serializeParam(
|
Fw::SerializeStatus ActiveTestTester::ActiveTestComponentBaseParamExternalDelegate ::serializeParam(
|
||||||
const FwPrmIdType base_id,
|
const FwPrmIdType base_id,
|
||||||
const FwPrmIdType local_id,
|
const FwPrmIdType local_id,
|
||||||
Fw::SerializeBufferBase& buff) const {
|
Fw::SerialBufferBase& buff) const {
|
||||||
Fw::SerializeStatus stat;
|
Fw::SerializeStatus stat;
|
||||||
(void)base_id;
|
(void)base_id;
|
||||||
|
|
||||||
@ -179,27 +181,27 @@ Fw::SerializeStatus ActiveTestTester::ActiveTestComponentBaseParamExternalDelega
|
|||||||
switch (local_id) {
|
switch (local_id) {
|
||||||
// ParamBoolExternal
|
// ParamBoolExternal
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMBOOLEXTERNAL:
|
case ActiveTestComponentBase::PARAMID_PARAMBOOLEXTERNAL:
|
||||||
stat = buff.serialize(this->m_param_ParamBoolExternal);
|
stat = buff.serializeFrom(this->m_param_ParamBoolExternal);
|
||||||
break;
|
break;
|
||||||
// ParamI32External
|
// ParamI32External
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMI32EXTERNAL:
|
case ActiveTestComponentBase::PARAMID_PARAMI32EXTERNAL:
|
||||||
stat = buff.serialize(this->m_param_ParamI32External);
|
stat = buff.serializeFrom(this->m_param_ParamI32External);
|
||||||
break;
|
break;
|
||||||
// ParamStringExternal
|
// ParamStringExternal
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMSTRINGEXTERNAL:
|
case ActiveTestComponentBase::PARAMID_PARAMSTRINGEXTERNAL:
|
||||||
stat = buff.serialize(this->m_param_ParamStringExternal);
|
stat = buff.serializeFrom(this->m_param_ParamStringExternal);
|
||||||
break;
|
break;
|
||||||
// ParamEnumExternal
|
// ParamEnumExternal
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMENUMEXTERNAL:
|
case ActiveTestComponentBase::PARAMID_PARAMENUMEXTERNAL:
|
||||||
stat = buff.serialize(this->m_param_ParamEnumExternal);
|
stat = buff.serializeFrom(this->m_param_ParamEnumExternal);
|
||||||
break;
|
break;
|
||||||
// ParamArrayExternal
|
// ParamArrayExternal
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMARRAYEXTERNAL:
|
case ActiveTestComponentBase::PARAMID_PARAMARRAYEXTERNAL:
|
||||||
stat = buff.serialize(this->m_param_ParamArrayExternal);
|
stat = buff.serializeFrom(this->m_param_ParamArrayExternal);
|
||||||
break;
|
break;
|
||||||
// ParamStructExternal
|
// ParamStructExternal
|
||||||
case ActiveTestComponentBase::PARAMID_PARAMSTRUCTEXTERNAL:
|
case ActiveTestComponentBase::PARAMID_PARAMSTRUCTEXTERNAL:
|
||||||
stat = buff.serialize(this->m_param_ParamStructExternal);
|
stat = buff.serializeFrom(this->m_param_ParamStructExternal);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Unknown ID should not have gotten here
|
// Unknown ID should not have gotten here
|
||||||
|
|||||||
@ -82,8 +82,8 @@ class ActiveTestTester : public ActiveTestGTestBase {
|
|||||||
|
|
||||||
//! Handler for from_serialOut
|
//! Handler for from_serialOut
|
||||||
//!
|
//!
|
||||||
void from_serialOut_handler(FwIndexType portNum, //!< The port number
|
void from_serialOut_handler(FwIndexType portNum, //!< The port number
|
||||||
Fw::SerializeBufferBase& Buffer //!< The serialization buffer
|
Fw::LinearBufferBase& Buffer //!< The serialization buffer
|
||||||
) final;
|
) final;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -226,14 +226,13 @@ class ActiveTestTester : public ActiveTestGTestBase {
|
|||||||
const FwPrmIdType base_id, //!< The component base parameter ID to deserialize
|
const FwPrmIdType base_id, //!< The component base parameter ID to deserialize
|
||||||
const FwPrmIdType local_id, //!< The parameter local ID to deserialize
|
const FwPrmIdType local_id, //!< The parameter local ID to deserialize
|
||||||
const Fw::ParamValid prmStat, //!< The parameter validity status
|
const Fw::ParamValid prmStat, //!< The parameter validity status
|
||||||
Fw::SerializeBufferBase& buff //!< The buffer containing the parameter to deserialize
|
Fw::SerialBufferBase& buff //!< The buffer containing the parameter to deserialize
|
||||||
) override;
|
) override;
|
||||||
|
|
||||||
//! Parameter serialization function for external parameter unit testing
|
//! Parameter serialization function for external parameter unit testing
|
||||||
Fw::SerializeStatus serializeParam(
|
Fw::SerializeStatus serializeParam(const FwPrmIdType base_id, //!< The component base parameter ID to serialize
|
||||||
const FwPrmIdType base_id, //!< The component base parameter ID to serialize
|
const FwPrmIdType local_id, //!< The parameter local ID to serialize
|
||||||
const FwPrmIdType local_id, //!< The parameter local ID to serialize
|
Fw::SerialBufferBase& buff //!< The buffer to serialize the parameter into
|
||||||
Fw::SerializeBufferBase& buff //!< The buffer to serialize the parameter into
|
|
||||||
) const override;
|
) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -4,140 +4,124 @@
|
|||||||
|
|
||||||
//! Handler for from_arrayArgsOut
|
//! Handler for from_arrayArgsOut
|
||||||
//!
|
//!
|
||||||
void from_arrayArgsOut_handler(
|
void from_arrayArgsOut_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamArray& a, //!< An array
|
||||||
const FormalParamArray& a, //!< An array
|
FormalParamArray& aRef, //!< An array ref
|
||||||
FormalParamArray& aRef, //!< An array ref
|
const FormalAliasArray& b, //!< alias of an array
|
||||||
const FormalAliasArray& b, //!< alias of an array
|
FormalAliasArray& bRef, //!< alias of array ref
|
||||||
FormalAliasArray& bRef, //!< alias of array ref
|
const FormalAliasStringArray& c, //!< array of string aliases
|
||||||
const FormalAliasStringArray& c, //!< array of string aliases
|
FormalAliasStringArray& cRef //!< array of string aliases ref
|
||||||
FormalAliasStringArray& cRef //!< array of string aliases ref
|
) final;
|
||||||
) final;
|
|
||||||
|
|
||||||
//! Handler for from_arrayReturnOut
|
//! Handler for from_arrayReturnOut
|
||||||
//!
|
//!
|
||||||
FormalParamArray from_arrayReturnOut_handler(
|
FormalParamArray from_arrayReturnOut_handler(const FwIndexType portNum, //!< The port number
|
||||||
const FwIndexType portNum, //!< The port number
|
const FormalParamArray& a, //!< An array
|
||||||
const FormalParamArray& a, //!< An array
|
FormalParamArray& aRef //!< An array ref
|
||||||
FormalParamArray& aRef //!< An array ref
|
) final;
|
||||||
) final;
|
|
||||||
|
|
||||||
//! Handler for from_enumArgsOut
|
//! Handler for from_enumArgsOut
|
||||||
//!
|
//!
|
||||||
void from_enumArgsOut_handler(
|
void from_enumArgsOut_handler(const FwIndexType portNum, //!< The port number
|
||||||
const FwIndexType portNum, //!< The port number
|
const FormalParamEnum& en, //!< An enum
|
||||||
const FormalParamEnum& en, //!< An enum
|
FormalParamEnum& enRef, //!< An enum ref
|
||||||
FormalParamEnum& enRef, //!< An enum ref
|
const FormalAliasEnum& enA, //!< An enum alias
|
||||||
const FormalAliasEnum& enA, //!< An enum alias
|
FormalAliasEnum& enARef //!< An enum alias ref
|
||||||
FormalAliasEnum& enARef //!< An enum alias ref
|
) final;
|
||||||
) final;
|
|
||||||
|
|
||||||
//! Handler for from_enumReturnOut
|
//! Handler for from_enumReturnOut
|
||||||
//!
|
//!
|
||||||
FormalParamEnum from_enumReturnOut_handler(
|
FormalParamEnum from_enumReturnOut_handler(const FwIndexType portNum, //!< The port number
|
||||||
const FwIndexType portNum, //!< The port number
|
const FormalParamEnum& en, //!< An enum
|
||||||
const FormalParamEnum& en, //!<An enum
|
FormalParamEnum& enRef //!< An enum ref
|
||||||
FormalParamEnum& enRef //!< An enum ref
|
) final;
|
||||||
) final;
|
|
||||||
|
|
||||||
//! Handler base-class function for from_arrayStringAliasReturnOut
|
//! Handler base-class function for from_arrayStringAliasReturnOut
|
||||||
FormalAliasStringArray from_arrayStringAliasReturnOut_handler(
|
FormalAliasStringArray from_arrayStringAliasReturnOut_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamArray& a, //!< An array
|
||||||
const FormalParamArray& a, //!< An array
|
FormalParamArray& aRef //!< An array ref
|
||||||
FormalParamArray& aRef //!< An array ref
|
) final;
|
||||||
) final;
|
|
||||||
|
|
||||||
//! Handler base-class function for from_arrayStringAliasReturnOut
|
//! Handler base-class function for from_arrayStringAliasReturnOut
|
||||||
FormalAliasString from_stringAliasReturnOut_handler(
|
FormalAliasString from_stringAliasReturnOut_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const Fw::StringBase& str, //!< A string
|
||||||
const Fw::StringBase& str, //!< A string
|
Fw::StringBase& strRef //!< A string ref
|
||||||
Fw::StringBase& strRef //!< A string ref
|
) final;
|
||||||
) final;
|
|
||||||
|
|
||||||
//! Handler for from_stringArgsOut
|
//! Handler for from_stringArgsOut
|
||||||
//!
|
//!
|
||||||
void from_stringArgsOut_handler(
|
void from_stringArgsOut_handler(const FwIndexType portNum,
|
||||||
const FwIndexType portNum,
|
const Fw::StringBase& str80,
|
||||||
const Fw::StringBase &str80,
|
Fw::StringBase& str80Ref,
|
||||||
Fw::StringBase &str80Ref,
|
const Fw::StringBase& str100,
|
||||||
const Fw::StringBase &str100,
|
Fw::StringBase& str100Ref) final;
|
||||||
Fw::StringBase &str100Ref
|
|
||||||
) final;
|
|
||||||
|
|
||||||
//! Handler for from_stringReturnOut
|
//! Handler for from_stringReturnOut
|
||||||
//!
|
//!
|
||||||
Fw::String from_stringReturnOut_handler(
|
Fw::String from_stringReturnOut_handler(const FwIndexType portNum,
|
||||||
const FwIndexType portNum,
|
const Fw::StringBase& str,
|
||||||
const Fw::StringBase &str,
|
Fw::StringBase& strRef) final;
|
||||||
Fw::StringBase &strRef
|
|
||||||
) final;
|
|
||||||
|
|
||||||
//! Handler for from_noArgsOut
|
//! Handler for from_noArgsOut
|
||||||
//!
|
//!
|
||||||
void from_noArgsOut_handler(
|
void from_noArgsOut_handler(const FwIndexType portNum //!< The port number
|
||||||
const FwIndexType portNum //!< The port number
|
) final;
|
||||||
) final;
|
|
||||||
|
|
||||||
//! Handler for from_noArgsReturnOut
|
//! Handler for from_noArgsReturnOut
|
||||||
//!
|
//!
|
||||||
bool from_noArgsReturnOut_handler(
|
bool from_noArgsReturnOut_handler(const FwIndexType portNum //!< The port number
|
||||||
const FwIndexType portNum //!< The port number
|
) final;
|
||||||
) final;
|
|
||||||
|
|
||||||
//! Handler for from_primitiveArgsOut
|
//! Handler for from_primitiveArgsOut
|
||||||
//!
|
//!
|
||||||
void from_primitiveArgsOut_handler(const FwIndexType portNum, //!< The port number
|
void from_primitiveArgsOut_handler(const FwIndexType portNum, //!< The port number
|
||||||
U32 u32,
|
U32 u32,
|
||||||
U32& u32Ref,
|
U32& u32Ref,
|
||||||
F32 f32,
|
F32 f32,
|
||||||
F32& f32Ref,
|
F32& f32Ref,
|
||||||
bool b,
|
bool b,
|
||||||
bool& bRef
|
bool& bRef) final;
|
||||||
) final;
|
|
||||||
|
|
||||||
//! Handler for from_primitiveReturnOut
|
//! Handler for from_primitiveReturnOut
|
||||||
//!
|
//!
|
||||||
U32 from_primitiveReturnOut_handler(const FwIndexType portNum, //!< The port number
|
U32 from_primitiveReturnOut_handler(const FwIndexType portNum, //!< The port number
|
||||||
U32 u32,
|
U32 u32,
|
||||||
U32& u32Ref,
|
U32& u32Ref,
|
||||||
F32 f32,
|
F32 f32,
|
||||||
F32& f32Ref,
|
F32& f32Ref,
|
||||||
bool b,
|
bool b,
|
||||||
bool& bRef
|
bool& bRef) final;
|
||||||
) final;
|
|
||||||
|
|
||||||
//! Handler for from_prmGetIn
|
//! Handler for from_prmGetIn
|
||||||
//!
|
//!
|
||||||
Fw::ParamValid from_prmGetIn_handler(const FwIndexType portNum, //!< The port number
|
Fw::ParamValid from_prmGetIn_handler(const FwIndexType portNum, //!< The port number
|
||||||
FwPrmIdType id, //!< Parameter ID
|
FwPrmIdType id, //!< Parameter ID
|
||||||
Fw::ParamBuffer& val //!< Buffer containing serialized parameter value
|
Fw::ParamBuffer& val //!< Buffer containing serialized parameter value
|
||||||
) final;
|
) final;
|
||||||
|
|
||||||
//! Handler for from_prmGetIn
|
//! Handler for from_prmGetIn
|
||||||
//!
|
//!
|
||||||
void from_prmSetIn_handler(const FwIndexType portNum, //!< The port number
|
void from_prmSetIn_handler(const FwIndexType portNum, //!< The port number
|
||||||
FwPrmIdType id, //!< Parameter ID
|
FwPrmIdType id, //!< Parameter ID
|
||||||
Fw::ParamBuffer& val //!< Buffer containing serialized parameter value
|
Fw::ParamBuffer& val //!< Buffer containing serialized parameter value
|
||||||
) final;
|
) final;
|
||||||
|
|
||||||
//! Handler for from_structArgsOut
|
//! Handler for from_structArgsOut
|
||||||
//!
|
//!
|
||||||
void from_structArgsOut_handler(const FwIndexType portNum, //!< The port number
|
void from_structArgsOut_handler(const FwIndexType portNum, //!< The port number
|
||||||
const FormalParamStruct& s, //!< A struct
|
const FormalParamStruct& s, //!< A struct
|
||||||
FormalParamStruct& sRef //!< A struct ref
|
FormalParamStruct& sRef //!< A struct ref
|
||||||
) final;
|
) final;
|
||||||
|
|
||||||
//! Handler for from_structReturnOut
|
//! Handler for from_structReturnOut
|
||||||
//!
|
//!
|
||||||
FormalParamStruct from_structReturnOut_handler(const FwIndexType portNum, //!< The port number
|
FormalParamStruct from_structReturnOut_handler(const FwIndexType portNum, //!< The port number
|
||||||
const FormalParamStruct& s, //!< A struct
|
const FormalParamStruct& s, //!< A struct
|
||||||
FormalParamStruct& sRef //!< A struct ref
|
FormalParamStruct& sRef //!< A struct ref
|
||||||
) final;
|
) final;
|
||||||
|
|
||||||
void from_enumArgsHookOverflowed_handler(const FwIndexType portNum,
|
void from_enumArgsHookOverflowed_handler(const FwIndexType portNum,
|
||||||
const FormalParamEnum& en,
|
const FormalParamEnum& en,
|
||||||
FormalParamEnum& enRef,
|
FormalParamEnum& enRef,
|
||||||
const FormalAliasEnum& enA,
|
const FormalAliasEnum& enA,
|
||||||
FormalAliasEnum& enARef
|
FormalAliasEnum& enARef);
|
||||||
);
|
|
||||||
|
|
||||||
|
|||||||
@ -6,341 +6,194 @@
|
|||||||
// Handler implementations for user-defined typed input ports
|
// Handler implementations for user-defined typed input ports
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
Fw::String TestComponentName ::stringReturnGuarded_handler(
|
Fw::String TestComponentName ::stringReturnGuarded_handler(FwIndexType portNum,
|
||||||
FwIndexType portNum,
|
const Fw::StringBase& str,
|
||||||
const Fw::StringBase& str,
|
Fw::StringBase& strRef) {
|
||||||
Fw::StringBase& strRef
|
return this->stringReturnOut_out(portNum, str, strRef);
|
||||||
) {
|
|
||||||
return this->stringReturnOut_out(portNum, str, strRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestComponentName :: enumArgsSync_handler(
|
void TestComponentName ::enumArgsSync_handler(const FwIndexType portNum,
|
||||||
const FwIndexType portNum,
|
const FormalParamEnum& en,
|
||||||
const FormalParamEnum &en,
|
FormalParamEnum& enRef,
|
||||||
FormalParamEnum &enRef,
|
const FormalAliasEnum& enA,
|
||||||
const FormalAliasEnum& enA,
|
FormalAliasEnum& enARef) {
|
||||||
FormalAliasEnum& enARef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->enumArgsOut_out(portNum, en, enRef, enA, enARef);
|
this->enumArgsOut_out(portNum, en, enRef, enA, enARef);
|
||||||
}
|
}
|
||||||
|
|
||||||
Fw::String TestComponentName ::stringReturnSync_handler(
|
Fw::String TestComponentName ::stringReturnSync_handler(FwIndexType portNum,
|
||||||
FwIndexType portNum,
|
const Fw::StringBase& str,
|
||||||
const Fw::StringBase& str,
|
Fw::StringBase& strRef) {
|
||||||
Fw::StringBase& strRef
|
return this->stringReturnOut_out(portNum, str, strRef);
|
||||||
) {
|
|
||||||
return this->stringReturnOut_out(portNum, str, strRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FormalAliasString TestComponentName ::stringAliasReturnGuarded_handler(
|
FormalAliasString TestComponentName ::stringAliasReturnGuarded_handler(FwIndexType portNum,
|
||||||
FwIndexType portNum,
|
const Fw::StringBase& str,
|
||||||
const Fw::StringBase& str,
|
Fw::StringBase& strRef) {
|
||||||
Fw::StringBase& strRef
|
return this->stringAliasReturnOut_out(portNum, str, strRef);
|
||||||
) {
|
|
||||||
return this->stringAliasReturnOut_out(portNum, str, strRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FormalAliasString TestComponentName ::stringAliasReturnSync_handler(
|
FormalAliasString TestComponentName ::stringAliasReturnSync_handler(FwIndexType portNum,
|
||||||
FwIndexType portNum,
|
const Fw::StringBase& str,
|
||||||
const Fw::StringBase& str,
|
Fw::StringBase& strRef) {
|
||||||
Fw::StringBase& strRef
|
return this->stringAliasReturnOut_out(portNum, str, strRef);
|
||||||
) {
|
|
||||||
return this->stringAliasReturnOut_out(portNum, str, strRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestComponentName ::
|
void TestComponentName ::arrayArgsGuarded_handler(const FwIndexType portNum,
|
||||||
arrayArgsGuarded_handler(
|
const FormalParamArray& a,
|
||||||
const FwIndexType portNum,
|
FormalParamArray& aRef,
|
||||||
const FormalParamArray &a,
|
const FormalAliasArray& b,
|
||||||
FormalParamArray &aRef,
|
FormalAliasArray& bRef,
|
||||||
const FormalAliasArray& b,
|
const FormalAliasStringArray& c,
|
||||||
FormalAliasArray& bRef,
|
FormalAliasStringArray& cRef) {
|
||||||
const FormalAliasStringArray& c,
|
|
||||||
FormalAliasStringArray& cRef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->arrayArgsOut_out(portNum, a, aRef, b, bRef, c, cRef);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TestComponentName ::
|
|
||||||
arrayArgsSync_handler(
|
|
||||||
const FwIndexType portNum,
|
|
||||||
const FormalParamArray &a,
|
|
||||||
FormalParamArray &aRef,
|
|
||||||
const FormalAliasArray& b,
|
|
||||||
FormalAliasArray& bRef,
|
|
||||||
const FormalAliasStringArray& c,
|
|
||||||
FormalAliasStringArray& cRef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->arrayArgsOut_out(portNum, a, aRef, b, bRef, c, cRef);
|
this->arrayArgsOut_out(portNum, a, aRef, b, bRef, c, cRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
FormalParamArray TestComponentName ::
|
void TestComponentName ::arrayArgsSync_handler(const FwIndexType portNum,
|
||||||
arrayReturnGuarded_handler(
|
const FormalParamArray& a,
|
||||||
const FwIndexType portNum,
|
FormalParamArray& aRef,
|
||||||
const FormalParamArray &a,
|
const FormalAliasArray& b,
|
||||||
FormalParamArray &aRef
|
FormalAliasArray& bRef,
|
||||||
)
|
const FormalAliasStringArray& c,
|
||||||
{
|
FormalAliasStringArray& cRef) {
|
||||||
|
this->arrayArgsOut_out(portNum, a, aRef, b, bRef, c, cRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
FormalParamArray TestComponentName ::arrayReturnGuarded_handler(const FwIndexType portNum,
|
||||||
|
const FormalParamArray& a,
|
||||||
|
FormalParamArray& aRef) {
|
||||||
return this->arrayReturnOut_out(portNum, a, aRef);
|
return this->arrayReturnOut_out(portNum, a, aRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
FormalParamArray TestComponentName ::
|
FormalParamArray TestComponentName ::arrayReturnSync_handler(const FwIndexType portNum,
|
||||||
arrayReturnSync_handler(
|
const FormalParamArray& a,
|
||||||
const FwIndexType portNum,
|
FormalParamArray& aRef) {
|
||||||
const FormalParamArray &a,
|
|
||||||
FormalParamArray &aRef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return this->arrayReturnOut_out(portNum, a, aRef);
|
return this->arrayReturnOut_out(portNum, a, aRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
FormalAliasStringArray TestComponentName ::
|
FormalAliasStringArray TestComponentName ::arrayStringAliasReturnGuarded_handler(const FwIndexType portNum,
|
||||||
arrayStringAliasReturnGuarded_handler(
|
const FormalParamArray& a,
|
||||||
const FwIndexType portNum,
|
FormalParamArray& aRef) {
|
||||||
const FormalParamArray& a,
|
|
||||||
FormalParamArray& aRef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return this->arrayStringAliasReturnOut_out(portNum, a, aRef);
|
return this->arrayStringAliasReturnOut_out(portNum, a, aRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
FormalAliasStringArray TestComponentName ::
|
FormalAliasStringArray TestComponentName ::arrayStringAliasReturnSync_handler(const FwIndexType portNum,
|
||||||
arrayStringAliasReturnSync_handler(
|
const FormalParamArray& a,
|
||||||
const FwIndexType portNum,
|
FormalParamArray& aRef) {
|
||||||
const FormalParamArray& a,
|
|
||||||
FormalParamArray& aRef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return this->arrayStringAliasReturnOut_out(portNum, a, aRef);
|
return this->arrayStringAliasReturnOut_out(portNum, a, aRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestComponentName ::
|
void TestComponentName ::enumArgsGuarded_handler(const FwIndexType portNum,
|
||||||
enumArgsGuarded_handler(
|
const FormalParamEnum& en,
|
||||||
const FwIndexType portNum,
|
FormalParamEnum& enRef,
|
||||||
const FormalParamEnum &en,
|
const FormalAliasEnum& enA,
|
||||||
FormalParamEnum &enRef,
|
FormalAliasEnum& enARef) {
|
||||||
const FormalAliasEnum& enA,
|
this->enumArgsOut_out(portNum, en, enRef, enA, enARef);
|
||||||
FormalAliasEnum& enARef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->enumArgsOut_out(portNum, en, enRef, enA, enARef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FormalParamEnum TestComponentName ::
|
FormalParamEnum TestComponentName ::enumReturnGuarded_handler(const FwIndexType portNum,
|
||||||
enumReturnGuarded_handler(
|
const FormalParamEnum& en,
|
||||||
const FwIndexType portNum,
|
FormalParamEnum& enRef) {
|
||||||
const FormalParamEnum &en,
|
return this->enumReturnOut_out(portNum, en, enRef);
|
||||||
FormalParamEnum &enRef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return this->enumReturnOut_out(portNum, en, enRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FormalParamEnum TestComponentName ::
|
FormalParamEnum TestComponentName ::enumReturnSync_handler(const FwIndexType portNum,
|
||||||
enumReturnSync_handler(
|
const FormalParamEnum& en,
|
||||||
const FwIndexType portNum,
|
FormalParamEnum& enRef) {
|
||||||
const FormalParamEnum &en,
|
return this->enumReturnOut_out(portNum, en, enRef);
|
||||||
FormalParamEnum &enRef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return this->enumReturnOut_out(portNum, en, enRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestComponentName ::
|
void TestComponentName ::noArgsGuarded_handler(const FwIndexType portNum) {
|
||||||
noArgsGuarded_handler(
|
this->noArgsOut_out(portNum);
|
||||||
const FwIndexType portNum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->noArgsOut_out(portNum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TestComponentName ::
|
bool TestComponentName ::noArgsReturnGuarded_handler(const FwIndexType portNum) {
|
||||||
noArgsReturnGuarded_handler(
|
return this->noArgsReturnOut_out(portNum);
|
||||||
const FwIndexType portNum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return this->noArgsReturnOut_out(portNum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TestComponentName ::
|
bool TestComponentName ::noArgsReturnSync_handler(const FwIndexType portNum) {
|
||||||
noArgsReturnSync_handler(
|
return this->noArgsReturnOut_out(portNum);
|
||||||
const FwIndexType portNum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return this->noArgsReturnOut_out(portNum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestComponentName ::
|
void TestComponentName ::noArgsSync_handler(const FwIndexType portNum) {
|
||||||
noArgsSync_handler(
|
this->noArgsOut_out(portNum);
|
||||||
const FwIndexType portNum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->noArgsOut_out(portNum);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestComponentName ::
|
void TestComponentName ::primitiveArgsGuarded_handler(const FwIndexType portNum,
|
||||||
primitiveArgsGuarded_handler(
|
U32 u32,
|
||||||
const FwIndexType portNum,
|
U32& u32Ref,
|
||||||
U32 u32,
|
F32 f32,
|
||||||
U32 &u32Ref,
|
F32& f32Ref,
|
||||||
F32 f32,
|
bool b,
|
||||||
F32 &f32Ref,
|
bool& bRef) {
|
||||||
bool b,
|
this->primitiveArgsOut_out(portNum, u32, u32Ref, f32, f32Ref, b, bRef);
|
||||||
bool &bRef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->primitiveArgsOut_out(
|
|
||||||
portNum,
|
|
||||||
u32,
|
|
||||||
u32Ref,
|
|
||||||
f32,
|
|
||||||
f32Ref,
|
|
||||||
b,
|
|
||||||
bRef
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestComponentName ::
|
void TestComponentName ::primitiveArgsSync_handler(const FwIndexType portNum,
|
||||||
primitiveArgsSync_handler(
|
U32 u32,
|
||||||
const FwIndexType portNum,
|
U32& u32Ref,
|
||||||
U32 u32,
|
F32 f32,
|
||||||
U32 &u32Ref,
|
F32& f32Ref,
|
||||||
F32 f32,
|
bool b,
|
||||||
F32 &f32Ref,
|
bool& bRef) {
|
||||||
bool b,
|
this->primitiveArgsOut_out(portNum, u32, u32Ref, f32, f32Ref, b, bRef);
|
||||||
bool &bRef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->primitiveArgsOut_out(
|
|
||||||
portNum,
|
|
||||||
u32,
|
|
||||||
u32Ref,
|
|
||||||
f32,
|
|
||||||
f32Ref,
|
|
||||||
b,
|
|
||||||
bRef
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
U32 TestComponentName ::
|
U32 TestComponentName ::primitiveReturnGuarded_handler(const FwIndexType portNum,
|
||||||
primitiveReturnGuarded_handler(
|
U32 u32,
|
||||||
const FwIndexType portNum,
|
U32& u32Ref,
|
||||||
U32 u32,
|
F32 f32,
|
||||||
U32 &u32Ref,
|
F32& f32Ref,
|
||||||
F32 f32,
|
bool b,
|
||||||
F32 &f32Ref,
|
bool& bRef) {
|
||||||
bool b,
|
return this->primitiveReturnOut_out(portNum, u32, u32Ref, f32, f32Ref, b, bRef);
|
||||||
bool &bRef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return this->primitiveReturnOut_out(
|
|
||||||
portNum,
|
|
||||||
u32,
|
|
||||||
u32Ref,
|
|
||||||
f32,
|
|
||||||
f32Ref,
|
|
||||||
b,
|
|
||||||
bRef
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
U32 TestComponentName ::
|
U32 TestComponentName ::primitiveReturnSync_handler(const FwIndexType portNum,
|
||||||
primitiveReturnSync_handler(
|
U32 u32,
|
||||||
const FwIndexType portNum,
|
U32& u32Ref,
|
||||||
U32 u32,
|
F32 f32,
|
||||||
U32 &u32Ref,
|
F32& f32Ref,
|
||||||
F32 f32,
|
bool b,
|
||||||
F32 &f32Ref,
|
bool& bRef) {
|
||||||
bool b,
|
return this->primitiveReturnOut_out(portNum, u32, u32Ref, f32, f32Ref, b, bRef);
|
||||||
bool &bRef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return this->primitiveReturnOut_out(
|
|
||||||
portNum,
|
|
||||||
u32,
|
|
||||||
u32Ref,
|
|
||||||
f32,
|
|
||||||
f32Ref,
|
|
||||||
b,
|
|
||||||
bRef
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestComponentName ::
|
void TestComponentName ::stringArgsGuarded_handler(const FwIndexType portNum,
|
||||||
stringArgsGuarded_handler(
|
const Fw::StringBase& str80,
|
||||||
const FwIndexType portNum,
|
Fw::StringBase& str80Ref,
|
||||||
const Fw::StringBase &str80,
|
const Fw::StringBase& str100,
|
||||||
Fw::StringBase &str80Ref,
|
Fw::StringBase& str100Ref) {
|
||||||
const Fw::StringBase &str100,
|
this->stringArgsOut_out(portNum, str80, str80Ref, str100, str100Ref);
|
||||||
Fw::StringBase &str100Ref
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->stringArgsOut_out(
|
|
||||||
portNum,
|
|
||||||
str80,
|
|
||||||
str80Ref,
|
|
||||||
str100,
|
|
||||||
str100Ref
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestComponentName ::
|
void TestComponentName ::stringArgsSync_handler(const FwIndexType portNum,
|
||||||
stringArgsSync_handler(
|
const Fw::StringBase& str80,
|
||||||
const FwIndexType portNum,
|
Fw::StringBase& str80Ref,
|
||||||
const Fw::StringBase &str80,
|
const Fw::StringBase& str100,
|
||||||
Fw::StringBase &str80Ref,
|
Fw::StringBase& str100Ref) {
|
||||||
const Fw::StringBase &str100,
|
this->stringArgsOut_out(portNum, str80, str80Ref, str100, str100Ref);
|
||||||
Fw::StringBase &str100Ref
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->stringArgsOut_out(
|
|
||||||
portNum,
|
|
||||||
str80,
|
|
||||||
str80Ref,
|
|
||||||
str100,
|
|
||||||
str100Ref
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestComponentName ::
|
void TestComponentName ::structArgsGuarded_handler(const FwIndexType portNum,
|
||||||
structArgsGuarded_handler(
|
const FormalParamStruct& s,
|
||||||
const FwIndexType portNum,
|
FormalParamStruct& sRef) {
|
||||||
const FormalParamStruct &s,
|
this->structArgsOut_out(portNum, s, sRef);
|
||||||
FormalParamStruct &sRef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->structArgsOut_out(portNum, s, sRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestComponentName ::
|
void TestComponentName ::structArgsSync_handler(const FwIndexType portNum,
|
||||||
structArgsSync_handler(
|
const FormalParamStruct& s,
|
||||||
const FwIndexType portNum,
|
FormalParamStruct& sRef) {
|
||||||
const FormalParamStruct &s,
|
this->structArgsOut_out(portNum, s, sRef);
|
||||||
FormalParamStruct &sRef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->structArgsOut_out(portNum, s, sRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FormalParamStruct TestComponentName ::
|
FormalParamStruct TestComponentName ::structReturnGuarded_handler(const FwIndexType portNum,
|
||||||
structReturnGuarded_handler(
|
const FormalParamStruct& s,
|
||||||
const FwIndexType portNum,
|
FormalParamStruct& sRef) {
|
||||||
const FormalParamStruct &s,
|
return this->structReturnOut_out(portNum, s, sRef);
|
||||||
FormalParamStruct &sRef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return this->structReturnOut_out(portNum, s, sRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FormalParamStruct TestComponentName ::
|
FormalParamStruct TestComponentName ::structReturnSync_handler(const FwIndexType portNum,
|
||||||
structReturnSync_handler(
|
const FormalParamStruct& s,
|
||||||
const FwIndexType portNum,
|
FormalParamStruct& sRef) {
|
||||||
const FormalParamStruct &s,
|
return this->structReturnOut_out(portNum, s, sRef);
|
||||||
FormalParamStruct &sRef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
return this->structReturnOut_out(portNum, s, sRef);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,221 +3,187 @@
|
|||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
//! Handler implementation for arrayArgsGuarded
|
//! Handler implementation for arrayArgsGuarded
|
||||||
void arrayArgsGuarded_handler(
|
void arrayArgsGuarded_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamArray& a, //!< An array
|
||||||
const FormalParamArray& a, //!< An array
|
FormalParamArray& aRef, //!< An array ref
|
||||||
FormalParamArray& aRef, //!< An array ref
|
const FormalAliasArray& b, //!< alias of an array
|
||||||
const FormalAliasArray& b, //!< alias of an array
|
FormalAliasArray& bRef, //!< alias of array ref
|
||||||
FormalAliasArray& bRef, //!< alias of array ref
|
const FormalAliasStringArray& c, //!< array of string aliases
|
||||||
const FormalAliasStringArray& c, //!< array of string aliases
|
FormalAliasStringArray& cRef //!< array of string aliases ref
|
||||||
FormalAliasStringArray& cRef //!< array of string aliases ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for arrayArgsSync
|
//! Handler implementation for arrayArgsSync
|
||||||
void arrayArgsSync_handler(
|
void arrayArgsSync_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamArray& a, //!< An array
|
||||||
const FormalParamArray& a, //!< An array
|
FormalParamArray& aRef, //!< An array ref
|
||||||
FormalParamArray& aRef, //!< An array ref
|
const FormalAliasArray& b, //!< alias of an array
|
||||||
const FormalAliasArray& b, //!< alias of an array
|
FormalAliasArray& bRef, //!< alias of array ref
|
||||||
FormalAliasArray& bRef, //!< alias of array ref
|
const FormalAliasStringArray& c, //!< array of string aliases
|
||||||
const FormalAliasStringArray& c, //!< array of string aliases
|
FormalAliasStringArray& cRef //!< array of string aliases ref
|
||||||
FormalAliasStringArray& cRef //!< array of string aliases ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for arrayReturnGuarded
|
//! Handler implementation for arrayReturnGuarded
|
||||||
FormalParamArray arrayReturnGuarded_handler(
|
FormalParamArray arrayReturnGuarded_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamArray& a, //!< An array
|
||||||
const FormalParamArray& a, //!< An array
|
FormalParamArray& aRef //!< An array ref
|
||||||
FormalParamArray& aRef //!< An array ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for arrayReturnSync
|
//! Handler implementation for arrayReturnSync
|
||||||
FormalParamArray arrayReturnSync_handler(
|
FormalParamArray arrayReturnSync_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamArray& a, //!< An array
|
||||||
const FormalParamArray& a, //!< An array
|
FormalParamArray& aRef //!< An array ref
|
||||||
FormalParamArray& aRef //!< An array ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for arrayReturnGuarded
|
//! Handler implementation for arrayReturnGuarded
|
||||||
FormalAliasStringArray arrayStringAliasReturnGuarded_handler(
|
FormalAliasStringArray arrayStringAliasReturnGuarded_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamArray& a, //!< A string
|
||||||
const FormalParamArray& a, //!< A string
|
FormalParamArray& aRef //!< A string ref
|
||||||
FormalParamArray& aRef //!< A string ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for arrayReturnSync
|
//! Handler implementation for arrayReturnSync
|
||||||
FormalAliasStringArray arrayStringAliasReturnSync_handler(
|
FormalAliasStringArray arrayStringAliasReturnSync_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamArray& a, //!< A string
|
||||||
const FormalParamArray& a, //!< A string
|
FormalParamArray& aRef //!< A string ref
|
||||||
FormalParamArray& aRef //!< A string ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for enumArgsGuarded
|
//! Handler implementation for enumArgsGuarded
|
||||||
void enumArgsGuarded_handler(
|
void enumArgsGuarded_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamEnum& en, //!< An enum
|
||||||
const FormalParamEnum& en, //!< An enum
|
FormalParamEnum& enRef, //!< An enum ref
|
||||||
FormalParamEnum& enRef, //!< An enum ref
|
const FormalAliasEnum& enA, //!< An enum alias
|
||||||
const FormalAliasEnum& enA, //!< An enum alias
|
FormalAliasEnum& enARef //!< An enum alias ref
|
||||||
FormalAliasEnum& enARef //!< An enum alias ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for enumArgsSync
|
//! Handler implementation for enumArgsSync
|
||||||
void enumArgsSync_handler(
|
void enumArgsSync_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamEnum& en, //!< An enum
|
||||||
const FormalParamEnum& en, //!< An enum
|
FormalParamEnum& enRef, //!< An enum ref
|
||||||
FormalParamEnum& enRef, //!< An enum ref
|
const FormalAliasEnum& enA, //!< An enum alias
|
||||||
const FormalAliasEnum& enA, //!< An enum alias
|
FormalAliasEnum& enARef //!< An enum alias ref
|
||||||
FormalAliasEnum& enARef //!< An enum alias ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for enumReturnGuarded
|
//! Handler implementation for enumReturnGuarded
|
||||||
FormalParamEnum enumReturnGuarded_handler(
|
FormalParamEnum enumReturnGuarded_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamEnum& en, //!< An enum
|
||||||
const FormalParamEnum& en, //!< An enum
|
FormalParamEnum& enRef //!< An enum ref
|
||||||
FormalParamEnum& enRef //!< An enum ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for enumReturnSync
|
//! Handler implementation for enumReturnSync
|
||||||
FormalParamEnum enumReturnSync_handler(
|
FormalParamEnum enumReturnSync_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamEnum& en, //!< An enum
|
||||||
const FormalParamEnum& en, //!< An enum
|
FormalParamEnum& enRef //!< An enum ref
|
||||||
FormalParamEnum& enRef //!< An enum ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for noArgsGuarded
|
//! Handler implementation for noArgsGuarded
|
||||||
void noArgsGuarded_handler(
|
void noArgsGuarded_handler(FwIndexType portNum //!< The port number
|
||||||
FwIndexType portNum //!< The port number
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for noArgsReturnGuarded
|
//! Handler implementation for noArgsReturnGuarded
|
||||||
bool noArgsReturnGuarded_handler(
|
bool noArgsReturnGuarded_handler(FwIndexType portNum //!< The port number
|
||||||
FwIndexType portNum //!< The port number
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for noArgsReturnSync
|
//! Handler implementation for noArgsReturnSync
|
||||||
bool noArgsReturnSync_handler(
|
bool noArgsReturnSync_handler(FwIndexType portNum //!< The port number
|
||||||
FwIndexType portNum //!< The port number
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for noArgsSync
|
//! Handler implementation for noArgsSync
|
||||||
void noArgsSync_handler(
|
void noArgsSync_handler(FwIndexType portNum //!< The port number
|
||||||
FwIndexType portNum //!< The port number
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for primitiveArgsGuarded
|
//! Handler implementation for primitiveArgsGuarded
|
||||||
void primitiveArgsGuarded_handler(
|
void primitiveArgsGuarded_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
U32 u32,
|
||||||
U32 u32,
|
U32& u32Ref,
|
||||||
U32& u32Ref,
|
F32 f32,
|
||||||
F32 f32,
|
F32& f32Ref,
|
||||||
F32& f32Ref,
|
bool b,
|
||||||
bool b,
|
bool& bRef) override;
|
||||||
bool& bRef
|
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for primitiveArgsSync
|
//! Handler implementation for primitiveArgsSync
|
||||||
void primitiveArgsSync_handler(
|
void primitiveArgsSync_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
U32 u32,
|
||||||
U32 u32,
|
U32& u32Ref,
|
||||||
U32& u32Ref,
|
F32 f32,
|
||||||
F32 f32,
|
F32& f32Ref,
|
||||||
F32& f32Ref,
|
bool b,
|
||||||
bool b,
|
bool& bRef) override;
|
||||||
bool& bRef
|
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for primitiveReturnGuarded
|
//! Handler implementation for primitiveReturnGuarded
|
||||||
U32 primitiveReturnGuarded_handler(
|
U32 primitiveReturnGuarded_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
U32 u32,
|
||||||
U32 u32,
|
U32& u32Ref,
|
||||||
U32& u32Ref,
|
F32 f32,
|
||||||
F32 f32,
|
F32& f32Ref,
|
||||||
F32& f32Ref,
|
bool b,
|
||||||
bool b,
|
bool& bRef) override;
|
||||||
bool& bRef
|
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for primitiveReturnSync
|
//! Handler implementation for primitiveReturnSync
|
||||||
U32 primitiveReturnSync_handler(
|
U32 primitiveReturnSync_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
U32 u32,
|
||||||
U32 u32,
|
U32& u32Ref,
|
||||||
U32& u32Ref,
|
F32 f32,
|
||||||
F32 f32,
|
F32& f32Ref,
|
||||||
F32& f32Ref,
|
bool b,
|
||||||
bool b,
|
bool& bRef) override;
|
||||||
bool& bRef
|
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for stringArgsGuarded
|
//! Handler implementation for stringArgsGuarded
|
||||||
void stringArgsGuarded_handler(
|
void stringArgsGuarded_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const Fw::StringBase& str80, //!< A string of size 80
|
||||||
const Fw::StringBase& str80, //!< A string of size 80
|
Fw::StringBase& str80Ref,
|
||||||
Fw::StringBase& str80Ref,
|
const Fw::StringBase& str100, //!< A string of size 100
|
||||||
const Fw::StringBase& str100, //!< A string of size 100
|
Fw::StringBase& str100Ref) override;
|
||||||
Fw::StringBase& str100Ref
|
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for stringArgsSync
|
//! Handler implementation for stringArgsSync
|
||||||
void stringArgsSync_handler(
|
void stringArgsSync_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const Fw::StringBase& str80, //!< A string of size 80
|
||||||
const Fw::StringBase& str80, //!< A string of size 80
|
Fw::StringBase& str80Ref,
|
||||||
Fw::StringBase& str80Ref,
|
const Fw::StringBase& str100, //!< A string of size 100
|
||||||
const Fw::StringBase& str100, //!< A string of size 100
|
Fw::StringBase& str100Ref) override;
|
||||||
Fw::StringBase& str100Ref
|
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for structArgsGuarded
|
//! Handler implementation for structArgsGuarded
|
||||||
void structArgsGuarded_handler(
|
void structArgsGuarded_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamStruct& s, //!< A struct
|
||||||
const FormalParamStruct& s, //!< A struct
|
FormalParamStruct& sRef //!< A struct ref
|
||||||
FormalParamStruct& sRef //!< A struct ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for stringReturnGuarded
|
//! Handler implementation for stringReturnGuarded
|
||||||
Fw::String stringReturnGuarded_handler(
|
Fw::String stringReturnGuarded_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const Fw::StringBase& str, //!< A string
|
||||||
const Fw::StringBase& str, //!< A string
|
Fw::StringBase& strRef //!< A string ref
|
||||||
Fw::StringBase& strRef //!< A string ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for stringReturnSync
|
//! Handler implementation for stringReturnSync
|
||||||
Fw::String stringReturnSync_handler(
|
Fw::String stringReturnSync_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const Fw::StringBase& str, //!< A string
|
||||||
const Fw::StringBase& str, //!< A string
|
Fw::StringBase& strRef //!< A string ref
|
||||||
Fw::StringBase& strRef //!< A string ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for stringAliasReturnGuarded
|
//! Handler implementation for stringAliasReturnGuarded
|
||||||
FormalAliasString stringAliasReturnGuarded_handler(
|
FormalAliasString stringAliasReturnGuarded_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const Fw::StringBase& str, //!< A string
|
||||||
const Fw::StringBase& str, //!< A string
|
Fw::StringBase& strRef //!< A string ref
|
||||||
Fw::StringBase& strRef //!< A string ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for stringAliasReturnSync
|
//! Handler implementation for stringAliasReturnSync
|
||||||
FormalAliasString stringAliasReturnSync_handler(
|
FormalAliasString stringAliasReturnSync_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const Fw::StringBase& str, //!< A string
|
||||||
const Fw::StringBase& str, //!< A string
|
Fw::StringBase& strRef //!< A string ref
|
||||||
Fw::StringBase& strRef //!< A string ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for structArgsSync
|
//! Handler implementation for structArgsSync
|
||||||
void structArgsSync_handler(
|
void structArgsSync_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamStruct& s, //!< A struct
|
||||||
const FormalParamStruct& s, //!< A struct
|
FormalParamStruct& sRef //!< A struct ref
|
||||||
FormalParamStruct& sRef //!< A struct ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for structReturnGuarded
|
//! Handler implementation for structReturnGuarded
|
||||||
FormalParamStruct structReturnGuarded_handler(
|
FormalParamStruct structReturnGuarded_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamStruct& s, //!< A struct
|
||||||
const FormalParamStruct& s, //!< A struct
|
FormalParamStruct& sRef //!< A struct ref
|
||||||
FormalParamStruct& sRef //!< A struct ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for structReturnSync
|
//! Handler implementation for structReturnSync
|
||||||
FormalParamStruct structReturnSync_handler(
|
FormalParamStruct structReturnSync_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamStruct& s, //!< A struct
|
||||||
const FormalParamStruct& s, //!< A struct
|
FormalParamStruct& sRef //!< A struct ref
|
||||||
FormalParamStruct& sRef //!< A struct ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|||||||
@ -1,91 +1,51 @@
|
|||||||
void TestComponentName ::
|
void TestComponentName ::arrayArgsAsync_handler(const FwIndexType portNum,
|
||||||
arrayArgsAsync_handler(
|
const FormalParamArray& a,
|
||||||
const FwIndexType portNum,
|
FormalParamArray& aRef,
|
||||||
const FormalParamArray &a,
|
const FormalAliasArray& b,
|
||||||
FormalParamArray &aRef,
|
FormalAliasArray& bRef,
|
||||||
const FormalAliasArray& b,
|
const FormalAliasStringArray& c,
|
||||||
FormalAliasArray& bRef,
|
FormalAliasStringArray& cRef) {
|
||||||
const FormalAliasStringArray& c,
|
|
||||||
FormalAliasStringArray& cRef)
|
|
||||||
{
|
|
||||||
this->arrayArgsOut_out(portNum, a, aRef, b, bRef, c, cRef);
|
this->arrayArgsOut_out(portNum, a, aRef, b, bRef, c, cRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestComponentName ::
|
void TestComponentName ::enumArgsAsync_handler(const FwIndexType portNum,
|
||||||
enumArgsAsync_handler(
|
const FormalParamEnum& en,
|
||||||
const FwIndexType portNum,
|
FormalParamEnum& enRef,
|
||||||
const FormalParamEnum &en,
|
const FormalAliasEnum& enA,
|
||||||
FormalParamEnum &enRef,
|
FormalAliasEnum& enARef) {
|
||||||
const FormalAliasEnum& enA,
|
|
||||||
FormalAliasEnum& enARef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->enumArgsOut_out(portNum, en, enRef, enA, enARef);
|
this->enumArgsOut_out(portNum, en, enRef, enA, enARef);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestComponentName ::
|
void TestComponentName ::noArgsAsync_handler(const FwIndexType portNum) {
|
||||||
noArgsAsync_handler(
|
|
||||||
const FwIndexType portNum
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->noArgsOut_out(portNum);
|
this->noArgsOut_out(portNum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestComponentName ::
|
void TestComponentName ::primitiveArgsAsync_handler(const FwIndexType portNum,
|
||||||
primitiveArgsAsync_handler(
|
U32 u32,
|
||||||
const FwIndexType portNum,
|
U32& u32Ref,
|
||||||
U32 u32,
|
F32 f32,
|
||||||
U32 &u32Ref,
|
F32& f32Ref,
|
||||||
F32 f32,
|
bool b,
|
||||||
F32 &f32Ref,
|
bool& bRef) {
|
||||||
bool b,
|
this->primitiveArgsOut_out(portNum, u32, u32Ref, f32, f32Ref, b, bRef);
|
||||||
bool &bRef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->primitiveArgsOut_out(
|
|
||||||
portNum,
|
|
||||||
u32,
|
|
||||||
u32Ref,
|
|
||||||
f32,
|
|
||||||
f32Ref,
|
|
||||||
b,
|
|
||||||
bRef
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestComponentName ::
|
void TestComponentName ::structArgsAsync_handler(const FwIndexType portNum,
|
||||||
structArgsAsync_handler(
|
const FormalParamStruct& s,
|
||||||
const FwIndexType portNum,
|
FormalParamStruct& sRef) {
|
||||||
const FormalParamStruct &s,
|
|
||||||
FormalParamStruct &sRef
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->structArgsOut_out(portNum, s, sRef);
|
this->structArgsOut_out(portNum, s, sRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestComponentName ::
|
void TestComponentName ::stringArgsAsync_handler(const FwIndexType portNum,
|
||||||
stringArgsAsync_handler(
|
const Fw::StringBase& str80,
|
||||||
const FwIndexType portNum,
|
Fw::StringBase& str80Ref,
|
||||||
const Fw::StringBase &str80,
|
const Fw::StringBase& str100,
|
||||||
Fw::StringBase &str80Ref,
|
Fw::StringBase& str100Ref) {
|
||||||
const Fw::StringBase &str100,
|
this->stringArgsOut_out(portNum, str80, str80Ref, str100, str100Ref);
|
||||||
Fw::StringBase &str100Ref
|
|
||||||
)
|
|
||||||
{
|
|
||||||
this->stringArgsOut_out(
|
|
||||||
portNum,
|
|
||||||
str80,
|
|
||||||
str80Ref,
|
|
||||||
str100,
|
|
||||||
str100Ref
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestComponentName ::
|
void TestComponentName ::enumArgsHook_handler(const FwIndexType portNum,
|
||||||
enumArgsHook_handler(
|
const FormalParamEnum& en,
|
||||||
const FwIndexType portNum,
|
FormalParamEnum& enRef,
|
||||||
const FormalParamEnum &en,
|
const FormalAliasEnum& enA,
|
||||||
FormalParamEnum &enRef,
|
FormalAliasEnum& enARef) {}
|
||||||
const FormalAliasEnum& enA,
|
|
||||||
FormalAliasEnum& enARef
|
|
||||||
) {}
|
|
||||||
|
|||||||
@ -1,60 +1,51 @@
|
|||||||
//! Handler implementation for arrayArgsAsync
|
//! Handler implementation for arrayArgsAsync
|
||||||
void arrayArgsAsync_handler(
|
void arrayArgsAsync_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamArray& a, //!< An array
|
||||||
const FormalParamArray& a, //!< An array
|
FormalParamArray& aRef, //!< An array ref
|
||||||
FormalParamArray& aRef, //!< An array ref
|
const FormalAliasArray& b, //!< alias of an array
|
||||||
const FormalAliasArray& b, //!< alias of an array
|
FormalAliasArray& bRef, //!< alias of array ref
|
||||||
FormalAliasArray& bRef, //!< alias of array ref
|
const FormalAliasStringArray& c, //!< array of string aliases
|
||||||
const FormalAliasStringArray& c, //!< array of string aliases
|
FormalAliasStringArray& cRef //!< array of string aliases ref
|
||||||
FormalAliasStringArray& cRef //!< array of string aliases ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for enumArgsAsync
|
//! Handler implementation for enumArgsAsync
|
||||||
void enumArgsAsync_handler(
|
void enumArgsAsync_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamEnum& en, //!< An enum
|
||||||
const FormalParamEnum& en, //!< An enum
|
FormalParamEnum& enRef, //!< An enum ref
|
||||||
FormalParamEnum& enRef, //!< An enum ref
|
const FormalAliasEnum& enA, //!< An enum alias
|
||||||
const FormalAliasEnum& enA, //!< An enum alias
|
FormalAliasEnum& enARef //!< An enum alias ref
|
||||||
FormalAliasEnum& enARef //!< An enum alias ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for noArgsAsync
|
//! Handler implementation for noArgsAsync
|
||||||
void noArgsAsync_handler(
|
void noArgsAsync_handler(FwIndexType portNum //!< The port number
|
||||||
FwIndexType portNum //!< The port number
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for primitiveArgsAsync
|
//! Handler implementation for primitiveArgsAsync
|
||||||
void primitiveArgsAsync_handler(
|
void primitiveArgsAsync_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
U32 u32,
|
||||||
U32 u32,
|
U32& u32Ref,
|
||||||
U32& u32Ref,
|
F32 f32,
|
||||||
F32 f32,
|
F32& f32Ref,
|
||||||
F32& f32Ref,
|
bool b,
|
||||||
bool b,
|
bool& bRef) override;
|
||||||
bool& bRef
|
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for stringArgsAsync
|
//! Handler implementation for stringArgsAsync
|
||||||
void stringArgsAsync_handler(
|
void stringArgsAsync_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const Fw::StringBase& str80, //!< A string of size 80
|
||||||
const Fw::StringBase& str80, //!< A string of size 80
|
Fw::StringBase& str80Ref,
|
||||||
Fw::StringBase& str80Ref,
|
const Fw::StringBase& str100, //!< A string of size 100
|
||||||
const Fw::StringBase& str100, //!< A string of size 100
|
Fw::StringBase& str100Ref) override;
|
||||||
Fw::StringBase& str100Ref
|
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for structArgsAsync
|
//! Handler implementation for structArgsAsync
|
||||||
void structArgsAsync_handler(
|
void structArgsAsync_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamStruct& s, //!< A struct
|
||||||
const FormalParamStruct& s, //!< A struct
|
FormalParamStruct& sRef //!< A struct ref
|
||||||
FormalParamStruct& sRef //!< A struct ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|
||||||
//! Handler implementation for enumArgsOverflow
|
//! Handler implementation for enumArgsOverflow
|
||||||
void enumArgsHook_handler(
|
void enumArgsHook_handler(FwIndexType portNum, //!< The port number
|
||||||
FwIndexType portNum, //!< The port number
|
const FormalParamEnum& en, //!< An enum
|
||||||
const FormalParamEnum& en, //!< An enum
|
FormalParamEnum& enRef, //!< An enum ref
|
||||||
FormalParamEnum& enRef, //!< An enum ref
|
const FormalAliasEnum& enA, //!< An enum alias
|
||||||
const FormalAliasEnum& enA, //!< An enum alias
|
FormalAliasEnum& enARef //!< An enum alias ref
|
||||||
FormalAliasEnum& enARef //!< An enum alias ref
|
) override;
|
||||||
) override;
|
|
||||||
|
|||||||
@ -4,26 +4,13 @@
|
|||||||
// \brief cpp file for Empty component implementation class
|
// \brief cpp file for Empty component implementation class
|
||||||
// ======================================================================
|
// ======================================================================
|
||||||
|
|
||||||
|
|
||||||
#include "Empty.hpp"
|
#include "Empty.hpp"
|
||||||
#include <Fw/FPrimeBasicTypes.hpp>
|
#include <Fw/FPrimeBasicTypes.hpp>
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Construction, initialization, and destruction
|
// Construction, initialization, and destruction
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
Empty ::
|
Empty ::Empty(const char* const compName) : EmptyComponentBase(compName) {}
|
||||||
Empty(
|
|
||||||
const char *const compName
|
|
||||||
) : EmptyComponentBase(compName)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Empty ::
|
|
||||||
~Empty()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Empty ::~Empty() {}
|
||||||
|
|||||||
@ -9,24 +9,18 @@
|
|||||||
|
|
||||||
#include "FppTest/component/empty/EmptyComponentAc.hpp"
|
#include "FppTest/component/empty/EmptyComponentAc.hpp"
|
||||||
|
|
||||||
class Empty :
|
class Empty : public EmptyComponentBase {
|
||||||
public EmptyComponentBase
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Component construction, initialization, and destruction
|
// Component construction, initialization, and destruction
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
//! Construct Empty object
|
//! Construct Empty object
|
||||||
Empty(
|
Empty(const char* const compName //!< The component name
|
||||||
const char* const compName //!< The component name
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//! Destroy Empty object
|
//! Destroy Empty object
|
||||||
~Empty();
|
~Empty();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user