Hello Lukas;
At last I have run the application with arguments "~/ds/vdcd/vdcd --sqlitedir ~/ds/data --externaldevices 8999 --externalnonlocal --cfgapiport 8090 --webuiport 80 --sshport 22 --icondir /usr/share/www/icons --hostname "deneme" ". But application doesn't work with runit under /usr/bin folder. I have attached my "run" script under etc\service\vdcd folder. May be this might be incorrect.
Anyway I have changed externaldevicecontainer.cpp as I can add custom channels to the output. In previous versions you
have a CustomChannel class but now it doesnt exist. Now I have changed externaldevicecontainer.cpp and added this CustomChannel class. This is my injection code in externalDeviceContainer.cpp at line 610;
................................................................................................................................
................................................................................................................................
else if (outputType=="basic") {
if (primaryGroup==group_variable) primaryGroup = group_black_joker;
if (outputFunction==outputFunction_custom) outputFunction = outputFunction_switch;
// - use simple scene settings
installSettings(DeviceSettingsPtr(new SceneDeviceSettings(*this)));
// - add generic output behaviour
OutputBehaviourPtr o = OutputBehaviourPtr(new OutputBehaviour(*this));
o->setHardwareOutputConfig(outputFunction, outputFunction==outputFunction_switch ? outputmode_binary : outputmode_gradual, usage_undefined, false, -1);
o->setHardwareName(hardwareName);
o->setGroupMembership(primaryGroup, true); // put into primary group
o->addChannel(ChannelBehaviourPtr(new DigitalChannel(*o)));
addBehaviour(o);
}
else {
// no output, just install minimal settings without scenes
installSettings();
}
....................................................................
....................................................................
//And here is my code part;
if (aInitParams->get("channels", o) && output) {
for (int i = 0; i < o->arrayLength(); i++) {
JsonObjectPtr o2 = o->arrayGet(i);
JsonObjectPtr o3;
int buttonId = 0;
DsChannelType channelType = channeltype_default;
string channelName = "";
double aMin = 0;
double aMax = 100;
double aResolution = 0;
double aDimPerMs = 7;
double aMinDim = 0;
if (o2->get("channeltype", o3)) channelType = (DsChannelType)o3->int32Value();
if (o2->get("channelname", o3)) channelName = o3->stringValue();
if (o2->get("amin", o3)) aMin = o3->doubleValue();
if (o2->get("amax", o3)) aMax = o3->doubleValue();
if (o2->get("aresolution", o3)) aResolution = o3->doubleValue();
if (o2->get("adimperms", o3)) aDimPerMs = o3->doubleValue();
if (o2->get("amindim", o3)) aMinDim = o3->doubleValue();
output->addChannel(ChannelBehaviourPtr(new CustomChannel(*output,
channelType,
channelName.c_str(),
aMin,
aMax,
aResolution,
aDimPerMs,
aMinDim)));
}
}
And this is my custom channel class that I have added to channelBehaviour.hpp file;
class CustomChannel : public ChannelBehaviour
{
typedef ChannelBehaviour inherited;
DsChannelType channelType;
string name;
double min;
double max;
double resolution;
double dimPerMS;
double minDim;
public:
CustomChannel(
OutputBehaviour &aOutput,
DsChannelType aChannelType,
const char *aName,
double aMin,
double aMax,
double aResolution,
double aDimPerMS,
double aMinDim
) :
inherited(aOutput),
channelType(aChannelType),
name(aName),
min(aMin),
max(aMax),
dimPerMS(aDimPerMS),
minDim(aMinDim)
{};
virtual DsChannelType getChannelType() { return channelType; };
virtual const char *getName() { return name.c_str(); };
virtual double getMin() { return min; };
virtual double getMax() { return max; };
virtual double getDimPerMS() { return dimPerMS; };
virtual double getMinDim() { return minDim; };
};
What is your opinion about this injection? If you improve your application by adding this part it will be grateful for me.
Kind Regards,
Mustafa Yuce.
30 Mayıs 2016 Pazartesi 23:03:46 UTC+3 tarihinde luz yazdı: