mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-19 10:30:02 +02:00
Versioning (#568)
- removed getClientServerAPIVersion in server (not used) - removed rxr side (clientversion compatibility check), removed enum as well as it is now done on the client side. - versionAPI.h - GITBRANCH changed to RELEASE - dates for all API changed to "sem_version date". Scripts to compile servers modified for this. Empty "branch" name will end up with developer for sem_version. - Version class with constructor taking in the long version (APILIB date). Other member functions including concise(to get sem_version for new releases and date for old releases), - bypassing initial tests, also now bypasses the client-rxr compatibility check (at rx_hostname command) - previously, compatibility between client-det was ensuring both had the same detector API (eg. same APIJUNGFRAU) - Now, compatibility only checks APILIB (client side) and detector API(eg. APIJUNGFRAU) (detector side) have same major version. It only does backward compatibility test. Rest is upto user to ensure. - If server is from an older release, it will compare dates like previous implementation (APIJUNGFRAU from both client and det) - - previously, compatibility between client-rxr was ensuring both had the same APIRECEIVER - Now, compatibility only checks APILIB (client side) and APIRECEIVER (rxr side) have same major version. It only does backward compatibility test. Rest is upto user to ensure. - If rxr is from an older release, it will compare dates like previous implementation (APIRECEIVER from both client and rxr) - removed APIGUI, evalVersionVariables.sh, genVersionHeader.sh (not needed or not used) - clientVersion, rxrversion and detectorserverversion all return strings and not integers (in hex) anymore. Depending if it has semantic versioning, it will print that or the date if it is too old. - fixed in python (strings for versions) - check_version function in detector server changed to "initial checks" as it only checks server-firmware compatibility and initial server checks. Client compatibilities are moved to client side. - --version gives sem_version and date? Is date needed as well. The clientversion, detserverversion and rxrversion API gives only sem_version (no date) - - formatting
This commit is contained in:
parent
b150db0fb3
commit
05f657c106
@ -1,24 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
GITREPO1='git remote -v'
|
||||
GITREPO2=" | grep \"fetch\" | cut -d' ' -f1"
|
||||
BRANCH1='git branch -v'
|
||||
BRANCH2=" | grep '*' | cut -d' ' -f2"
|
||||
REPUID1='git log --pretty=format:"%H" -1'
|
||||
AUTH1_1='git log --pretty=format:"%cn" -1'
|
||||
AUTH1_2=" | cut -d' ' -f1"
|
||||
AUTH2_1='git log --pretty=format:"%cn" -1'
|
||||
AUTH2_2=" | cut -d' ' -f2"
|
||||
FOLDERREV1='git log --oneline . ' #used for all the individual server folders
|
||||
FOLDERREV2=" | wc -l" #used for all the individual server folders
|
||||
REV1='git log --oneline '
|
||||
REV2=" | wc -l"
|
||||
|
||||
GITREPO=`eval $GITREPO1 $GITREPO2`
|
||||
BRANCH=`eval $BRANCH1 $BRANCH2`
|
||||
REPUID=`eval $REPUID1`
|
||||
AUTH1=`eval $AUTH1_1 $AUTH1_2`
|
||||
AUTH2=`eval $AUTH2_1 $AUTH2_2`
|
||||
REV=`eval $REV1 $REV2`
|
||||
FOLDERREV=`eval $FOLDERREV1 $FOLDERREV2`
|
||||
|
@ -1,27 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#####! /bin/awk -f
|
||||
|
||||
|
||||
if [ $# -lt 3 ]
|
||||
then
|
||||
echo "wrong usage"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
|
||||
fin=$1
|
||||
ftmp=$2
|
||||
fout=$3
|
||||
|
||||
|
||||
#dat=echo "date '+%Y%m%d'"
|
||||
|
||||
echo "Updating $fout"
|
||||
#echo "in: $fin tmp: $ftmp out: $fout"
|
||||
|
||||
#awk 'NR==FNR {if ($3=="Date:") {l[FNR]=$4; gsub("-","",l[FNR]);} else { if (match($0,"Rev")) {l[FNR]=$(NF);} else {l[FNR]="\""$(NF)"\"";};};next} {$0=$1" "$2" "l[FNR]}1' $fin $ftmp > $fout
|
||||
|
||||
awk 'BEGIN {l[0]=0; "date +%Y%m%d" | getline l[1]; l[2]="\"/\""; l[3]="\"nobody\""; l[3]="\"nobody\""; l[4]="\"0000-0000-0000\"";} \
|
||||
NR==FNR {if (match($0,"Rev")) {l[0]="0x"$(NF);} else if (match($0,"Date")) {l[1]="0x"$4; gsub("-","",l[1]);} else if (match($0,"URL")) {l[2]="\""$(NF)"\"";} else if (match($0,"Author")) {l[3]="\""$(NF)"\"";} else if (match($0,"UUID")) {l[4]="\""$(NF)"\"";} else if (match($0,"Branch")) {l[5]="\""$(NF)"\"";};next;}
|
||||
{if (match($2,"REV")) {$0=$1" "$2" "l[0];} else if (match($2,"DATE")) {$0=$1" "$2" "l[1];} else if (match($2,"URL")) {$0=$1" "$2" "l[2];} else if (match($2,"AUTH")) {$0=$1" "$2" "l[3];} else if (match($2,"UUID")) {$0=$1" "$2" "l[4];} else if (match($2,"BRANCH")) {$0=$1" "$2" "l[5];}}1' $fin $ftmp > $fout
|
@ -225,9 +225,9 @@ class Detector(CppDetectorApi):
|
||||
Example
|
||||
-------
|
||||
>>> d.detectorserverversion
|
||||
'0x200910'
|
||||
'7.0.0'
|
||||
"""
|
||||
return ut.lhex(self.getDetectorServerVersion())
|
||||
return self.getDetectorServerVersion()
|
||||
|
||||
@property
|
||||
@element
|
||||
@ -249,15 +249,15 @@ class Detector(CppDetectorApi):
|
||||
Example
|
||||
-------
|
||||
>>> d.clientversion
|
||||
'0x200810'
|
||||
'7.0.1'
|
||||
"""
|
||||
return hex(self.getClientVersion())
|
||||
return self.getClientVersion()
|
||||
|
||||
@property
|
||||
@element
|
||||
def rx_version(self):
|
||||
"""Receiver version in format [0xYYMMDD]."""
|
||||
return ut.lhex(self.getReceiverVersion())
|
||||
"""Receiver version """
|
||||
return self.getReceiverVersion()
|
||||
|
||||
@property
|
||||
@element
|
||||
|
@ -55,16 +55,17 @@ void init_det(py::module &m) {
|
||||
(int (Detector::*)() const) & Detector::getShmId);
|
||||
CppDetectorApi.def("getPackageVersion", (std::string(Detector::*)() const) &
|
||||
Detector::getPackageVersion);
|
||||
CppDetectorApi.def("getClientVersion", (int64_t(Detector::*)() const) &
|
||||
CppDetectorApi.def("getClientVersion", (std::string(Detector::*)() const) &
|
||||
Detector::getClientVersion);
|
||||
CppDetectorApi.def("getFirmwareVersion",
|
||||
(Result<int64_t>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getFirmwareVersion,
|
||||
py::arg() = Positions{});
|
||||
CppDetectorApi.def("getDetectorServerVersion",
|
||||
(Result<int64_t>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getDetectorServerVersion,
|
||||
py::arg() = Positions{});
|
||||
CppDetectorApi.def(
|
||||
"getDetectorServerVersion",
|
||||
(Result<std::string>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getDetectorServerVersion,
|
||||
py::arg() = Positions{});
|
||||
CppDetectorApi.def(
|
||||
"getKernelVersion",
|
||||
(Result<std::string>(Detector::*)(sls::Positions) const) &
|
||||
@ -78,10 +79,11 @@ void init_det(py::module &m) {
|
||||
(Result<int>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getModuleId,
|
||||
py::arg() = Positions{});
|
||||
CppDetectorApi.def("getReceiverVersion",
|
||||
(Result<int64_t>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getReceiverVersion,
|
||||
py::arg() = Positions{});
|
||||
CppDetectorApi.def(
|
||||
"getReceiverVersion",
|
||||
(Result<std::string>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getReceiverVersion,
|
||||
py::arg() = Positions{});
|
||||
CppDetectorApi.def(
|
||||
"getDetectorType",
|
||||
(Result<defs::detectorType>(Detector::*)(sls::Positions) const) &
|
||||
@ -202,6 +204,16 @@ void init_det(py::module &m) {
|
||||
CppDetectorApi.def(
|
||||
"setSynchronization",
|
||||
(void (Detector::*)(bool)) & Detector::setSynchronization, py::arg());
|
||||
CppDetectorApi.def(
|
||||
"getBadChannels",
|
||||
(void (Detector::*)(const std::string &, sls::Positions) const) &
|
||||
Detector::getBadChannels,
|
||||
py::arg(), py::arg() = Positions{});
|
||||
CppDetectorApi.def(
|
||||
"setBadChannels",
|
||||
(void (Detector::*)(const std::string &, sls::Positions)) &
|
||||
Detector::setBadChannels,
|
||||
py::arg(), py::arg() = Positions{});
|
||||
CppDetectorApi.def("isVirtualDetectorServer",
|
||||
(Result<bool>(Detector::*)(sls::Positions) const) &
|
||||
Detector::isVirtualDetectorServer,
|
||||
@ -1340,16 +1352,6 @@ void init_det(py::module &m) {
|
||||
(void (Detector::*)(const int, const int, const int, sls::Positions)) &
|
||||
Detector::setADCConfiguration,
|
||||
py::arg(), py::arg(), py::arg(), py::arg() = Positions{});
|
||||
CppDetectorApi.def(
|
||||
"getBadChannels",
|
||||
(void (Detector::*)(const std::string &, sls::Positions) const) &
|
||||
Detector::getBadChannels,
|
||||
py::arg(), py::arg() = Positions{});
|
||||
CppDetectorApi.def(
|
||||
"setBadChannels",
|
||||
(void (Detector::*)(const std::string &, sls::Positions)) &
|
||||
Detector::setBadChannels,
|
||||
py::arg(), py::arg() = Positions{});
|
||||
CppDetectorApi.def("getCounterMask",
|
||||
(Result<uint32_t>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getCounterMask,
|
||||
@ -1493,6 +1495,14 @@ void init_det(py::module &m) {
|
||||
(void (Detector::*)(defs::dacIndex, int, sls::Positions)) &
|
||||
Detector::setVoltage,
|
||||
py::arg(), py::arg(), py::arg() = Positions{});
|
||||
CppDetectorApi.def("getADCVpp",
|
||||
(Result<int>(Detector::*)(bool, sls::Positions) const) &
|
||||
Detector::getADCVpp,
|
||||
py::arg() = false, py::arg() = Positions{});
|
||||
CppDetectorApi.def("setADCVpp",
|
||||
(void (Detector::*)(int, bool, sls::Positions)) &
|
||||
Detector::setADCVpp,
|
||||
py::arg(), py::arg() = false, py::arg() = Positions{});
|
||||
CppDetectorApi.def("getADCEnableMask",
|
||||
(Result<uint32_t>(Detector::*)(sls::Positions) const) &
|
||||
Detector::getADCEnableMask,
|
||||
|
@ -21,16 +21,25 @@
|
||||
#include <QScrollArea>
|
||||
#include <QSizePolicy>
|
||||
|
||||
#include "sls/Version.h"
|
||||
#include <getopt.h>
|
||||
#include <string>
|
||||
#include <sys/stat.h>
|
||||
|
||||
std::string getClientVersion() {
|
||||
try {
|
||||
sls::Version v(APILIB);
|
||||
return v.concise();
|
||||
} catch (...) {
|
||||
return std::string("unknown");
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
// options
|
||||
std::string fname;
|
||||
bool isDeveloper = false;
|
||||
int64_t tempval = 0;
|
||||
int multiId = 0;
|
||||
|
||||
// parse command line for config
|
||||
@ -72,9 +81,7 @@ int main(int argc, char **argv) {
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
tempval = APIGUI;
|
||||
LOG(sls::logINFO) << "SLS Detector GUI " << GITBRANCH << " (0x"
|
||||
<< std::hex << tempval << ")";
|
||||
LOG(sls::logINFO) << "SLS Detector GUI " << getClientVersion();
|
||||
return 0;
|
||||
|
||||
case 'h':
|
||||
@ -463,10 +470,9 @@ void qDetectorMain::ExecuteHelp(QAction *action) {
|
||||
LOG(logINFO) << "About Common GUI for Jungfrau, Eiger, Mythen3, "
|
||||
"Gotthard, Gotthard2 and Moench detectors";
|
||||
|
||||
std::string guiVersion = ToStringHex(APIGUI);
|
||||
std::string clientVersion = "unknown";
|
||||
try {
|
||||
clientVersion = ToStringHex(det->getClientVersion());
|
||||
clientVersion = det->getClientVersion();
|
||||
}
|
||||
CATCH_DISPLAY("Could not get client version.",
|
||||
"qDetectorMain::ExecuteHelp")
|
||||
@ -475,9 +481,8 @@ void qDetectorMain::ExecuteHelp(QAction *action) {
|
||||
qDefs::INFORMATION,
|
||||
"<p style=\"font-family:verdana;\">"
|
||||
|
||||
"<b>SLS Detector GUI version: " +
|
||||
guiVersion +
|
||||
"<br>SLS Detector Client version: " + clientVersion +
|
||||
"<b>SLS Detector Client version: " +
|
||||
clientVersion +
|
||||
"</b><br><br>"
|
||||
|
||||
"Common GUI to control the SLS Detectors: "
|
||||
|
@ -184,10 +184,8 @@ void qTabDebugging::SetParameters(QTreeWidgetItem *item) {
|
||||
std::to_string((unsigned long)det->getFirmwareVersion(
|
||||
{comboDetector->currentIndex()})[0]);
|
||||
lblDetectorFirmware->setText(QString(retval.c_str()));
|
||||
retval =
|
||||
std::string("0x") +
|
||||
std::to_string((unsigned long)det->getDetectorServerVersion(
|
||||
{comboDetector->currentIndex()})[0]);
|
||||
retval = det->getDetectorServerVersion(
|
||||
{comboDetector->currentIndex()})[0];
|
||||
lblDetectorSoftware->setText(QString(retval.c_str()));
|
||||
}
|
||||
CATCH_DISPLAY("Could not get versions.", "qTabDebugging::SetParameters")
|
||||
|
@ -1,43 +1,84 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
|
||||
# empty branch = developer branch in updateAPIVersion.sh
|
||||
branch=""
|
||||
det_list=("ctbDetectorServer"
|
||||
"gotthardDetectorServer"
|
||||
"gotthard2DetectorServer"
|
||||
"jungfrauDetectorServer"
|
||||
"mythen3DetectorServer"
|
||||
"moenchDetectorServer"
|
||||
)
|
||||
usage="\nUsage: compileAllServers.sh [server|all(opt)] [branch(opt)]. \n\tNo arguments mean all servers with 'developer' branch. \n\tNo 'branch' input means 'developer branch'"
|
||||
|
||||
# arguments
|
||||
if [ $# -eq 0 ]; then
|
||||
declare -a det=("ctbDetectorServer"
|
||||
"gotthardDetectorServer"
|
||||
"gotthard2DetectorServer"
|
||||
"jungfrauDetectorServer"
|
||||
"mythen3DetectorServer"
|
||||
"moenchDetectorServer"
|
||||
)
|
||||
# no argument, all servers
|
||||
declare -a det=${det_list[@]}
|
||||
echo "Compiling all servers"
|
||||
elif [ $# -eq 1 ] || [ $# -eq 2 ]; then
|
||||
# 'all' servers
|
||||
if [[ $1 == "all" ]]; then
|
||||
declare -a det=${det_list[@]}
|
||||
echo "Compiling all servers"
|
||||
else
|
||||
# only one server
|
||||
# arg not in list
|
||||
if [[ $det_list != *$1* ]]; then
|
||||
echo -e "Invalid argument 1: $1. $usage"
|
||||
return -1
|
||||
fi
|
||||
declare -a det=("${1}")
|
||||
#echo "Compiling only $1"
|
||||
fi
|
||||
# branch
|
||||
if [ $# -eq 2 ]; then
|
||||
# arg in list
|
||||
if [[ $det_list == *$2* ]]; then
|
||||
echo -e "Invalid argument 2: $2. $usage"
|
||||
return -1
|
||||
fi
|
||||
branch+=$2
|
||||
#echo "with branch $branch"
|
||||
fi
|
||||
else
|
||||
declare -a det=("${1}")
|
||||
echo -e "Too many arguments.$usage"
|
||||
return -1
|
||||
fi
|
||||
|
||||
declare -a deterror=("OK" "OK" "OK" "OK" "OK" "OK")
|
||||
|
||||
for ((i=0;i<${#det[@]};++i))
|
||||
echo -e "list is ${det[@]}"
|
||||
|
||||
# compile each server
|
||||
idet=0
|
||||
for i in ${det[@]}
|
||||
do
|
||||
dir=${det[i]}
|
||||
file="${det[i]}_developer"
|
||||
dir=$i
|
||||
file="${i}_developer"
|
||||
echo -e "Compiling $dir [$file]"
|
||||
cd $dir
|
||||
make clean
|
||||
if make version; then
|
||||
deterror[i]="OK"
|
||||
if make version API_BRANCH=$branch; then
|
||||
deterror[$idet]="OK"
|
||||
else
|
||||
deterror[i]="FAIL"
|
||||
deterror[$idet]="FAIL"
|
||||
fi
|
||||
|
||||
mv bin/$dir bin/$file
|
||||
git add -f bin/$file
|
||||
cp bin/$file /tftpboot/
|
||||
cd ..
|
||||
echo -e "\n\n"
|
||||
((++idet))
|
||||
done
|
||||
|
||||
echo -e "Results:"
|
||||
for ((i=0;i<${#det[@]};++i))
|
||||
idet=0
|
||||
for i in ${det[@]}
|
||||
do
|
||||
printf "%s\t\t= %s\n" "${det[i]}" "${deterror[i]}"
|
||||
printf "%s\t\t= %s\n" "$i" "${deterror[$idet]}"
|
||||
((++idet))
|
||||
done
|
||||
|
||||
|
||||
|
@ -1,32 +1,32 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
declare -a det=("eigerDetectorServer")
|
||||
deterror="OK"
|
||||
dir="eigerDetectorServer"
|
||||
file="${dir}_developer"
|
||||
branch=""
|
||||
|
||||
declare -a deterror=("OK" "OK" "OK" "OK")
|
||||
# arguments
|
||||
if [ $# -eq 1 ]; then
|
||||
branch+=$1
|
||||
#echo "with branch $branch"
|
||||
elif [ ! $# -eq 0 ]; then
|
||||
echo -e "Only one optional argument allowed for branch."
|
||||
return -1
|
||||
fi
|
||||
|
||||
for ((i=0;i<${#det[@]};++i))
|
||||
do
|
||||
dir=${det[i]}
|
||||
file="${det[i]}_developer"
|
||||
echo -e "Compiling $dir [$file]"
|
||||
cd $dir
|
||||
make clean
|
||||
if make version; then
|
||||
deterror[i]="OK"
|
||||
else
|
||||
deterror[i]="FAIL"
|
||||
fi
|
||||
|
||||
mv bin/$dir bin/$file
|
||||
git add -f bin/$file
|
||||
cp bin/$file /tftpboot/
|
||||
cd ..
|
||||
echo -e "\n\n"
|
||||
done
|
||||
|
||||
echo -e "Results:"
|
||||
for ((i=0;i<${#det[@]};++i))
|
||||
do
|
||||
printf "%s\t\t= %s\n" "${det[i]}" "${deterror[i]}"
|
||||
done
|
||||
echo -e "Compiling $dir [$file]"
|
||||
cd $dir
|
||||
make clean
|
||||
if make version API_BRANCH=$branch; then
|
||||
deterror="OK"
|
||||
else
|
||||
deterror="FAIL"
|
||||
fi
|
||||
|
||||
mv bin/$dir bin/$file
|
||||
git add -f bin/$file
|
||||
cp bin/$file /tftpboot/
|
||||
cd ..
|
||||
echo -e "\n\n"
|
||||
printf "Result:\t\t= %s\n" "${deterror}"
|
||||
|
||||
|
@ -25,10 +25,11 @@ version: clean versioning $(PROGS)
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
version_branch=$(API_BRANCH)
|
||||
version_name=APICTB
|
||||
version_path=slsDetectorServers/ctbDetectorServer
|
||||
versioning:
|
||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path); tput sgr0;`
|
||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path) $(version_branch); tput sgr0;`
|
||||
|
||||
|
||||
$(PROGS): $(OBJS)
|
||||
|
Binary file not shown.
@ -121,9 +121,10 @@ void basictests() {
|
||||
uint32_t ipadd = getDetectorIP();
|
||||
uint64_t macadd = getDetectorMAC();
|
||||
int64_t fwversion = getFirmwareVersion();
|
||||
int64_t swversion = getServerVersion();
|
||||
char swversion[MAX_STR_LENGTH] = {0};
|
||||
memset(swversion, 0, MAX_STR_LENGTH);
|
||||
getServerVersion(swversion);
|
||||
int64_t sw_fw_apiversion = 0;
|
||||
int64_t client_sw_apiversion = getClientServerAPIVersion();
|
||||
|
||||
if (fwversion >= MIN_REQRD_VRSN_T_RD_API)
|
||||
sw_fw_apiversion = getFirmwareAPIVersion();
|
||||
@ -136,15 +137,13 @@ void basictests() {
|
||||
"Detector MAC Addr:\t\t 0x%llx\n\n"
|
||||
|
||||
"Firmware Version:\t\t 0x%llx\n"
|
||||
"Software Version:\t\t 0x%llx\n"
|
||||
"Software Version:\t\t %s\n"
|
||||
"F/w-S/w API Version:\t\t 0x%llx\n"
|
||||
"Required Firmware Version:\t 0x%x\n"
|
||||
"Client-Software API Version:\t 0x%llx\n"
|
||||
"********************************************************\n",
|
||||
hversion, hsnumber, ipadd, (long long unsigned int)macadd,
|
||||
(long long int)fwversion, (long long int)swversion,
|
||||
(long long int)sw_fw_apiversion, REQRD_FRMWR_VRSN,
|
||||
(long long int)client_sw_apiversion));
|
||||
(long long int)fwversion, swversion, (long long int)sw_fw_apiversion,
|
||||
REQRD_FRMWR_VRSN));
|
||||
|
||||
#ifndef VIRTUAL
|
||||
// return if flag is not zero, debug mode
|
||||
@ -325,9 +324,7 @@ int testBus() {
|
||||
|
||||
/* Ids */
|
||||
|
||||
uint64_t getServerVersion() { return APICTB; }
|
||||
|
||||
uint64_t getClientServerAPIVersion() { return APICTB; }
|
||||
void getServerVersion(char *version) { strcpy(version, APICTB); }
|
||||
|
||||
uint64_t getFirmwareVersion() {
|
||||
#ifdef VIRTUAL
|
||||
|
@ -25,10 +25,11 @@ version: clean versioning $(PROGS) #hv9m_blackfin_server
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
version_branch=$(API_BRANCH)
|
||||
version_name=APIEIGER
|
||||
version_path=slsDetectorServers/eigerDetectorServer
|
||||
versioning:
|
||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path); tput sgr0;`
|
||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path) $(version_branch); tput sgr0;`
|
||||
|
||||
|
||||
$(PROGS): $(OBJS)
|
||||
|
Binary file not shown.
@ -117,9 +117,10 @@ void basictests() {
|
||||
uint32_t ipadd = getDetectorIP();
|
||||
uint64_t macadd = getDetectorMAC();
|
||||
int64_t fwversion = getFirmwareVersion();
|
||||
int64_t swversion = getServerVersion();
|
||||
char swversion[MAX_STR_LENGTH] = {0};
|
||||
memset(swversion, 0, MAX_STR_LENGTH);
|
||||
getServerVersion(swversion);
|
||||
int64_t sw_fw_apiversion = getFirmwareAPIVersion();
|
||||
int64_t client_sw_apiversion = getClientServerAPIVersion();
|
||||
|
||||
LOG(logINFOBLUE,
|
||||
("**************************************************\n"
|
||||
@ -127,16 +128,13 @@ void basictests() {
|
||||
"Detector MAC Addr:\t\t 0x%llx\n"
|
||||
|
||||
"Firmware Version:\t\t %lld\n"
|
||||
"Software Version:\t\t 0x%llx\n"
|
||||
"Software Version:\t\t %s\n"
|
||||
"F/w-S/w API Version:\t\t %lld\n"
|
||||
"Required Firmware Version:\t %d\n"
|
||||
"Client-Software API Version:\t 0x%llx\n"
|
||||
"\n"
|
||||
"********************************************************\n",
|
||||
(unsigned int)ipadd, (long long unsigned int)macadd,
|
||||
(long long int)fwversion, (long long int)swversion,
|
||||
(long long int)sw_fw_apiversion, REQUIRED_FIRMWARE_VERSION,
|
||||
(long long int)client_sw_apiversion));
|
||||
(long long int)fwversion, swversion, (long long int)sw_fw_apiversion,
|
||||
REQUIRED_FIRMWARE_VERSION));
|
||||
|
||||
// update default udpdstip and udpdstmac (1g is hardware ip and hardware
|
||||
// mac)
|
||||
@ -208,9 +206,7 @@ int getTestImageMode() { return eiger_virtual_test_mode; }
|
||||
|
||||
/* Ids */
|
||||
|
||||
uint64_t getServerVersion() { return APIEIGER; }
|
||||
|
||||
uint64_t getClientServerAPIVersion() { return APIEIGER; }
|
||||
void getServerVersion(char *version) { strcpy(version, APIEIGER); }
|
||||
|
||||
u_int64_t getFirmwareVersion() {
|
||||
#ifdef VIRTUAL
|
||||
|
@ -24,10 +24,11 @@ version: clean versioning $(PROGS)
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
version_branch=$(API_BRANCH)
|
||||
version_name=APIGOTTHARD2
|
||||
version_path=slsDetectorServers/gotthard2DetectorServer
|
||||
versioning:
|
||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path); tput sgr0;`
|
||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path) $(version_branch); tput sgr0;`
|
||||
|
||||
|
||||
$(PROGS): $(OBJS)
|
||||
|
1
slsDetectorServers/gotthard2DetectorServer/bin/detid_gotthard2.txt
Executable file
1
slsDetectorServers/gotthard2DetectorServer/bin/detid_gotthard2.txt
Executable file
@ -0,0 +1 @@
|
||||
1234
|
Binary file not shown.
@ -117,9 +117,10 @@ void basictests() {
|
||||
uint32_t ipadd = getDetectorIP();
|
||||
uint64_t macadd = getDetectorMAC();
|
||||
int64_t fwversion = getFirmwareVersion();
|
||||
int64_t swversion = getServerVersion();
|
||||
char swversion[MAX_STR_LENGTH] = {0};
|
||||
memset(swversion, 0, MAX_STR_LENGTH);
|
||||
getServerVersion(swversion);
|
||||
int64_t sw_fw_apiversion = getFirmwareAPIVersion();
|
||||
int64_t client_sw_apiversion = getClientServerAPIVersion();
|
||||
uint32_t requiredFirmwareVersion = REQRD_FRMWRE_VRSN;
|
||||
|
||||
LOG(logINFOBLUE,
|
||||
@ -130,15 +131,13 @@ void basictests() {
|
||||
"Detector MAC Addr:\t\t 0x%llx\n\n"
|
||||
|
||||
"Firmware Version:\t\t 0x%llx\n"
|
||||
"Software Version:\t\t 0x%llx\n"
|
||||
"Software Version:\t\t %s\n"
|
||||
"F/w-S/w API Version:\t\t 0x%llx\n"
|
||||
"Required Firmware Version:\t 0x%x\n"
|
||||
"Client-Software API Version:\t 0x%llx\n"
|
||||
"********************************************************\n",
|
||||
hversion, ipadd, (long long unsigned int)macadd,
|
||||
(long long int)fwversion, (long long int)swversion,
|
||||
(long long int)sw_fw_apiversion, requiredFirmwareVersion,
|
||||
(long long int)client_sw_apiversion));
|
||||
(long long int)fwversion, swversion, (long long int)sw_fw_apiversion,
|
||||
requiredFirmwareVersion));
|
||||
|
||||
#ifndef VIRTUAL
|
||||
// return if flag is not zero, debug mode
|
||||
@ -251,9 +250,7 @@ int testBus() {
|
||||
|
||||
/* Ids */
|
||||
|
||||
uint64_t getServerVersion() { return APIGOTTHARD2; }
|
||||
|
||||
uint64_t getClientServerAPIVersion() { return APIGOTTHARD2; }
|
||||
void getServerVersion(char *version) { strcpy(version, APIGOTTHARD2); }
|
||||
|
||||
u_int64_t getFirmwareVersion() {
|
||||
#ifdef VIRTUAL
|
||||
|
@ -23,10 +23,11 @@ version: clean versioning $(PROGS)
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
version_branch=$(API_BRANCH)
|
||||
version_name=APIGOTTHARD
|
||||
version_path=slsDetectorServers/gotthardDetectorServer
|
||||
versioning:
|
||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path); tput sgr0;`
|
||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path) $(version_branch); tput sgr0;`
|
||||
|
||||
|
||||
$(PROGS): $(OBJS)
|
||||
|
Binary file not shown.
@ -107,8 +107,9 @@ void basictests() {
|
||||
uint32_t ipadd = getDetectorIP();
|
||||
uint64_t macadd = getDetectorMAC();
|
||||
int64_t fwversion = getFirmwareVersion();
|
||||
int64_t swversion = getServerVersion();
|
||||
int64_t client_sw_apiversion = getClientServerAPIVersion();
|
||||
char swversion[MAX_STR_LENGTH] = {0};
|
||||
memset(swversion, 0, MAX_STR_LENGTH);
|
||||
getServerVersion(swversion);
|
||||
|
||||
LOG(logINFOBLUE,
|
||||
("**************************************************\n"
|
||||
@ -118,15 +119,13 @@ void basictests() {
|
||||
"Detector MAC Addr : 0x%llx\n\n"
|
||||
|
||||
"Firmware Version : 0x%llx\n"
|
||||
"Software Version : 0x%llx\n"
|
||||
"Client-S/w API Version : 0x%llx\n"
|
||||
"Software Version : %s\n"
|
||||
"********************************************************\n",
|
||||
boardrev,
|
||||
|
||||
ipadd, (long long unsigned int)macadd,
|
||||
|
||||
(long long int)fwversion, (long long int)swversion,
|
||||
(long long int)client_sw_apiversion));
|
||||
(long long int)fwversion, swversion));
|
||||
|
||||
#ifndef VIRTUAL
|
||||
if (!debugflag || updateFlag) {
|
||||
@ -270,9 +269,7 @@ int getTestImageMode() {
|
||||
|
||||
/* Ids */
|
||||
|
||||
uint64_t getServerVersion() { return APIGOTTHARD; }
|
||||
|
||||
uint64_t getClientServerAPIVersion() { return APIGOTTHARD; }
|
||||
void getServerVersion(char *version) { strcpy(version, APIGOTTHARD); }
|
||||
|
||||
u_int64_t getFirmwareVersion() {
|
||||
#ifdef VIRTUAL
|
||||
|
@ -24,10 +24,11 @@ version: clean versioning $(PROGS)
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
version_branch=$(API_BRANCH)
|
||||
version_name=APIJUNGFRAU
|
||||
version_path=slsDetectorServers/jungfrauDetectorServer
|
||||
versioning:
|
||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path); tput sgr0;`
|
||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path) $(version_branch); tput sgr0;`
|
||||
|
||||
|
||||
$(PROGS): $(OBJS)
|
||||
|
4
slsDetectorServers/jungfrauDetectorServer/bin/config_jungfrau.txt
Executable file
4
slsDetectorServers/jungfrauDetectorServer/bin/config_jungfrau.txt
Executable file
@ -0,0 +1,4 @@
|
||||
|
||||
|
||||
#chip version version (multiplied by 10)
|
||||
chipversion 11
|
Binary file not shown.
@ -102,9 +102,10 @@ void basictests() {
|
||||
uint32_t ipadd = getDetectorIP();
|
||||
uint64_t macadd = getDetectorMAC();
|
||||
int64_t fwversion = getFirmwareVersion();
|
||||
int64_t swversion = getServerVersion();
|
||||
char swversion[MAX_STR_LENGTH] = {0};
|
||||
memset(swversion, 0, MAX_STR_LENGTH);
|
||||
getServerVersion(swversion);
|
||||
int64_t sw_fw_apiversion = 0;
|
||||
int64_t client_sw_apiversion = getClientServerAPIVersion();
|
||||
uint32_t requiredFirmwareVersion =
|
||||
(isHardwareVersion2() ? REQRD_FRMWRE_VRSN_BOARD2 : REQRD_FRMWRE_VRSN);
|
||||
|
||||
@ -120,15 +121,13 @@ void basictests() {
|
||||
"Detector MAC Addr:\t\t 0x%llx\n\n"
|
||||
|
||||
"Firmware Version:\t\t 0x%llx\n"
|
||||
"Software Version:\t\t 0x%llx\n"
|
||||
"Software Version:\t\t %s\n"
|
||||
"F/w-S/w API Version:\t\t 0x%llx\n"
|
||||
"Required Firmware Version:\t 0x%x\n"
|
||||
"Client-Software API Version:\t 0x%llx\n"
|
||||
"********************************************************\n",
|
||||
hversion, hsnumber, ipadd, (long long unsigned int)macadd,
|
||||
(long long int)fwversion, (long long int)swversion,
|
||||
(long long int)sw_fw_apiversion, requiredFirmwareVersion,
|
||||
(long long int)client_sw_apiversion));
|
||||
(long long int)fwversion, swversion, (long long int)sw_fw_apiversion,
|
||||
requiredFirmwareVersion));
|
||||
|
||||
#ifndef VIRTUAL
|
||||
// return if flag is not zero, debug mode
|
||||
@ -257,9 +256,7 @@ int getTestImageMode() { return virtual_image_test_mode; }
|
||||
|
||||
/* Ids */
|
||||
|
||||
uint64_t getServerVersion() { return APIJUNGFRAU; }
|
||||
|
||||
uint64_t getClientServerAPIVersion() { return APIJUNGFRAU; }
|
||||
void getServerVersion(char *version) { strcpy(version, APIJUNGFRAU); }
|
||||
|
||||
u_int64_t getFirmwareVersion() {
|
||||
#ifdef VIRTUAL
|
||||
|
@ -25,10 +25,11 @@ version: clean versioning $(PROGS)
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
version_branch=$(API_BRANCH)
|
||||
version_name=APIMOENCH
|
||||
version_path=slsDetectorServers/moenchDetectorServer
|
||||
versioning:
|
||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path); tput sgr0;`
|
||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path) $(version_branch); tput sgr0;`
|
||||
|
||||
|
||||
$(PROGS): $(OBJS)
|
||||
|
Binary file not shown.
@ -125,9 +125,10 @@ void basictests() {
|
||||
uint32_t ipadd = getDetectorIP();
|
||||
uint64_t macadd = getDetectorMAC();
|
||||
int64_t fwversion = getFirmwareVersion();
|
||||
int64_t swversion = getServerVersion();
|
||||
char swversion[MAX_STR_LENGTH] = {0};
|
||||
memset(swversion, 0, MAX_STR_LENGTH);
|
||||
getServerVersion(swversion);
|
||||
int64_t sw_fw_apiversion = 0;
|
||||
int64_t client_sw_apiversion = getClientServerAPIVersion();
|
||||
|
||||
if (fwversion >= MIN_REQRD_VRSN_T_RD_API)
|
||||
sw_fw_apiversion = getFirmwareAPIVersion();
|
||||
@ -140,15 +141,13 @@ void basictests() {
|
||||
"Detector MAC Addr:\t\t 0x%llx\n\n"
|
||||
|
||||
"Firmware Version:\t\t 0x%llx\n"
|
||||
"Software Version:\t\t 0x%llx\n"
|
||||
"Software Version:\t\t %s\n"
|
||||
"F/w-S/w API Version:\t\t 0x%llx\n"
|
||||
"Required Firmware Version:\t 0x%x\n"
|
||||
"Client-Software API Version:\t 0x%llx\n"
|
||||
"********************************************************\n",
|
||||
hversion, hsnumber, ipadd, (long long unsigned int)macadd,
|
||||
(long long int)fwversion, (long long int)swversion,
|
||||
(long long int)sw_fw_apiversion, REQRD_FRMWR_VRSN,
|
||||
(long long int)client_sw_apiversion));
|
||||
(long long int)fwversion, swversion, (long long int)sw_fw_apiversion,
|
||||
REQRD_FRMWR_VRSN));
|
||||
|
||||
#ifndef VIRTUAL
|
||||
// return if flag is not zero, debug mode
|
||||
@ -329,9 +328,7 @@ int testBus() {
|
||||
|
||||
/* Ids */
|
||||
|
||||
uint64_t getServerVersion() { return APIMOENCH; }
|
||||
|
||||
uint64_t getClientServerAPIVersion() { return APIMOENCH; }
|
||||
void getServerVersion(char *version) { strcpy(version, APIMOENCH); }
|
||||
|
||||
uint64_t getFirmwareVersion() {
|
||||
#ifdef VIRTUAL
|
||||
|
@ -25,10 +25,11 @@ version: clean versioning $(PROGS)
|
||||
|
||||
boot: $(OBJS)
|
||||
|
||||
version_branch=$(API_BRANCH)
|
||||
version_name=APIMYTHEN3
|
||||
version_path=slsDetectorServers/mythen3DetectorServer
|
||||
versioning:
|
||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path); tput sgr0;`
|
||||
cd ../../ && echo $(PWD) && echo `tput setaf 6; ./updateAPIVersion.sh $(version_name) $(version_path) $(version_branch); tput sgr0;`
|
||||
|
||||
|
||||
$(PROGS): $(OBJS)
|
||||
|
1
slsDetectorServers/mythen3DetectorServer/bin/detid_mythen3.txt
Executable file
1
slsDetectorServers/mythen3DetectorServer/bin/detid_mythen3.txt
Executable file
@ -0,0 +1 @@
|
||||
0
|
Binary file not shown.
@ -110,10 +110,10 @@ void basictests() {
|
||||
uint32_t ipadd = getDetectorIP();
|
||||
uint64_t macadd = getDetectorMAC();
|
||||
int64_t fwversion = getFirmwareVersion();
|
||||
int64_t swversion = getServerVersion();
|
||||
char swversion[MAX_STR_LENGTH] = {0};
|
||||
memset(swversion, 0, MAX_STR_LENGTH);
|
||||
getServerVersion(swversion);
|
||||
int64_t sw_fw_apiversion = getFirmwareAPIVersion();
|
||||
;
|
||||
int64_t client_sw_apiversion = getClientServerAPIVersion();
|
||||
uint32_t requiredFirmwareVersion = REQRD_FRMWRE_VRSN;
|
||||
|
||||
LOG(logINFOBLUE,
|
||||
@ -124,15 +124,13 @@ void basictests() {
|
||||
"Detector MAC Addr:\t\t 0x%llx\n\n"
|
||||
|
||||
"Firmware Version:\t\t 0x%llx\n"
|
||||
"Software Version:\t\t 0x%llx\n"
|
||||
"Software Version:\t\t %s\n"
|
||||
"F/w-S/w API Version:\t\t 0x%llx\n"
|
||||
"Required Firmware Version:\t 0x%x\n"
|
||||
"Client-Software API Version:\t 0x%llx\n"
|
||||
"********************************************************\n",
|
||||
hversion, ipadd, (long long unsigned int)macadd,
|
||||
(long long int)fwversion, (long long int)swversion,
|
||||
(long long int)sw_fw_apiversion, requiredFirmwareVersion,
|
||||
(long long int)client_sw_apiversion));
|
||||
(long long int)fwversion, swversion, (long long int)sw_fw_apiversion,
|
||||
requiredFirmwareVersion));
|
||||
|
||||
#ifndef VIRTUAL
|
||||
// return if flag is not zero, debug mode
|
||||
@ -245,9 +243,7 @@ int testBus() {
|
||||
|
||||
/* Ids */
|
||||
|
||||
uint64_t getServerVersion() { return APIMYTHEN3; }
|
||||
|
||||
uint64_t getClientServerAPIVersion() { return APIMYTHEN3; }
|
||||
void getServerVersion(char *version) { strcpy(version, APIMYTHEN3); }
|
||||
|
||||
u_int64_t getFirmwareVersion() {
|
||||
#ifdef VIRTUAL
|
||||
|
@ -75,8 +75,7 @@ int getTestImageMode();
|
||||
#endif
|
||||
|
||||
// Ids
|
||||
u_int64_t getServerVersion();
|
||||
u_int64_t getClientServerAPIVersion();
|
||||
void getServerVersion(char *version);
|
||||
u_int64_t getFirmwareVersion();
|
||||
u_int64_t getFirmwareAPIVersion();
|
||||
#if defined(JUNGFRAUD) || defined(CHIPTESTBOARDD) || defined(MOENCHD) || \
|
||||
|
@ -127,7 +127,7 @@ int temp_control(int);
|
||||
int temp_event(int);
|
||||
int auto_comp_disable(int);
|
||||
int storage_cell_start(int);
|
||||
int check_version(int);
|
||||
int initial_checks(int);
|
||||
int software_trigger(int);
|
||||
int led(int);
|
||||
int digital_io_delay(int);
|
||||
|
@ -55,7 +55,8 @@ int main(int argc, char *argv[]) {
|
||||
debugflag = 0;
|
||||
updateFlag = 0;
|
||||
checkModuleFlag = 1;
|
||||
int version = 0;
|
||||
char version[MAX_STR_LENGTH] = {0};
|
||||
memset(version, 0, MAX_STR_LENGTH);
|
||||
ignoreConfigFileFlag = 0;
|
||||
#if defined(GOTTHARDD) || defined(GOTTHARD2D) || defined(EIGERD) || \
|
||||
defined(MYTHEN3D)
|
||||
@ -142,22 +143,21 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
case 'v':
|
||||
#ifdef GOTTHARDD
|
||||
version = APIGOTTHARD;
|
||||
strcpy(version, APIGOTTHARD);
|
||||
#elif EIGERD
|
||||
version = APIEIGER;
|
||||
strcpy(version, APIEIGER);
|
||||
#elif JUNGFRAUD
|
||||
version = APIJUNGFRAU;
|
||||
strcpy(version, APIJUNGFRAU);
|
||||
#elif CHIPTESTBOARDD
|
||||
version = APICTB;
|
||||
strcpy(version, APICTB);
|
||||
#elif MOENCHD
|
||||
version = APIMOENCH;
|
||||
strcpy(version, APIMOENCH);
|
||||
#elif MYTHEN3D
|
||||
version = APIMYTHEN3;
|
||||
strcpy(version, APIMYTHEN3);
|
||||
#elif GOTTHARD2D
|
||||
version = APIGOTTHARD2;
|
||||
strcpy(version, APIGOTTHARD2);
|
||||
#endif
|
||||
LOG(logINFO, ("SLS Detector Server Version: %s (0x%x)\n", GITBRANCH,
|
||||
version));
|
||||
LOG(logINFO, ("SLS Detector Server Version: %s\n", version));
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
case 'p':
|
||||
|
@ -84,7 +84,7 @@ int updateModeAllowedFunction(int file_des) {
|
||||
F_EXEC_COMMAND, F_GET_DETECTOR_TYPE, F_GET_FIRMWARE_VERSION,
|
||||
F_GET_SERVER_VERSION, F_GET_SERIAL_NUMBER, F_WRITE_REGISTER,
|
||||
F_READ_REGISTER, F_LOCK_SERVER, F_GET_LAST_CLIENT_IP,
|
||||
F_PROGRAM_FPGA, F_RESET_FPGA, F_CHECK_VERSION,
|
||||
F_PROGRAM_FPGA, F_RESET_FPGA, F_INITIAL_CHECKS,
|
||||
F_REBOOT_CONTROLLER, F_GET_KERNEL_VERSION, F_UPDATE_KERNEL,
|
||||
F_UPDATE_DETECTOR_SERVER, F_GET_UPDATE_MODE, F_SET_UPDATE_MODE,
|
||||
F_GET_NUM_CHANNELS, F_GET_NUM_INTERFACES, F_ACTIVATE};
|
||||
@ -303,7 +303,7 @@ void function_table() {
|
||||
flist[F_TEMP_EVENT] = &temp_event;
|
||||
flist[F_AUTO_COMP_DISABLE] = &auto_comp_disable;
|
||||
flist[F_STORAGE_CELL_START] = &storage_cell_start;
|
||||
flist[F_CHECK_VERSION] = &check_version;
|
||||
flist[F_INITIAL_CHECKS] = &initial_checks;
|
||||
flist[F_SOFTWARE_TRIGGER] = &software_trigger;
|
||||
flist[F_LED] = &led;
|
||||
flist[F_DIGITAL_IO_DELAY] = &digital_io_delay;
|
||||
@ -737,10 +737,11 @@ int get_firmware_version(int file_des) {
|
||||
int get_server_version(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t retval = -1;
|
||||
retval = getServerVersion();
|
||||
LOG(logDEBUG1, ("server version retval: 0x%llx\n", (long long int)retval));
|
||||
return Server_SendResult(file_des, INT64, &retval, sizeof(retval));
|
||||
char retvals[MAX_STR_LENGTH];
|
||||
memset(retvals, 0, MAX_STR_LENGTH);
|
||||
getServerVersion(retvals);
|
||||
LOG(logDEBUG1, ("server version retval: %s\n", retvals));
|
||||
return Server_SendResult(file_des, OTHER, retvals, sizeof(retvals));
|
||||
}
|
||||
|
||||
int get_serial_number(int file_des) {
|
||||
@ -4075,13 +4076,9 @@ int storage_cell_start(int file_des) {
|
||||
return Server_SendResult(file_des, INT32, &retval, sizeof(retval));
|
||||
}
|
||||
|
||||
int check_version(int file_des) {
|
||||
int initial_checks(int file_des) {
|
||||
ret = OK;
|
||||
memset(mess, 0, sizeof(mess));
|
||||
int64_t arg = -1;
|
||||
|
||||
if (receiveData(file_des, &arg, sizeof(arg), INT64) < 0)
|
||||
return printSocketReadError();
|
||||
|
||||
// check software- firmware compatibility and basic tests
|
||||
LOG(logDEBUG1, ("Checking software-firmware compatibility and basic "
|
||||
@ -4107,39 +4104,6 @@ int check_version(int file_des) {
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
|
||||
if (ret == OK) {
|
||||
LOG(logDEBUG1,
|
||||
("Checking versioning compatibility with value 0x%llx\n", arg));
|
||||
|
||||
int64_t client_requiredVersion = arg;
|
||||
int64_t det_apiVersion = getClientServerAPIVersion();
|
||||
int64_t det_version = getServerVersion();
|
||||
|
||||
// old client
|
||||
if (det_apiVersion > client_requiredVersion) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Client's detector SW API version: (0x%llx). "
|
||||
"Detector's SW API Version: (0x%llx). "
|
||||
"Incompatible, update client!\n",
|
||||
(long long int)client_requiredVersion,
|
||||
(long long int)det_apiVersion);
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
|
||||
// old software
|
||||
else if (client_requiredVersion > det_version) {
|
||||
ret = FAIL;
|
||||
sprintf(mess,
|
||||
"Detector SW Version: (0x%llx). "
|
||||
"Client's detector SW API Version: (0x%llx). "
|
||||
"Incompatible, update detector software!\n",
|
||||
(long long int)det_version,
|
||||
(long long int)client_requiredVersion);
|
||||
LOG(logERROR, (mess));
|
||||
}
|
||||
}
|
||||
return Server_SendResult(file_des, INT32, NULL, 0);
|
||||
}
|
||||
|
||||
|
@ -74,11 +74,11 @@ class Detector {
|
||||
/** package git branch */
|
||||
std::string getPackageVersion() const;
|
||||
|
||||
int64_t getClientVersion() const;
|
||||
std::string getClientVersion() const;
|
||||
|
||||
Result<int64_t> getFirmwareVersion(Positions pos = {}) const;
|
||||
|
||||
Result<int64_t> getDetectorServerVersion(Positions pos = {}) const;
|
||||
Result<std::string> getDetectorServerVersion(Positions pos = {}) const;
|
||||
|
||||
Result<std::string> getKernelVersion(Positions pos = {}) const;
|
||||
|
||||
@ -89,7 +89,7 @@ class Detector {
|
||||
* streamed out in the UDP header of the detector.*/
|
||||
Result<int> getModuleId(Positions pos = {}) const;
|
||||
|
||||
Result<int64_t> getReceiverVersion(Positions pos = {}) const;
|
||||
Result<std::string> getReceiverVersion(Positions pos = {}) const;
|
||||
|
||||
/** Options: EIGER, JUNGFRAU, GOTTHARD, MOENCH, MYTHEN3, GOTTHARD2,
|
||||
* CHIPTESTBOARD */
|
||||
|
@ -37,9 +37,7 @@ int main(int argc, char *argv[]) {
|
||||
// Check for --version in the arguments
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
if (!(strcmp(argv[i], "--version")) || !(strcmp(argv[i], "-v"))) {
|
||||
int64_t tempval = APILIB;
|
||||
std::cout << argv[0] << " " << GITBRANCH << " (0x" << std::hex
|
||||
<< tempval << ")" << std::endl;
|
||||
std::cout << argv[0] << " " << APILIB << std::endl;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -277,21 +277,20 @@ std::string CmdProxy::Versions(int action) {
|
||||
auto t = det->getFirmwareVersion(std::vector<int>{det_id});
|
||||
os << "\nDetector Type: " << OutString(det->getDetectorType())
|
||||
<< "\nPackage Version: " << det->getPackageVersion() << std::hex
|
||||
<< "\nClient Version: 0x" << det->getClientVersion();
|
||||
<< "\nClient Version: " << det->getClientVersion();
|
||||
if (det->getDetectorType().squash() == defs::EIGER) {
|
||||
os << "\nFirmware Version: " << OutString(t);
|
||||
} else {
|
||||
os << "\nFirmware Version: " << OutStringHex(t);
|
||||
}
|
||||
os << "\nDetector Server Version: "
|
||||
<< OutStringHex(
|
||||
<< OutString(
|
||||
det->getDetectorServerVersion(std::vector<int>{det_id}));
|
||||
os << "\nDetector Server Version: "
|
||||
os << "\nDetector Kernel Version: "
|
||||
<< OutString(det->getKernelVersion({std::vector<int>{det_id}}));
|
||||
if (det->getUseReceiverFlag().squash(true)) {
|
||||
os << "\nReceiver Version: "
|
||||
<< OutStringHex(
|
||||
det->getReceiverVersion(std::vector<int>{det_id}));
|
||||
<< OutString(det->getReceiverVersion(std::vector<int>{det_id}));
|
||||
}
|
||||
os << std::dec << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
@ -324,12 +323,12 @@ std::string CmdProxy::ClientVersion(int action) {
|
||||
std::ostringstream os;
|
||||
os << cmd << ' ';
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "\n\tClient software version in format [0xYYMMDD]." << '\n';
|
||||
os << "\n\tClient software version" << '\n';
|
||||
} else if (action == defs::GET_ACTION) {
|
||||
if (!args.empty()) {
|
||||
WrongNumberOfParameters(0);
|
||||
}
|
||||
os << ToStringHex(det->getClientVersion()) << '\n';
|
||||
os << det->getClientVersion() << '\n';
|
||||
} else if (action == defs::PUT_ACTION) {
|
||||
throw RuntimeError("cannot put");
|
||||
} else {
|
||||
@ -2563,8 +2562,7 @@ std::string CmdProxy::AdcVpp(int action) {
|
||||
if (action == defs::HELP_ACTION) {
|
||||
os << "[dac or mV value][(optional unit) mV] \n\t[Ctb][Moench] Vpp of "
|
||||
"ADC.\n\t 0 -> 1V ; 1 -> 1.14V ; 2 -> 1.33V ; 3 -> 1.6V ; 4 -> "
|
||||
"2V. "
|
||||
"\n\tAdvanced User function!\n"
|
||||
"2V. \n\tAdvanced User function!\n"
|
||||
<< '\n';
|
||||
return os.str();
|
||||
}
|
||||
|
@ -1232,16 +1232,14 @@ class CmdProxy {
|
||||
"[fname]\n\tSets detector measurement parameters to those contained in "
|
||||
"fname. Set up per measurement.");
|
||||
|
||||
GET_COMMAND_HEX(
|
||||
detectorserverversion, getDetectorServerVersion,
|
||||
"\n\tOn-board detector server software version in format [0xYYMMDD].");
|
||||
GET_COMMAND(detectorserverversion, getDetectorServerVersion,
|
||||
"\n\tOn-board detector server software version");
|
||||
|
||||
GET_COMMAND(
|
||||
kernelversion, getKernelVersion,
|
||||
"\n\tGet kernel version on the detector including time and date.");
|
||||
|
||||
GET_COMMAND_HEX(rx_version, getReceiverVersion,
|
||||
"\n\tReceiver version in format [0xYYMMDD].");
|
||||
GET_COMMAND(rx_version, getReceiverVersion, "\n\tReceiver version");
|
||||
|
||||
GET_COMMAND_HEX(serialnumber, getSerialNumber,
|
||||
"\n\t[Jungfrau][Gotthard][Mythen3][Gotthard2][CTB][Moench]"
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "DetectorImpl.h"
|
||||
#include "Module.h"
|
||||
#include "sls/Pattern.h"
|
||||
#include "sls/Version.h"
|
||||
#include "sls/container_utils.h"
|
||||
#include "sls/file_utils.h"
|
||||
#include "sls/logger.h"
|
||||
@ -112,15 +113,18 @@ void Detector::setVirtualDetectorServers(int numServers, int startingPort) {
|
||||
|
||||
int Detector::getShmId() const { return pimpl->getDetectorIndex(); }
|
||||
|
||||
std::string Detector::getPackageVersion() const { return GITBRANCH; }
|
||||
std::string Detector::getPackageVersion() const { return RELEASE; }
|
||||
|
||||
int64_t Detector::getClientVersion() const { return APILIB; }
|
||||
std::string Detector::getClientVersion() const {
|
||||
Version v(APILIB);
|
||||
return v.concise();
|
||||
}
|
||||
|
||||
Result<int64_t> Detector::getFirmwareVersion(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getFirmwareVersion, pos);
|
||||
}
|
||||
|
||||
Result<int64_t> Detector::getDetectorServerVersion(Positions pos) const {
|
||||
Result<std::string> Detector::getDetectorServerVersion(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getDetectorServerVersion, pos);
|
||||
}
|
||||
|
||||
@ -136,7 +140,7 @@ Result<int> Detector::getModuleId(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getModuleId, pos);
|
||||
}
|
||||
|
||||
Result<int64_t> Detector::getReceiverVersion(Positions pos) const {
|
||||
Result<std::string> Detector::getReceiverVersion(Positions pos) const {
|
||||
return pimpl->Parallel(&Module::getReceiverSoftwareVersion, pos);
|
||||
}
|
||||
|
||||
@ -1123,14 +1127,16 @@ Result<std::string> Detector::getRxHostname(Positions pos) const {
|
||||
}
|
||||
|
||||
void Detector::setRxHostname(const std::string &receiver, Positions pos) {
|
||||
pimpl->Parallel(&Module::setReceiverHostname, pos, receiver);
|
||||
pimpl->Parallel(&Module::setReceiverHostname, pos, receiver,
|
||||
pimpl->getInitialChecks());
|
||||
updateRxRateCorrections();
|
||||
}
|
||||
|
||||
void Detector::setRxHostname(const std::vector<std::string> &name) {
|
||||
// set all to same rx_hostname
|
||||
if (name.size() == 1) {
|
||||
pimpl->Parallel(&Module::setReceiverHostname, {}, name[0]);
|
||||
pimpl->Parallel(&Module::setReceiverHostname, {}, name[0],
|
||||
pimpl->getInitialChecks());
|
||||
} else {
|
||||
if ((int)name.size() != size()) {
|
||||
throw RuntimeError(
|
||||
@ -1139,7 +1145,8 @@ void Detector::setRxHostname(const std::vector<std::string> &name) {
|
||||
}
|
||||
// set each rx_hostname
|
||||
for (int idet = 0; idet < size(); ++idet) {
|
||||
pimpl->Parallel(&Module::setReceiverHostname, {idet}, name[idet]);
|
||||
pimpl->Parallel(&Module::setReceiverHostname, {idet}, name[idet],
|
||||
pimpl->getInitialChecks());
|
||||
}
|
||||
}
|
||||
updateRxRateCorrections();
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include "SharedMemory.h"
|
||||
#include "sls/ClientSocket.h"
|
||||
#include "sls/ToString.h"
|
||||
#include "sls/Version.h"
|
||||
#include "sls/bit_utils.h"
|
||||
#include "sls/container_utils.h"
|
||||
#include "sls/file_utils.h"
|
||||
@ -72,6 +73,7 @@ void Module::setHostname(const std::string &hostname,
|
||||
auto client = DetectorSocket(shm()->hostname, shm()->controlPort);
|
||||
client.close();
|
||||
try {
|
||||
initialDetectorServerChecks();
|
||||
checkDetectorVersionCompatibility();
|
||||
LOG(logINFO) << "Module Version Compatibility - Success";
|
||||
} catch (const DetectorError &e) {
|
||||
@ -90,8 +92,21 @@ int64_t Module::getFirmwareVersion() const {
|
||||
return sendToDetector<int64_t>(F_GET_FIRMWARE_VERSION);
|
||||
}
|
||||
|
||||
int64_t Module::getDetectorServerVersion() const {
|
||||
return sendToDetector<int64_t>(F_GET_SERVER_VERSION);
|
||||
std::string Module::getControlServerLongVersion() const {
|
||||
char retval[MAX_STR_LENGTH]{};
|
||||
sendToDetector(F_GET_SERVER_VERSION, nullptr, retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
std::string Module::getStopServerLongVersion() const {
|
||||
char retval[MAX_STR_LENGTH]{};
|
||||
sendToDetectorStop(F_GET_SERVER_VERSION, nullptr, retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
std::string Module::getDetectorServerVersion() const {
|
||||
Version v(getControlServerLongVersion());
|
||||
return v.concise();
|
||||
}
|
||||
|
||||
std::string Module::getKernelVersion() const {
|
||||
@ -106,11 +121,15 @@ int64_t Module::getSerialNumber() const {
|
||||
|
||||
int Module::getModuleId() const { return sendToDetector<int>(F_GET_MODULE_ID); }
|
||||
|
||||
int64_t Module::getReceiverSoftwareVersion() const {
|
||||
if (shm()->useReceiverFlag) {
|
||||
return sendToReceiver<int64_t>(F_GET_RECEIVER_VERSION);
|
||||
}
|
||||
return -1;
|
||||
std::string Module::getReceiverLongVersion() const {
|
||||
char retval[MAX_STR_LENGTH]{};
|
||||
sendToReceiver(F_GET_RECEIVER_VERSION, nullptr, retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
std::string Module::getReceiverSoftwareVersion() const {
|
||||
Version v(getReceiverLongVersion());
|
||||
return v.concise();
|
||||
}
|
||||
|
||||
// static function
|
||||
@ -1279,7 +1298,8 @@ std::string Module::getReceiverHostname() const {
|
||||
return std::string(shm()->rxHostname);
|
||||
}
|
||||
|
||||
void Module::setReceiverHostname(const std::string &receiverIP) {
|
||||
void Module::setReceiverHostname(const std::string &receiverIP,
|
||||
const bool initialChecks) {
|
||||
LOG(logDEBUG1) << "Setting up Receiver hostname with " << receiverIP;
|
||||
|
||||
if (getRunStatus() == RUNNING) {
|
||||
@ -1303,8 +1323,17 @@ void Module::setReceiverHostname(const std::string &receiverIP) {
|
||||
}
|
||||
strcpy_safe(shm()->rxHostname, host.c_str());
|
||||
shm()->useReceiverFlag = true;
|
||||
checkReceiverVersionCompatibility();
|
||||
|
||||
try {
|
||||
checkReceiverVersionCompatibility();
|
||||
LOG(logINFO) << "Receiver Version Compatibility - Success";
|
||||
} catch (const RuntimeError &e) {
|
||||
if (!initialChecks) {
|
||||
LOG(logWARNING) << "Bypassing Initial Checks at your own risk!";
|
||||
} else {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
// populate parameters from detector
|
||||
rxParameters retval;
|
||||
sendToDetector(F_GET_RECEIVER_PARAMETERS, nullptr, retval);
|
||||
@ -3216,41 +3245,95 @@ void Module::initializeModuleStructure(detectorType type) {
|
||||
shm()->nDacs = parameters.nDacs;
|
||||
}
|
||||
|
||||
void Module::initialDetectorServerChecks() {
|
||||
sendToDetector(F_INITIAL_CHECKS);
|
||||
sendToDetectorStop(F_INITIAL_CHECKS);
|
||||
}
|
||||
|
||||
void Module::checkDetectorVersionCompatibility() {
|
||||
int64_t arg = 0;
|
||||
std::string detServers[2] = {getControlServerLongVersion(),
|
||||
getStopServerLongVersion()};
|
||||
for (int i = 0; i != 2; ++i) {
|
||||
// det and client (sem. versioning)
|
||||
Version det(detServers[i]);
|
||||
Version client(APILIB);
|
||||
if (det.hasSemanticVersioning() && client.hasSemanticVersioning()) {
|
||||
if (!det.isBackwardCompatible(client)) {
|
||||
std::ostringstream oss;
|
||||
oss << "Detector (" << (i == 0 ? "Control" : "Stop")
|
||||
<< ") version (" << det.concise()
|
||||
<< ") is incompatible with client version ("
|
||||
<< client.concise() << "). Please update "
|
||||
<< (det <= client ? "detector" : "client");
|
||||
throw sls::RuntimeError(oss.str());
|
||||
}
|
||||
}
|
||||
// comparing dates(exact match to expected)
|
||||
else {
|
||||
Version expectedDetector(getDetectorAPI());
|
||||
if (det != expectedDetector) {
|
||||
std::ostringstream oss;
|
||||
oss << "Detector (" << (i == 0 ? "Control" : "Stop")
|
||||
<< ") version (" << det.getDate()
|
||||
<< ") is incompatible with client-detector API version ("
|
||||
<< expectedDetector.getDate() << "). Please update "
|
||||
<< (det <= expectedDetector ? "detector" : "client");
|
||||
throw sls::RuntimeError(oss.str());
|
||||
}
|
||||
}
|
||||
LOG(logDEBUG) << "Detector compatible";
|
||||
}
|
||||
}
|
||||
|
||||
const std::string Module::getDetectorAPI() const {
|
||||
switch (shm()->detType) {
|
||||
case EIGER:
|
||||
arg = APIEIGER;
|
||||
break;
|
||||
return APIEIGER;
|
||||
case JUNGFRAU:
|
||||
arg = APIJUNGFRAU;
|
||||
break;
|
||||
return APIJUNGFRAU;
|
||||
case GOTTHARD:
|
||||
arg = APIGOTTHARD;
|
||||
break;
|
||||
return APIGOTTHARD;
|
||||
case CHIPTESTBOARD:
|
||||
arg = APICTB;
|
||||
break;
|
||||
return APICTB;
|
||||
case MOENCH:
|
||||
arg = APIMOENCH;
|
||||
break;
|
||||
return APIMOENCH;
|
||||
case MYTHEN3:
|
||||
arg = APIMYTHEN3;
|
||||
break;
|
||||
return APIMYTHEN3;
|
||||
case GOTTHARD2:
|
||||
arg = APIGOTTHARD2;
|
||||
break;
|
||||
return APIGOTTHARD2;
|
||||
default:
|
||||
throw NotImplementedError(
|
||||
"Check version compatibility is not implemented for this detector");
|
||||
"Detector type not implemented to get Detector API");
|
||||
}
|
||||
sendToDetector(F_CHECK_VERSION, arg, nullptr);
|
||||
sendToDetectorStop(F_CHECK_VERSION, arg, nullptr);
|
||||
}
|
||||
|
||||
void Module::checkReceiverVersionCompatibility() {
|
||||
// TODO! Verify that this works as intended when version don't match
|
||||
sendToReceiver(F_RECEIVER_CHECK_VERSION, int64_t(APIRECEIVER), nullptr);
|
||||
// rxr and client (sem. versioning)
|
||||
Version rxr(getReceiverLongVersion());
|
||||
Version client(APILIB);
|
||||
if (rxr.hasSemanticVersioning() && client.hasSemanticVersioning()) {
|
||||
if (!rxr.isBackwardCompatible(client)) {
|
||||
std::ostringstream oss;
|
||||
oss << "Receiver version (" << rxr.concise()
|
||||
<< ") is incompatible with client version (" << client.concise()
|
||||
<< "). Please update "
|
||||
<< (rxr <= client ? "receiver" : "client");
|
||||
throw sls::RuntimeError(oss.str());
|
||||
}
|
||||
}
|
||||
// comparing dates(exact match to expected)
|
||||
else {
|
||||
Version expectedReceiver(APIRECEIVER);
|
||||
if (rxr != expectedReceiver) {
|
||||
std::ostringstream oss;
|
||||
oss << "Receiver version (" << rxr.getDate()
|
||||
<< ") is incompatible with client-receiver API version ("
|
||||
<< expectedReceiver.getDate() << "). Please update "
|
||||
<< (rxr <= expectedReceiver ? "receiver" : "client");
|
||||
throw sls::RuntimeError(oss.str());
|
||||
}
|
||||
}
|
||||
LOG(logDEBUG) << "Receiver compatible";
|
||||
}
|
||||
|
||||
void Module::setModule(sls_detector_module &module, bool trimbits) {
|
||||
|
@ -90,11 +90,13 @@ class Module : public virtual slsDetectorDefs {
|
||||
void setHostname(const std::string &hostname, const bool initialChecks);
|
||||
|
||||
int64_t getFirmwareVersion() const;
|
||||
int64_t getDetectorServerVersion() const;
|
||||
std::string getControlServerLongVersion() const;
|
||||
std::string getStopServerLongVersion() const;
|
||||
std::string getDetectorServerVersion() const;
|
||||
std::string getKernelVersion() const;
|
||||
int64_t getSerialNumber() const;
|
||||
int getModuleId() const;
|
||||
int64_t getReceiverSoftwareVersion() const;
|
||||
std::string getReceiverSoftwareVersion() const;
|
||||
static detectorType
|
||||
getTypeFromDetector(const std::string &hostname,
|
||||
int cport = DEFAULT_TCP_CNTRL_PORTNO);
|
||||
@ -276,7 +278,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
* ************************************************/
|
||||
bool getUseReceiverFlag() const;
|
||||
std::string getReceiverHostname() const;
|
||||
void setReceiverHostname(const std::string &receiver);
|
||||
void setReceiverHostname(const std::string &receiver,
|
||||
const bool initialChecks);
|
||||
int getReceiverPort() const;
|
||||
int setReceiverPort(int port_number);
|
||||
int getReceiverFifoDepth() const;
|
||||
@ -600,6 +603,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
int64_t getMeasurementTime() const;
|
||||
|
||||
private:
|
||||
std::string getReceiverLongVersion() const;
|
||||
|
||||
void checkArgs(const void *args, size_t args_size, void *retval,
|
||||
size_t retval_size) const;
|
||||
|
||||
@ -737,6 +742,8 @@ class Module : public virtual slsDetectorDefs {
|
||||
Called when new shared memory is created */
|
||||
void initializeModuleStructure(detectorType type);
|
||||
|
||||
void initialDetectorServerChecks();
|
||||
const std::string getDetectorAPI() const;
|
||||
void checkDetectorVersionCompatibility();
|
||||
void checkReceiverVersionCompatibility();
|
||||
void setModule(sls_detector_module &module, bool trimbits = true);
|
||||
|
@ -36,7 +36,7 @@ class Receiver : private virtual slsDetectorDefs {
|
||||
* get get Receiver Version
|
||||
\returns id
|
||||
*/
|
||||
int64_t getReceiverVersion();
|
||||
std::string getReceiverVersion();
|
||||
|
||||
/**
|
||||
* Start Acquisition Call back (slsMultiReceiver writes data if file write
|
||||
|
@ -51,7 +51,7 @@ ClientInterface::ClientInterface(int portNumber)
|
||||
make_unique<std::thread>(&ClientInterface::startTCPServer, this);
|
||||
}
|
||||
|
||||
int64_t ClientInterface::getReceiverVersion() { return APIRECEIVER; }
|
||||
std::string ClientInterface::getReceiverVersion() { return APIRECEIVER; }
|
||||
|
||||
/***callback functions***/
|
||||
void ClientInterface::registerCallBackStartAcquisition(
|
||||
@ -180,7 +180,6 @@ int ClientInterface::functionTable(){
|
||||
flist[F_RECEIVER_REAL_UDP_SOCK_BUF_SIZE]= &ClientInterface::get_real_udp_socket_buffer_size;
|
||||
flist[F_SET_RECEIVER_FRAMES_PER_FILE] = &ClientInterface::set_frames_per_file;
|
||||
flist[F_GET_RECEIVER_FRAMES_PER_FILE] = &ClientInterface::get_frames_per_file;
|
||||
flist[F_RECEIVER_CHECK_VERSION] = &ClientInterface::check_version_compatibility;
|
||||
flist[F_SET_RECEIVER_DISCARD_POLICY] = &ClientInterface::set_discard_policy;
|
||||
flist[F_GET_RECEIVER_DISCARD_POLICY] = &ClientInterface::get_discard_policy;
|
||||
flist[F_SET_RECEIVER_PADDING] = &ClientInterface::set_padding_enable;
|
||||
@ -312,7 +311,9 @@ int ClientInterface::get_last_client_ip(Interface &socket) {
|
||||
}
|
||||
|
||||
int ClientInterface::get_version(Interface &socket) {
|
||||
return socket.sendResult(getReceiverVersion());
|
||||
auto version = getReceiverVersion();
|
||||
version.resize(MAX_STR_LENGTH);
|
||||
return socket.sendResult(version);
|
||||
}
|
||||
|
||||
int ClientInterface::setup_receiver(Interface &socket) {
|
||||
@ -1218,33 +1219,6 @@ int ClientInterface::get_frames_per_file(Interface &socket) {
|
||||
return socket.sendResult(retval);
|
||||
}
|
||||
|
||||
int ClientInterface::check_version_compatibility(Interface &socket) {
|
||||
auto arg = socket.Receive<int64_t>();
|
||||
LOG(logDEBUG1) << "Checking versioning compatibility with value " << arg;
|
||||
int64_t client_requiredVersion = arg;
|
||||
int64_t rx_apiVersion = APIRECEIVER;
|
||||
int64_t rx_version = getReceiverVersion();
|
||||
|
||||
if (rx_apiVersion > client_requiredVersion) {
|
||||
std::ostringstream os;
|
||||
os << "Incompatible versions.\n Client's receiver API Version: (0x"
|
||||
<< std::hex << client_requiredVersion
|
||||
<< "). Receiver API Version: (0x" << std::hex
|
||||
<< ").\n Please update the client!\n";
|
||||
throw RuntimeError(os.str());
|
||||
} else if (client_requiredVersion > rx_version) {
|
||||
std::ostringstream os;
|
||||
os << "This receiver is incompatible.\n Receiver Version: (0x"
|
||||
<< std::hex << rx_version << "). Client's receiver API Version: (0x"
|
||||
<< std::hex << client_requiredVersion
|
||||
<< ").\n Please update the receiver";
|
||||
throw RuntimeError(os.str());
|
||||
} else {
|
||||
LOG(logINFO) << "Compatibility with Client: Successful";
|
||||
}
|
||||
return socket.Send(OK);
|
||||
}
|
||||
|
||||
int ClientInterface::set_discard_policy(Interface &socket) {
|
||||
auto index = socket.Receive<int>();
|
||||
if (index < 0 || index > NUM_DISCARD_POLICIES) {
|
||||
|
@ -30,7 +30,7 @@ class ClientInterface : private virtual slsDetectorDefs {
|
||||
public:
|
||||
virtual ~ClientInterface();
|
||||
ClientInterface(int portNumber = -1);
|
||||
int64_t getReceiverVersion();
|
||||
std::string getReceiverVersion();
|
||||
|
||||
//***callback functions***
|
||||
/** params: file path, file name, file index, image size */
|
||||
@ -128,7 +128,6 @@ class ClientInterface : private virtual slsDetectorDefs {
|
||||
int get_real_udp_socket_buffer_size(ServerInterface &socket);
|
||||
int set_frames_per_file(ServerInterface &socket);
|
||||
int get_frames_per_file(ServerInterface &socket);
|
||||
int check_version_compatibility(ServerInterface &socket);
|
||||
int set_discard_policy(ServerInterface &socket);
|
||||
int get_discard_policy(ServerInterface &socket);
|
||||
int set_padding_enable(ServerInterface &socket);
|
||||
|
@ -71,8 +71,7 @@ Receiver::Receiver(int argc, char *argv[]) : tcpipInterface(nullptr) {
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
std::cout << "SLS Receiver Version: " << GITBRANCH << " (0x"
|
||||
<< std::hex << APIRECEIVER << ")" << std::endl;
|
||||
std::cout << "SLS Receiver Version: " << APIRECEIVER << std::endl;
|
||||
LOG(logINFOBLUE) << "Exiting [ Tid: " << gettid() << " ]";
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
@ -124,7 +123,7 @@ Receiver::Receiver(int tcpip_port_no) {
|
||||
tcpipInterface = make_unique<ClientInterface>(tcpip_port_no);
|
||||
}
|
||||
|
||||
int64_t Receiver::getReceiverVersion() {
|
||||
std::string Receiver::getReceiverVersion() {
|
||||
return tcpipInterface->getReceiverVersion();
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ set(SOURCES
|
||||
src/UdpRxSocket.cpp
|
||||
src/sls_detector_exceptions.cpp
|
||||
src/md5_helper.cpp
|
||||
src/Version.cpp
|
||||
)
|
||||
|
||||
# Header files to install as a part of the library
|
||||
@ -50,6 +51,7 @@ if(SLS_DEVEL_HEADERS)
|
||||
include/sls/bit_utils.h
|
||||
include/sls/md5.h
|
||||
include/sls/md5_helper.h
|
||||
include/sls/Version.h
|
||||
)
|
||||
endif()
|
||||
|
||||
|
33
slsSupportLib/include/sls/Version.h
Normal file
33
slsSupportLib/include/sls/Version.h
Normal file
@ -0,0 +1,33 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
namespace sls {
|
||||
|
||||
class Version {
|
||||
private:
|
||||
std::string version_;
|
||||
std::string date_;
|
||||
const std::string defaultBranch_ = "developer";
|
||||
|
||||
public:
|
||||
explicit Version(const std::string &s);
|
||||
|
||||
bool hasSemanticVersioning() const;
|
||||
std::string getVersion() const;
|
||||
std::string getDate() const;
|
||||
std::string concise() const;
|
||||
int getMajorVersion() const;
|
||||
|
||||
// expects semantic versioning
|
||||
bool isBackwardCompatible(const Version &other) const;
|
||||
bool operator!=(const Version &other) const;
|
||||
bool operator==(const Version &other) const;
|
||||
bool operator<=(const Version &other) const;
|
||||
};
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const Version &v);
|
||||
} // namespace sls
|
@ -107,7 +107,7 @@ enum detFuncs {
|
||||
F_TEMP_EVENT,
|
||||
F_AUTO_COMP_DISABLE,
|
||||
F_STORAGE_CELL_START,
|
||||
F_CHECK_VERSION,
|
||||
F_INITIAL_CHECKS,
|
||||
F_SOFTWARE_TRIGGER,
|
||||
F_LED,
|
||||
F_DIGITAL_IO_DELAY,
|
||||
@ -339,7 +339,6 @@ enum detFuncs {
|
||||
F_RECEIVER_REAL_UDP_SOCK_BUF_SIZE,
|
||||
F_SET_RECEIVER_FRAMES_PER_FILE,
|
||||
F_GET_RECEIVER_FRAMES_PER_FILE,
|
||||
F_RECEIVER_CHECK_VERSION,
|
||||
F_SET_RECEIVER_DISCARD_POLICY,
|
||||
F_GET_RECEIVER_DISCARD_POLICY,
|
||||
F_SET_RECEIVER_PADDING,
|
||||
@ -488,7 +487,7 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_TEMP_EVENT: return "F_TEMP_EVENT";
|
||||
case F_AUTO_COMP_DISABLE: return "F_AUTO_COMP_DISABLE";
|
||||
case F_STORAGE_CELL_START: return "F_STORAGE_CELL_START";
|
||||
case F_CHECK_VERSION: return "F_CHECK_VERSION";
|
||||
case F_INITIAL_CHECKS: return "F_INITIAL_CHECKS";
|
||||
case F_SOFTWARE_TRIGGER: return "F_SOFTWARE_TRIGGER";
|
||||
case F_LED: return "F_LED";
|
||||
case F_DIGITAL_IO_DELAY: return "F_DIGITAL_IO_DELAY";
|
||||
@ -718,7 +717,6 @@ const char* getFunctionNameFromEnum(enum detFuncs func) {
|
||||
case F_RECEIVER_REAL_UDP_SOCK_BUF_SIZE: return "F_RECEIVER_REAL_UDP_SOCK_BUF_SIZE";
|
||||
case F_SET_RECEIVER_FRAMES_PER_FILE: return "F_SET_RECEIVER_FRAMES_PER_FILE";
|
||||
case F_GET_RECEIVER_FRAMES_PER_FILE: return "F_GET_RECEIVER_FRAMES_PER_FILE";
|
||||
case F_RECEIVER_CHECK_VERSION: return "F_RECEIVER_CHECK_VERSION";
|
||||
case F_SET_RECEIVER_DISCARD_POLICY: return "F_SET_RECEIVER_DISCARD_POLICY";
|
||||
case F_GET_RECEIVER_DISCARD_POLICY: return "F_GET_RECEIVER_DISCARD_POLICY";
|
||||
case F_SET_RECEIVER_PADDING: return "F_SET_RECEIVER_PADDING";
|
||||
|
@ -1,14 +1,13 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
/** API versions */
|
||||
#define GITBRANCH "developer"
|
||||
#define APILIB 0x220609
|
||||
#define APIRECEIVER 0x220609
|
||||
#define APIGUI 0x220609
|
||||
#define APICTB 0x221018
|
||||
#define APIGOTTHARD 0x221018
|
||||
#define APIGOTTHARD2 0x221018
|
||||
#define APIJUNGFRAU 0x221018
|
||||
#define APIMOENCH 0x221018
|
||||
#define APIMYTHEN3 0x221107
|
||||
#define APIEIGER 0x221107
|
||||
#define RELEASE "developer"
|
||||
#define APICTB "developer 0x221108"
|
||||
#define APIGOTTHARD "developer 0x221108"
|
||||
#define APIGOTTHARD2 "developer 0x221108"
|
||||
#define APIJUNGFRAU "developer 0x221108"
|
||||
#define APIMYTHEN3 "developer 0x221108"
|
||||
#define APIMOENCH "developer 0x221108"
|
||||
#define APIEIGER "developer 0x221108"
|
||||
#define APILIB "developer 0x221108"
|
||||
#define APIRECEIVER "developer 0x221108"
|
||||
|
83
slsSupportLib/src/Version.cpp
Normal file
83
slsSupportLib/src/Version.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
// Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#include "sls/Version.h"
|
||||
#include "sls/sls_detector_exceptions.h"
|
||||
#include "sls/string_utils.h"
|
||||
#include <sstream>
|
||||
|
||||
namespace sls {
|
||||
|
||||
Version::Version(const std::string &s) {
|
||||
auto list = split(s, ' ');
|
||||
// only date from previous releases
|
||||
if (list.size() == 1) {
|
||||
date_ = list[0];
|
||||
}
|
||||
// semantic versioning + date
|
||||
else {
|
||||
version_ = list[0];
|
||||
date_ = list[1];
|
||||
}
|
||||
}
|
||||
|
||||
bool Version::hasSemanticVersioning() const {
|
||||
return version_ != defaultBranch_;
|
||||
}
|
||||
|
||||
std::string Version::getVersion() const { return version_; }
|
||||
std::string Version::getDate() const { return date_; }
|
||||
|
||||
std::string Version::concise() const {
|
||||
if (hasSemanticVersioning())
|
||||
return version_;
|
||||
return date_;
|
||||
}
|
||||
|
||||
int Version::getMajorVersion() const {
|
||||
int major = 0, minor = 0, patch = 0;
|
||||
if (sscanf(version_.c_str(), "%d.%d.%d", &major, &minor, &patch) == 3) {
|
||||
return major;
|
||||
}
|
||||
throw sls::RuntimeError("Could not get major version from " + version_);
|
||||
}
|
||||
|
||||
bool Version::isBackwardCompatible(const Version &other) const {
|
||||
return getMajorVersion() == other.getMajorVersion();
|
||||
}
|
||||
|
||||
bool Version::operator!=(const Version &other) const {
|
||||
return !(*this == other);
|
||||
}
|
||||
|
||||
bool Version::operator==(const Version &other) const {
|
||||
// both have semantic versioning
|
||||
if (hasSemanticVersioning() && other.hasSemanticVersioning()) {
|
||||
return version_ == other.getVersion();
|
||||
}
|
||||
// compare dates
|
||||
return date_ == other.getDate();
|
||||
}
|
||||
|
||||
bool Version::operator<=(const Version &other) const {
|
||||
// both have semantic versioning
|
||||
if (hasSemanticVersioning() && other.hasSemanticVersioning()) {
|
||||
// release version
|
||||
std::string otherVersion = other.getVersion();
|
||||
if (version_ == otherVersion)
|
||||
return true;
|
||||
// less than
|
||||
return (std::lexicographical_compare(version_.begin(), version_.end(),
|
||||
otherVersion.begin(),
|
||||
otherVersion.end()));
|
||||
}
|
||||
// compare dates
|
||||
return date_ <= other.getDate();
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &out, const Version &v) {
|
||||
std::ostringstream oss;
|
||||
oss << v.getVersion() << " " << v.getDate();
|
||||
return out << oss.str();
|
||||
}
|
||||
|
||||
} // namespace sls
|
@ -1,8 +1,9 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
#require 2 arguments, API_NAME API_DIR (relative to package)
|
||||
usage="\nUsage: updateAPIVersion.sh [API_NAME] [API_DIR] [API_BRANCH(opt)]."
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
echo "Wrong usage of updateVersion.sh. Requires atleast 2 arguments [API_NAME, API_DIR]"
|
||||
echo -e "Requires atleast 2 arguments. $usage"
|
||||
return [-1]
|
||||
fi
|
||||
|
||||
@ -12,6 +13,11 @@ API_DIR=$PACKAGE_DIR/$2
|
||||
API_FILE=$PACKAGE_DIR/slsSupportLib/include/sls/versionAPI.h
|
||||
CURR_DIR=$PWD
|
||||
|
||||
if [ ! -d "$API_DIR" ]; then
|
||||
echo "[API_DIR] does not exist. $usage"
|
||||
return [-1]
|
||||
fi
|
||||
|
||||
#go to directory
|
||||
cd $API_DIR
|
||||
|
||||
@ -38,8 +44,22 @@ API_DATE=${API_DATE:2:6}
|
||||
API_DATE=${API_DATE/#/0x}
|
||||
echo "date="$API_DATE
|
||||
|
||||
|
||||
# API_VAL concatenates branch and date
|
||||
API_VAL=""
|
||||
# API branch is defined (3rd argument)
|
||||
if [ $# -eq 3 ]; then
|
||||
API_BRANCH=$3
|
||||
echo "branch="$API_BRANCH
|
||||
API_VAL+="\"$API_BRANCH $API_DATE\""
|
||||
else
|
||||
# API branch not defined (default is developer)
|
||||
echo "branch=developer"
|
||||
API_VAL+="\"developer $API_DATE\""
|
||||
fi
|
||||
|
||||
#copy it to versionAPI.h
|
||||
echo "#define "$API_NAME $API_DATE >> $API_FILE
|
||||
echo "#define "$API_NAME $API_VAL >> $API_FILE
|
||||
|
||||
#go back to original directory
|
||||
cd $CURR_DIR
|
||||
|
@ -1,33 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
API_FILE=$PWD/slsSupportLib/include/sls/versionAPI.h
|
||||
arraylength=3
|
||||
|
||||
LIB_DIR=slsDetectorSoftware
|
||||
RXR_DIR=slsReceiverSoftware
|
||||
GUI_DIR=slsDetectorGui
|
||||
|
||||
declare -a arraydirs=($LIB_DIR $RXR_DIR $GUI_DIR)
|
||||
declare -a arraynames=("APILIB" "APIRECEIVER" "APIGUI")
|
||||
|
||||
for (( i=0; i<${arraylength}; ++i ));
|
||||
do
|
||||
./updateAPIVersion.sh ${arraynames[$i]} ${arraydirs[$i]}
|
||||
done
|
||||
|
||||
#use tag
|
||||
if [ $# -eq 0 ]; then
|
||||
declare -a TAG=$(git rev-parse --abbrev-ref HEAD)
|
||||
#find branch
|
||||
else
|
||||
declare -a TAG=${1}
|
||||
fi
|
||||
#CURR_BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||
|
||||
#update branch
|
||||
BRANCH=$(cat $API_FILE | grep GITBRANCH | awk '{print $3}' )
|
||||
#sed -i s/$BRANCH/\"$CURR_BRANCH\"/g $API_FILE
|
||||
sed -i s/$BRANCH/\"$TAG\"/g $API_FILE
|
||||
|
||||
|
||||
|
59
updateClientAPIVersion.sh
Executable file
59
updateClientAPIVersion.sh
Executable file
@ -0,0 +1,59 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
branch=""
|
||||
client_list=("slsDetectorSoftware" "slsReceiverSoftware")
|
||||
usage="\nUsage: updateClientAPI.sh [all|slsDetectorSoftware|slsReceiverSoftware] [branch]. \n\tNo arguments means all with 'developer' branch. \n\tNo 'branch' input means 'developer branch'"
|
||||
|
||||
# arguments
|
||||
if [ $# -eq 0 ]; then
|
||||
declare -a client=${client_list[@]}
|
||||
echo "API Versioning all"
|
||||
elif [ $# -eq 1 ] || [ $# -eq 2 ]; then
|
||||
# 'all' client
|
||||
if [[ $1 == "all" ]]; then
|
||||
declare -a client=${client_list[@]}
|
||||
echo "API Versioning all"
|
||||
else
|
||||
# only one server
|
||||
if [[ $client_list != *$1* ]]; then
|
||||
echo -e "Invalid argument 1: $1. $usage"
|
||||
return -1
|
||||
fi
|
||||
declare -a client=("${1}")
|
||||
#echo "Versioning only $1"
|
||||
fi
|
||||
if [ $# -eq 2 ]; then
|
||||
if [[ $client_list == *$2* ]]; then
|
||||
echo -e "Invalid argument 2: $2. $usage"
|
||||
return -1
|
||||
fi
|
||||
branch+=$2
|
||||
#echo "with branch $branch"
|
||||
fi
|
||||
else
|
||||
echo -e "Too many arguments.$usage"
|
||||
return -1
|
||||
fi
|
||||
|
||||
#echo "list is: ${client[@]}"
|
||||
|
||||
# versioning each client
|
||||
for i in ${client[@]}
|
||||
do
|
||||
dir=$i
|
||||
case $dir in
|
||||
slsDetectorSoftware)
|
||||
declare -a name=APILIB
|
||||
;;
|
||||
slsReceiverSoftware)
|
||||
declare -a name=APIRECEIVER
|
||||
;;
|
||||
*)
|
||||
echo -n "unknown client argument $i"
|
||||
return -1
|
||||
;;
|
||||
esac
|
||||
echo -e "Versioning $dir [$name]"
|
||||
./updateAPIVersion.sh $name $dir $branch
|
||||
done
|
||||
|
15
updateReleaseVersion.sh
Normal file
15
updateReleaseVersion.sh
Normal file
@ -0,0 +1,15 @@
|
||||
# SPDX-License-Identifier: LGPL-3.0-or-other
|
||||
# Copyright (C) 2021 Contributors to the SLS Detector Package
|
||||
|
||||
API_FILE=$PWD/slsSupportLib/include/sls/versionAPI.h
|
||||
CURR_BRANCH=$(cat $API_FILE | grep RELEASE | awk '{print $3}' )
|
||||
|
||||
# default branch is developer
|
||||
if [ $# -eq 0 ]; then
|
||||
declare -a NEW_BRANCH="developer"
|
||||
else
|
||||
declare -a NEW_BRANCH=${1}
|
||||
fi
|
||||
|
||||
# update branch
|
||||
sed -i s/$CURR_BRANCH/\"$NEW_BRANCH\"/g $API_FILE
|
Loading…
x
Reference in New Issue
Block a user