-
Notifications
You must be signed in to change notification settings - Fork 0
/
square_pub_sub.sh
executable file
·123 lines (96 loc) · 4.55 KB
/
square_pub_sub.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
#!/bin/bash
#*****************************************************************************
#* (c) 2005-2018 Copyright, Real-Time Innovations, All rights reserved. *
#* *
#* Permission to modify and use for internal purposes granted. *
#* This software is provided "as is", without warranty, express or implied. *
#* *
#*****************************************************************************
# Compose a component from the following services:
# final -> Square_Sub
# Square_Sub -> Square_Pub
# Square_Pub -> root
#
# Use this script to launch the component as follows:
#
# <this>.sh [<domain_id> [<path_to_executable_or_lua_script>] [project_dir]]
#
# ---------------------------------------------------------------------
# Author: Rajive Joshi, Real-Time Innovations Inc. Copyright (C) 2018.
# ---------------------------------------------------------------------
# --- Service Composition ---
# ---------------------------------------------------------------------
# final: Component Parameters
NAME_Component="square_pub_sub"
# --- Service composition ---
# final -> Square_Sub
BASE_NAME_Component="SquareIfLib::Square_Sub"
# Square_Sub -> Square_Pub
BASE_NAME_Square_Sub="SquareIfLib::Square_Pub"
# Square_Pub -> root
BASE_NAME_Square_Pub="SquareIfLib::Square_Root"
BASE_NAME_Square_Root="DeploymentIfLib::Component_Root"
# ---------------------------------------------------------------------
# --- Directories ---
# ---------------------------------------------------------------------
# Project Directory
# Use the third argument, $3, if specified
# Default: one level up (..) from the location of this script
MY_HOME=${3:-$(cd $(dirname "$0")/..; pwd -P)}
# Locations
export TYPES_DIR=${TYPES_DIR:=${MY_HOME}/res/types}
# ---------------------------------------------------------------------
# --- Common ---
# ---------------------------------------------------------------------
# DDS-XML files
export NDDS_QOS_PROFILES= #empty
# QoS - Common
NDDS_QOS_PROFILES+="${MY_HOME}/res/qos/common/factory_qos.xml;"
NDDS_QOS_PROFILES+="${MY_HOME}/res/qos/common/participant_qos.xml;"
NDDS_QOS_PROFILES+="${MY_HOME}/res/qos/common/endpoint_qos.xml;"
# ---------------------------------------------------------------------
# --- Interface Defaults ---
# ---------------------------------------------------------------------
# root
NDDS_QOS_PROFILES+="${MY_HOME}/if/component/root.xml;"
# Square
export BASE_NAME_Square_Pub=${BASE_NAME_Square_Pub:="SquareIfLib::Square_Root"}
export BASE_NAME_Square_Sub=${BASE_NAME_Square_Sub:="SquareIfLib::Square_Root"}
export BASE_NAME_Square_Root=${BASE_NAME_Square_Root:="DeploymentIfLib::Component_Root"}
NDDS_QOS_PROFILES+="${MY_HOME}/res/qos/services/Square_qos.xml;"
NDDS_QOS_PROFILES+="${MY_HOME}/if/Square.xml;"
# final
export BASE_NAME_Component=${BASE_NAME_Component:="DeploymentIfLib::Component_Root"}
export NAME_Component=${NAME_Component:="MyComponent"}
export DOMAIN_ID_Component=${1:-0} # Use the first argument, $1, if specified
NDDS_QOS_PROFILES+="${MY_HOME}/res/qos/services/Circle_qos.xml;"
NDDS_QOS_PROFILES+="${MY_HOME}/res/qos/services/Triangle_qos.xml;"
NDDS_QOS_PROFILES+="${MY_HOME}/res/qos/deployments/Deployment_qos.xml;"
NDDS_QOS_PROFILES+="${MY_HOME}/if/component/final.xml"
# ---------------------------------------------------------------------
# --- Executable ---
# ---------------------------------------------------------------------
# Get executable from the second argument, $2, if any:
# Default: lua script that enumerates the component (service composition)
# inputs & outputs
EXEC_PATH=${2:-${MY_HOME}/src/lua/Endpoints.lua}
# if executable is a lua file, run it with the rtiddsprototyper
case ${EXEC_PATH} in
*.lua)
EXEC="rtiddsprototyper -cfgName DeploymentIfLib::Component -luaFile ${EXEC_PATH}"
;;
*) EXEC=${EXEC_PATH}
;;
esac
# ---------------------------------------------------------------------
# --- Run ---
# ---------------------------------------------------------------------
echo "Usage: "
echo "$0 [<domain_id> [<path_to_executable_or_lua_script>] [project_dir]]"
echo
echo DOMAIN_ID=${DOMAIN_ID_Component}
echo MY_HOME=${MY_HOME}
echo NDDS_QOS_PROFILES=${NDDS_QOS_PROFILES}
echo EXEC=${EXEC}
exec ${EXEC}
# ---------------------------------------------------------------------