Compare commits

..

No commits in common. "94b51b5794d376c362e784b5f4657163b6c18711" and "a139fdb58fd6d826071d637daead16b1c615c6b0" have entirely different histories.

8 changed files with 193 additions and 25 deletions

View File

@ -46,7 +46,7 @@ contains( CONFIG, PTU5_YOCTO ) {
}
TARGET = ATBVMCPlugin
VERSION = "0.8.0"
VERSION = "1.0.0"
INTERFACE = VMCInterface
INTERFACE_DEFINITION = $${PWD}/src/ATBAPP/VMCInterface.h
@ -56,33 +56,26 @@ win32 {
BUILD_DATE=$$system("date /t")
BUILD_TIME=$$system("time /t")
} else {
BUILD_DATE=$$system("date +%d%m%y")
BUILD_TIME=$$system("date +%H%M")
BUILD_DATE=$$system("date +%d-%m-%y")
BUILD_TIME=$$system("date +%H:%M:%S")
}
GIT_COMMIT=$$system("git log -n 1 --format=oneline | cut -d' ' -f1")
GIT_BRANCH=$$system("git branch --no-color 2> /dev/null | cut -d' ' -f2")
GIT_DESCRIBE=$$system("git describe --dirty --always | tr '-' '_'")
DEV_SUFFIX=""
count(GIT_BRANCH, 2) {
DEV_SUFFIX="_dev"
}
GIT_DESCRIBE=$$system("git describe")
EXTENDED_VERSION="$${VERSION}-$${GIT_COMMIT}"
CONFIG += c++17
DEFINES+=ATB_QT_VERSION=\\\"$${QT_VERSION}\\\"
DEFINES+=PLUGIN_BUILD_DATE=\\\"$${BUILD_DATE}\\\"
DEFINES+=PLUGIN_BUILD_TIME=\\\"$${BUILD_TIME}\\\"
DEFINES+=PLUGIN_BUILD_DATE=\\\"$$BUILD_DATE\\\"
DEFINES+=PLUGIN_BUILD_TIME=\\\"$$BUILD_TIME\\\"
DEFINES+=PLUGIN_EXTENDED_VERSION=\\\"$${EXTENDED_VERSION}\\\"
DEFINES+=INTERFACE=\\\"VMCInterface\\\"
DEFINES+=INTERFACE_VERSION=\\\"eu.atb.ptu.plugin.VMCInterface/1.0\\\"
DEFINES+=PLUGIN_NAME=\\\"ATBVMCPlugin\\\"
DEFINES+=PLUGIN_VERSION=\\\"$${BUILD_DATE}_$${BUILD_TIME}\\\"
DEFINES+=PLUGIN_GIT_DESCRIBE=\\\"$${GIT_DESCRIBE}_$${GIT_BRANCH}$${DEV_SUFFIX}\\\"
DEFINES+=PLUGIN_VERSION=\\\"$${PLUGIN_BUILD_DATE}_$${PLUGIN_BUILD_TIME}\\\"
# Default rules for deployment.
#qnx: target.path = /tmp/$${TARGET}/bin
@ -108,3 +101,6 @@ SOURCES += \
src/ATBAPP/support/VMC/SendBuffer.cpp \
src/ATBAPP/support/VMC/vmc.cpp \
src/ATBAPP/support/VendingData.cpp
OTHER_FILES += \
plugins/metadata.json

157
generate-version.sh Executable file
View File

@ -0,0 +1,157 @@
#!/bin/bash
VERSION_STRING=""
#GIT='/cygdrive/c/Program Files \(x86\)/Git/bin/git'
GIT=git
parse_git_branch () {
$GIT branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1/"
}
ARCH=$1
TARGET=$2
INTERFACE=$3
INTERFACE_DEFINITION=$4
VERSION_H=$5
SCRIPT=$(readlink -f $0)
SCRIPTPATH=`dirname $SCRIPT`
OUTPUTDIR=$(pwd)
echo " current dir is : " $(pwd)
echo $SCRIPT
echo $SCRIPTPATH
echo "changing dir to script path: " $SCRIPTPATH
cd $SCRIPTPATH
# set version string ##################################################################
if [ -z $VERSION_STRING ] ; then
VERSION_STRING=$(date +%Y%m%d_%H%M)
fi
GIT_DESCRIBE=$($GIT describe --always)
GIT_BRANCH=$(parse_git_branch)
# extract path from branchname:
IFS='_' read -ra TMP_ARRAY <<< "${GIT_BRANCH}"
BRANCH_PATH=${TMP_ARRAY[0]}
# detect if we have a development version:
if [ ${#TMP_ARRAY[1]} -gt 0 ] ; then
DEV_SUFFIX="_dev"
else
DEV_SUFFIX=""
fi
# detect if git status is dirty
GIT_DESCRIBE_DIRTY=$($GIT describe --dirty)
if [ "${GIT_DESCRIBE_DIRTY:(-6)}" == "-dirty" ] ; then
DIRTY_SUFFIX="_dirty"
else
DIRTY_SUFFIX=""
fi
if [ -n "$DIRTY_SUFFIX" ] || [ -n "$DEV_SUFFIX" ] ; then
DEVDIRTY=true
else
DEVDIRTY=false
fi
# extract interface definition
#
#Q_DECLARE_INTERFACE(CCInterface,
# "eu.atb.ptu.plugin.CCInterface/2.9.0")
#Q_DECLARE_INTERFACE(DeviceControllerInterface,
# "eu.atb.ptu.plugin.DeviceControllerInterface/1.0")
# -> extract whole string within quotation marks
INTERFACE_VERSION=$(grep 'eu.atb.ptu.plugin.' ${INTERFACE_DEFINITION})
# get string within quotes:
INTERFACE_VERSION=`echo ${INTERFACE_VERSION} | awk -F \" '{print $2}'`
#
# write version.h
echo " TARGET is: $TARGET"
echo " ARCH is: $ARCH"
echo " "
echo " PluginName: $TARGET"
echo " Interface: $INTERFACE"
echo " InterfaceVersion: $INTERFACE_VERSION"
echo " "
echo " new version is: $VERSION_STRING"
echo " git describe is: $GIT_DESCRIBE"
echo " git branch is: $GIT_BRANCH"
echo " branch-path is: $BRANCH_PATH"
echo " "
echo " dev suffix: $DEV_SUFFIX"
echo " dirty suffix: $DIRTY_SUFFIX"
PLUGIN_VERSION=${VERSION_STRING}
#ATB_QT_GIT_DESCRIBE=${GIT_DESCRIBE}_${GIT_BRANCH}
PLUGIN_GIT_DESCRIBE=${GIT_DESCRIBE}_${BRANCH_PATH}${DEV_SUFFIX}${DIRTY_SUFFIX}
#TARGET=IngenicoZVT_CCPlugin
# build version.h #####################################################################
echo " building new version info (version.h) ..."
echo "#ifndef VERSION_H" > ${VERSION_H}
echo "#define VERSION_H" >> ${VERSION_H}
echo "" >> ${VERSION_H}
echo "" >> ${VERSION_H}
echo "#define INTERFACE_VERSION \"${INTERFACE_VERSION}\"" >> ${VERSION_H}
echo "#define PLUGIN_VERSION \"${PLUGIN_VERSION}\"" >> ${VERSION_H}
echo "" >> ${VERSION_H}
echo "#define PLUGIN_GIT_DESCRIBE \"${PLUGIN_GIT_DESCRIBE}\"" >> ${VERSION_H}
echo "" >> ${VERSION_H}
echo "" >> ${VERSION_H}
cat <<EOT >> ${VERSION_H}
const std::string pluginInfoString = R"(
{
"Interface": "${INTERFACE}",
"InterfaceVersion": "${INTERFACE_VERSION}",
"PluginName": "${TARGET}",
"Version": "${PLUGIN_VERSION}",
"git-describe": "${PLUGIN_GIT_DESCRIBE}",
}
)";
EOT
echo "" >> ${VERSION_H}
echo "" >> ${VERSION_H}
if [ ${DEVDIRTY} == "true" ] ; then
echo "#define DEVDIRTY" >> ${VERSION_H}
echo "" >> ${VERSION_H}
echo "" >> ${VERSION_H}
fi
echo "#define SYSTEM_ARCH \"${ARCH}\"" >> ${VERSION_H}
echo "#define ARCH_${ARCH}" >> ${VERSION_H}
echo "" >> ${VERSION_H}
echo "" >> ${VERSION_H}
echo "#endif //VERSION_H" >> ${VERSION_H}

7
plugins/metadata.json Normal file
View File

@ -0,0 +1,7 @@
{
"type" : "hardware",
"name" : "ATBVMCPlugin",
"longname" : "VMC hardware control",
"version" : "1.0.0",
"dependencies" : []
}

View File

@ -15,6 +15,7 @@ public:
virtual ~ATBAPPplugin() = default;
virtual const QString & getPluginInfo() = 0;
virtual void setPluginInfo(QString const &info) = 0;
};
Q_DECLARE_INTERFACE(ATBAPPplugin,

View File

@ -22,16 +22,6 @@ ATBVMCPlugin::ATBVMCPlugin(QObject *parent)
, m_useDebug(false)
, m_pluginState(PLUGIN_STATE::NOT_INITIALIZED)
, m_vmc(nullptr) {
QStringList lst;
lst << QString(" Interface: ") + INTERFACE;
lst << QString("Interface Version: ") + INTERFACE_VERSION;
lst << QString(" PluginName: ") + PLUGIN_NAME;
lst << QString(" Version: ") + PLUGIN_VERSION;
lst << QString(" git-describe: ") + PLUGIN_GIT_DESCRIBE;
lst << QString(" Extended version: ") + PLUGIN_EXTENDED_VERSION;
m_pluginInfo = lst.join('\n');
}
ATBVMCPlugin::~ATBVMCPlugin() {
@ -45,6 +35,20 @@ QString const &ATBVMCPlugin::getPluginInfo() {
return m_pluginInfo;
}
void ATBVMCPlugin::setPluginInfo(QString const &info) {
Q_UNUSED(info);
QStringList lst;
lst << QString(" Interface: ") + INTERFACE;
lst << QString(" Interface Version: ") + INTERFACE_VERSION;
lst << QString(" Plugin name: ") + PLUGIN_NAME;
lst << QString(" Plugin version: ") + PLUGIN_VERSION;
lst << QString("Plugin extended version: ") + PLUGIN_EXTENDED_VERSION;
m_pluginInfo = lst.join('\n');
}
// ----------------------------------------------------------------------------
// interface:
PLUGIN_STATE ATBVMCPlugin::initVMCPlugin(QObject *appControl,

View File

@ -17,7 +17,7 @@ class ATBVMCPlugin : public VMCInterface {
Q_INTERFACES(VMCInterface)
#if QT_VERSION >= 0x050000
Q_PLUGIN_METADATA(IID "eu.atb.ptu.plugin.ATBVMCPlugin")
Q_PLUGIN_METADATA(IID "eu.atb.ptu.plugin.ATBVMCPlugin" FILE "plugins/metadata.json")
#endif
public:
@ -25,6 +25,7 @@ public:
virtual ~ATBVMCPlugin();
virtual const QString & getPluginInfo() override;
virtual void setPluginInfo(QString const &info) override;
// ----------------------------------------------------------------------------
// interface:

View File

@ -46,6 +46,7 @@ public:
virtual ~UnifiedDCVMCInterface() = default;
virtual const QString & getPluginInfo() = 0;
virtual void setPluginInfo(QString const &info) = 0;
// mandantory ATBAPP plugin methods:
virtual PLUGIN_STATE getState() = 0;

View File

@ -28,6 +28,7 @@ public:
virtual ~VMCInterface() = default;
virtual const QString & getPluginInfo() = 0;
virtual void setPluginInfo(QString const &info) = 0;
virtual PLUGIN_STATE initPlugin(QObject *eventReceiver, QObject *atbSystem,
QObject *hmiConfig, QSettings const &settings) override {