diff --git a/README.md b/README.md index a3e466db..04a352ae 100644 --- a/README.md +++ b/README.md @@ -261,6 +261,8 @@ RTKBase use several RTKLIB `str2str` instances started with `run_cast.sh` as sys + `str2str_tcp.service` is the main instance. It is connected to the gnss receiver and broadcast the raw data on TCP for all the others services. + `str2str_ntrip_A.service` get the data from the main instance, convert the data to rtcm and stream them to a Ntrip caster. + `str2str_ntrip_B.service` get the data from the main instance, convert the data to rtcm and stream them to another Ntrip caster. ++ `str2str_ntrip_C.service` get the data from the main instance, convert the data to rtcm and stream them to another Ntrip caster. ++ `str2str_ntrip_D.service` get the data from the main instance, convert the data to rtcm and stream them to another Ntrip caster. + `str2str_local_ntrip_caster.service` get the data from the main instance, convert the data to rtcm, and act as a local Ntrip caster. + `str2str_rtcm_svr.service` get the data from the main instance, convert the data to rtcm and stream them to clients + `str2str_rtcm_serial.service` get the data from the main instance, convert the data to rtcm and stream them to a serial port (radio link, or other peripherals) diff --git a/run_cast.sh b/run_cast.sh index e8f6f2de..e7771293 100755 --- a/run_cast.sh +++ b/run_cast.sh @@ -21,6 +21,14 @@ out_caster_B="-msg ${rtcm_msg_b} -out ntrips://:${svr_pwd_b}@${svr_addr_b}:${svr #add receiver options if it exists [[ ! -z "${ntrip_b_receiver_options}" ]] && out_caster_B=""${out_caster_B}" -opt "${ntrip_b_receiver_options}"" +out_caster_C="-msg ${rtcm_msg_c} -out ntrips://:${svr_pwd_c}@${svr_addr_c}:${svr_port_c}/${mnt_name_c}#rtcm3 -p ${position}" +#add receiver options if it exists +[[ ! -z "${ntrip_c_receiver_options}" ]] && out_caster_C=""${out_caster_C}" -opt "${ntrip_c_receiver_options}"" + +out_caster_D="-msg ${rtcm_msg_d} -out ntrips://:${svr_pwd_d}@${svr_addr_d}:${svr_port_d}/${mnt_name_d}#rtcm3 -p ${position}" +#add receiver options if it exists +[[ ! -z "${ntrip_d_receiver_options}" ]] && out_caster_D=""${out_caster_D}" -opt "${ntrip_d_receiver_options}"" + array_pos=(${position}) if [[ ${local_ntripc_user} == '' ]] && [[ ${local_ntripc_pwd} == '' ]] then @@ -71,6 +79,14 @@ mkdir -p ${logdir} ${cast} -in ${!1} ${out_caster_B} -i "${receiver_info}" -a "${antenna_info}" -t ${level} -fl ${logdir}/str2str_ntrip_B.log ;; + out_caster_C) + ${cast} -in ${!1} ${out_caster_C} -i "${receiver_info}" -a "${antenna_info}" -t ${level} -fl ${logdir}/str2str_ntrip_C.log + ;; + + out_caster_D) + ${cast} -in ${!1} ${out_caster_D} -i "${receiver_info}" -a "${antenna_info}" -t ${level} -fl ${logdir}/str2str_ntrip_D.log + ;; + out_local_caster) #echo ${cast} -in ${!1} -out "${out_local_caster}" ${cast} -in ${!1} ${out_local_caster} -i "${receiver_info}" -a "${antenna_info}" -t ${level} -fl ${logdir}/str2str_ntrip.log diff --git a/settings.conf.default b/settings.conf.default index 318184ca..51a26305 100644 --- a/settings.conf.default +++ b/settings.conf.default @@ -83,7 +83,7 @@ min_free_space='500' # NTRIP A caster options #ntrip A caster url -svr_addr_a='caster.centipede.fr' +svr_addr_a='crtk.net' #ntrip A caster port svr_port_a='2101' #ntrip A caster password @@ -99,7 +99,7 @@ ntrip_a_receiver_options='' # NTRIP B caster options #ntrip B caster url -svr_addr_b='caster.centipede.fr' +svr_addr_b='crtk.net' #ntrip B caster port svr_port_b='2101' #ntrip B caster password @@ -110,6 +110,38 @@ rtcm_msg_b='1004,1005(10),1006,1008(10),1012,1019,1020,1033(10),1042,1045,1046,1 #Receiver dependent options ntrip_b_receiver_options='' +[ntrip_C] + +# NTRIP C caster options + +#ntrip C caster url +svr_addr_c='crtk.net' +#ntrip C caster port +svr_port_c='2101' +#ntrip C caster password +svr_pwd_c='' +#Mount name +mnt_name_c='Your_mount_name' +rtcm_msg_c='1004,1005(10),1006,1008(10),1012,1019,1020,1033(10),1042,1045,1046,1077,1087,1097,1107,1127,1230' +#Receiver dependent options +ntrip_c_receiver_options='' + +[ntrip_D] + +# NTRIP D caster options + +#ntrip D caster url +svr_addr_d='crtk.net' +#ntrip D caster port +svr_port_d='2101' +#ntrip D caster password +svr_pwd_d='' +#Mount name +mnt_name_d='Your_mount_name' +rtcm_msg_d='1004,1005(10),1006,1008(10),1012,1019,1020,1033(10),1042,1045,1046,1077,1087,1097,1107,1127,1230' +#Receiver dependent options +ntrip_d_receiver_options='' + [local_ntrip_caster] # local NTRIP caster options diff --git a/tools/install.sh b/tools/install.sh index 1b8c37c7..06cd1170 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -539,6 +539,8 @@ configure_gnss(){ #cleaning receiver options sudo -u "${RTKBASE_USER}" sed -i s/^ntrip_a_receiver_options=.*/ntrip_a_receiver_options=/ "${rtkbase_path}"/settings.conf && \ sudo -u "${RTKBASE_USER}" sed -i s/^ntrip_b_receiver_options=.*/ntrip_b_receiver_options=/ "${rtkbase_path}"/settings.conf && \ + sudo -u "${RTKBASE_USER}" sed -i s/^ntrip_c_receiver_options=.*/ntrip_c_receiver_options=/ "${rtkbase_path}"/settings.conf && \ + sudo -u "${RTKBASE_USER}" sed -i s/^ntrip_d_receiver_options=.*/ntrip_d_receiver_options=/ "${rtkbase_path}"/settings.conf && \ sudo -u "${RTKBASE_USER}" sed -i s/^local_ntripc_receiver_options=.*/local_ntripc_receiver_options=/ "${rtkbase_path}"/settings.conf && \ sudo -u "${RTKBASE_USER}" sed -i s/^rtcm_receiver_options=.*/rtcm_receiver_options=/ "${rtkbase_path}"/settings.conf && \ sudo -u "${RTKBASE_USER}" sed -i s/^rtcm_client_receiver_options=.*/rtcm_client_receiver_options=/ "${rtkbase_path}"/settings.conf && \ @@ -560,9 +562,11 @@ configure_gnss(){ sudo -u "${RTKBASE_USER}" sed -i s/^com_port_settings=.*/com_port_settings=\'115200:8:n:1\'/ "${rtkbase_path}"/settings.conf && \ sudo -u "${RTKBASE_USER}" sed -i s/^receiver=.*/receiver=\'U-blox_ZED-F9P\'/ "${rtkbase_path}"/settings.conf && \ sudo -u "${RTKBASE_USER}" sed -i s/^receiver_format=.*/receiver_format=\'ubx\'/ "${rtkbase_path}"/settings.conf && \ - #add option -TADJ=1 on rtcm/ntrip_a/ntrip_b/serial outputs + #add option -TADJ=1 on rtcm/ntrip_a/ntrip_b/ntrip_c/ntrip_d serial outputs sudo -u "${RTKBASE_USER}" sed -i s/^ntrip_a_receiver_options=.*/ntrip_a_receiver_options=\'-TADJ=1\'/ "${rtkbase_path}"/settings.conf && \ sudo -u "${RTKBASE_USER}" sed -i s/^ntrip_b_receiver_options=.*/ntrip_b_receiver_options=\'-TADJ=1\'/ "${rtkbase_path}"/settings.conf && \ + sudo -u "${RTKBASE_USER}" sed -i s/^ntrip_c_receiver_options=.*/ntrip_c_receiver_options=\'-TADJ=1\'/ "${rtkbase_path}"/settings.conf && \ + sudo -u "${RTKBASE_USER}" sed -i s/^ntrip_d_receiver_options=.*/ntrip_d_receiver_options=\'-TADJ=1\'/ "${rtkbase_path}"/settings.conf && \ sudo -u "${RTKBASE_USER}" sed -i s/^local_ntripc_receiver_options=.*/local_ntripc_receiver_options=\'-TADJ=1\'/ "${rtkbase_path}"/settings.conf && \ sudo -u "${RTKBASE_USER}" sed -i s/^rtcm_receiver_options=.*/rtcm_receiver_options=\'-TADJ=1\'/ "${rtkbase_path}"/settings.conf && \ sudo -u "${RTKBASE_USER}" sed -i s/^rtcm_client_receiver_options=.*/rtcm_client_receiver_options=\'-TADJ=1\'/ "${rtkbase_path}"/settings.conf && \ diff --git a/tools/rtkbase_update.sh b/tools/rtkbase_update.sh index caec42ad..ba263c69 100755 --- a/tools/rtkbase_update.sh +++ b/tools/rtkbase_update.sh @@ -27,6 +27,8 @@ checking=$6 str2str_active=$(systemctl is-active str2str_tcp) str2str_ntrip_A_active=$(systemctl is-active str2str_ntrip_A) str2str_ntrip_B_active=$(systemctl is-active str2str_ntrip_B) +str2str_ntrip_C_active=$(systemctl is-active str2str_ntrip_C) +str2str_ntrip_D_active=$(systemctl is-active str2str_ntrip_D) str2str_local_caster=$(systemctl is-active str2str_local_ntrip_caster) str2str_rtcm=$(systemctl is-active str2str_rtcm_svr) str2str_serial=$(systemctl is-active str2str_rtcm_serial) @@ -170,7 +172,9 @@ upd_2.4.2() { [ $str2str_active = 'active' ] && systemctl start str2str_tcp # restart previously running services [ $str2str_ntrip_A_active = 'active' ] && systemctl start str2str_ntrip_A - [ $str2str_ntrip_B_active = 'active' ] && systemctl start str2str_ntrip_B + [ $str2str_ntrip_B_active = 'active' ] && systemctl start str2str_ntrip_B + [ $str2str_ntrip_C_active = 'active' ] && systemctl start str2str_ntrip_C + [ $str2str_ntrip_D_active = 'active' ] && systemctl start str2str_ntrip_D [ $str2str_local_caster = 'active' ] && systemctl start str2str_local_ntrip_caster [ $str2str_rtcm = 'active' ] && systemctl start str2str_rtcm_svr [ $str2str_serial = 'active' ] && systemctl start str2str_rtcm_serial @@ -319,7 +323,9 @@ chown -R ${standard_user}:${standard_user} ${destination_directory} # restart previously running services # restart needed with all update to propagate the release number in the rtcm stream [ $str2str_ntrip_A_active = 'active' ] && systemctl restart str2str_ntrip_A - [ $str2str_ntrip_B_active = 'active' ] && systemctl restart str2str_ntrip_B + [ $str2str_ntrip_B_active = 'active' ] && systemctl restart str2str_ntrip_B + [ $str2str_ntrip_C_active = 'active' ] && systemctl restart str2str_ntrip_C + [ $str2str_ntrip_D_active = 'active' ] && systemctl restart str2str_ntrip_D [ $str2str_local_caster = 'active' ] && systemctl restart str2str_local_ntrip_caster [ $str2str_rtcm = 'active' ] && systemctl restart str2str_rtcm_svr [ $str2str_serial = 'active' ] && systemctl restart str2str_rtcm_serial diff --git a/tools/uninstall.sh b/tools/uninstall.sh index 37d86d40..07e07af8 100755 --- a/tools/uninstall.sh +++ b/tools/uninstall.sh @@ -6,6 +6,8 @@ BASEDIR=$(dirname "$0") for service_name in str2str_tcp.service \ str2str_ntrip_A.service \ str2str_ntrip_B.service \ + str2str_ntrip_C.service \ + str2str_ntrip_D.service \ str2str_local_ntrip_caster \ str2str_rtcm_svr.service \ str2str_rtcm_client.service \ diff --git a/unit/str2str_ntrip_C.service b/unit/str2str_ntrip_C.service new file mode 100644 index 00000000..181e9d90 --- /dev/null +++ b/unit/str2str_ntrip_C.service @@ -0,0 +1,23 @@ +[Unit] +Description=RTKBase Ntrip C +#After=network-online.target +#Wants=network-online.target +Requires=str2str_tcp.service +After=str2str_tcp.service + +[Service] +Type=simple +SyslogIdentifier=str2str_ntrip_C +User={user} +ExecStart={script_path}/run_cast.sh in_tcp out_caster_C +Restart=on-failure +RestartSec=30 +#Limiting log to 1 msg per minute +LogRateLimitIntervalSec=1 minute +LogRateLimitBurst=1 +ProtectHome=read-only +ProtectSystem=strict +ReadWritePaths={script_path} + +[Install] +WantedBy=multi-user.target diff --git a/unit/str2str_ntrip_D.service b/unit/str2str_ntrip_D.service new file mode 100644 index 00000000..200f5527 --- /dev/null +++ b/unit/str2str_ntrip_D.service @@ -0,0 +1,23 @@ +[Unit] +Description=RTKBase Ntrip D +#After=network-online.target +#Wants=network-online.target +Requires=str2str_tcp.service +After=str2str_tcp.service + +[Service] +Type=simple +SyslogIdentifier=str2str_ntrip_D +User={user} +ExecStart={script_path}/run_cast.sh in_tcp out_caster_D +Restart=on-failure +RestartSec=30 +#Limiting log to 1 msg per minute +LogRateLimitIntervalSec=1 minute +LogRateLimitBurst=1 +ProtectHome=read-only +ProtectSystem=strict +ReadWritePaths={script_path} + +[Install] +WantedBy=multi-user.target diff --git a/web_app/RTKBaseConfigManager.py b/web_app/RTKBaseConfigManager.py index cf1c7290..2b9575c8 100644 --- a/web_app/RTKBaseConfigManager.py +++ b/web_app/RTKBaseConfigManager.py @@ -135,6 +135,28 @@ def get_ntrip_B_settings(self): ordered_ntrip.append({key : self.config.get('ntrip_B', key).strip("'")}) return ordered_ntrip + def get_ntrip_C_settings(self): + """ + Get a subset of the settings from the ntrip C section in an ordered object + and remove the single quotes. + """ + #TODO need refactoring with get_ntrip_A_settings + ordered_ntrip = [{"source_section" : "ntrip_C"}] + for key in ("svr_addr_C", "svr_port_C", "svr_pwd_C", "mnt_name_C", "rtcm_msg_C", "ntrip_C_receiver_options"): + ordered_ntrip.append({key : self.config.get('ntrip_C', key).strip("'")}) + return ordered_ntrip + + def get_ntrip_D_settings(self): + """ + Get a subset of the settings from the ntrip D section in an ordered object + and remove the single quotes. + """ + #TODO need refactoring with get_ntrip_A_settings + ordered_ntrip = [{"source_section" : "ntrip_D"}] + for key in ("svr_addr_D", "svr_port_D", "svr_pwd_D", "mnt_name_D", "rtcm_msg_D", "ntrip_D_receiver_options"): + ordered_ntrip.append({key : self.config.get('ntrip_D', key).strip("'")}) + return ordered_ntrip + def get_local_ntripc_settings(self): """ Get a subset of the settings from the local ntrip section in an ordered object @@ -214,6 +236,8 @@ def get_ordered_settings(self): ordered_settings['main'] = self.get_main_settings() ordered_settings['ntrip_A'] = self.get_ntrip_A_settings() ordered_settings['ntrip_B'] = self.get_ntrip_B_settings() + ordered_settings['ntrip_C'] = self.get_ntrip_C_settings() + ordered_settings['ntrip_D'] = self.get_ntrip_D_settings() ordered_settings['local_ntripc'] = self.get_local_ntripc_settings() ordered_settings['file'] = self.get_file_settings() ordered_settings['rtcm_svr'] = self.get_rtcm_svr_settings() diff --git a/web_app/server.py b/web_app/server.py index e36bbc49..20c0611e 100755 --- a/web_app/server.py +++ b/web_app/server.py @@ -102,6 +102,8 @@ services_list = [{"service_unit" : "str2str_tcp.service", "name" : "main"}, {"service_unit" : "str2str_ntrip_A.service", "name" : "ntrip_A"}, {"service_unit" : "str2str_ntrip_B.service", "name" : "ntrip_B"}, + {"service_unit" : "str2str_ntrip_C.service", "name" : "ntrip_C"}, + {"service_unit" : "str2str_ntrip_D.service", "name" : "ntrip_D"}, {"service_unit" : "str2str_local_ntrip_caster.service", "name" : "local_ntrip_caster"}, {"service_unit" : "str2str_rtcm_svr.service", "name" : "rtcm_svr"}, {'service_unit' : 'str2str_rtcm_serial.service', "name" : "rtcm_serial"}, @@ -458,6 +460,8 @@ def settings_page(): main_settings.append(gnss_rcv_url.geturl()) ntrip_A_settings = rtkbaseconfig.get_ntrip_A_settings() ntrip_B_settings = rtkbaseconfig.get_ntrip_B_settings() + ntrip_C_settings = rtkbaseconfig.get_ntrip_C_settings() + ntrip_D_settings = rtkbaseconfig.get_ntrip_D_settings() local_ntripc_settings = rtkbaseconfig.get_local_ntripc_settings() rtcm_svr_settings = rtkbaseconfig.get_rtcm_svr_settings() rtcm_client_settings = rtkbaseconfig.get_rtcm_client_settings() @@ -469,6 +473,8 @@ def settings_page(): return render_template("settings.html", main_settings = main_settings, ntrip_A_settings = ntrip_A_settings, ntrip_B_settings = ntrip_B_settings, + ntrip_C_settings = ntrip_C_settings, + ntrip_D_settings = ntrip_D_settings, local_ntripc_settings = local_ntripc_settings, rtcm_svr_settings = rtcm_svr_settings, rtcm_client_settings = rtcm_client_settings, @@ -984,11 +990,15 @@ def update_settings(json_msg): #Restart service if needed if source_section == "main": - restartServices(("main", "ntrip_A", "ntrip_B", "local_ntrip_caster", "rtcm_svr", "rtcm_client", "rtcm_udp_svr", "rtcm_udp_client", "file", "rtcm_serial", "raw2nmea")) + restartServices(("main", "ntrip_A", "ntrip_B", "ntrip_C", "ntrip_D", "local_ntrip_caster", "rtcm_svr", "rtcm_client", "rtcm_udp_svr", "rtcm_udp_client", "file", "rtcm_serial", "raw2nmea")) elif source_section == "ntrip_A": restartServices(("ntrip_A",)) elif source_section == "ntrip_B": restartServices(("ntrip_B",)) + elif source_section == "ntrip_C": + restartServices(("ntrip_C",)) + elif source_section == "ntrip_D": + restartServices(("ntrip_D",)) elif source_section == "local_ntrip_caster": restartServices(("local_ntrip_caster",)) elif source_section == "rtcm_svr": diff --git a/web_app/static/settings.js b/web_app/static/settings.js index 5b64baae..ba0f452d 100644 --- a/web_app/static/settings.js +++ b/web_app/static/settings.js @@ -198,6 +198,62 @@ $(document).ready(function () { socket.emit("services switch", {"name" : "ntrip_B", "active" : switchStatus}); }) + // #################### NTRIP C service Switch ######################### + var ntrip_C_Switch = $('#ntrip_C-switch'); + // set the switch to on/off depending of the service status + if (servicesStatus[1].active === true) { + //document.querySelector("#main-switch").bootstrapToggle('on'); + ntrip_C_Switch.bootstrapToggle('on', true); + } else { + //document.querySelector("#main-switch").bootstrapToggle('off'); + ntrip_C_Switch.bootstrapToggle('off', true); + } + //console.log(servicesStatus[1]); + if (servicesStatus[1].btn_color) { + ntrip_C_Switch.bootstrapToggle('setOnStyle', servicesStatus[1].btn_color); + } + if (servicesStatus[1].btn_off_color) { + ntrip_C_Switch.bootstrapToggle('setOffStyle', servicesStatus[1].btn_off_color); + } + + // event for switching on/off service on user mouse click + //TODO When the switch changes its position, this event seems attached before + //the switch finish its transition, then fire another event. + $( "#ntrip_C-switch" ).one("change", function(e) { + var switchStatus = $(this).prop('checked'); + //console.log(" e : " + e); + //console.log("Ntrip SwitchStatus : " + switchStatus); + socket.emit("services switch", {"name" : "ntrip_C", "active" : switchStatus}); + }) + + // #################### NTRIP D service Switch ######################### + var ntrip_D_Switch = $('#ntrip_D-switch'); + // set the switch to on/off depending of the service status + if (servicesStatus[1].active === true) { + //document.querySelector("#main-switch").bootstrapToggle('on'); + ntrip_D_Switch.bootstrapToggle('on', true); + } else { + //document.querySelector("#main-switch").bootstrapToggle('off'); + ntrip_D_Switch.bootstrapToggle('off', true); + } + //console.log(servicesStatus[1]); + if (servicesStatus[1].btn_color) { + ntrip_D_Switch.bootstrapToggle('setOnStyle', servicesStatus[1].btn_color); + } + if (servicesStatus[1].btn_off_color) { + ntrip_D_Switch.bootstrapToggle('setOffStyle', servicesStatus[1].btn_off_color); + } + + // event for switching on/off service on user mouse click + //TODO When the switch changes its position, this event seems attached before + //the switch finish its transition, then fire another event. + $( "#ntrip_D-switch" ).one("change", function(e) { + var switchStatus = $(this).prop('checked'); + //console.log(" e : " + e); + //console.log("Ntrip SwitchStatus : " + switchStatus); + socket.emit("services switch", {"name" : "ntrip_D", "active" : switchStatus}); + }) + // ################ Local NTRIP Caster service Switch ##################### var ntripcSwitch = $('#ntripc-switch'); diff --git a/web_app/templates/settings.html b/web_app/templates/settings.html index 9690796d..1b76ade6 100644 --- a/web_app/templates/settings.html +++ b/web_app/templates/settings.html @@ -95,10 +95,10 @@