Skip to content

Commit

Permalink
update GroupSettingsNP Property
Browse files Browse the repository at this point in the history
  • Loading branch information
naheedsa committed Feb 18, 2024
1 parent c9a5559 commit 0fdeef6
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
30 changes: 15 additions & 15 deletions drivers/agent/group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,35 +41,35 @@ Group::Group(int id, Imager *imager) : imager{imager}
groupSettingsNameStream << GROUP_PREFIX << std::setw(2) << std::setfill('0') << id;
groupSettingsName = groupSettingsNameStream.str();

GroupSettingsN.resize(4);
GroupSettingsNP.resize(4);

IUFillNumber(&GroupSettingsN[IMAGE_COUNT], "IMAGE_COUNT", "Image count", "%3.0f", 1, 100, 1, 1);
IUFillNumber(&GroupSettingsN[CCD_BINNING], "CCD_BINNING", "Binning", "%1.0f", 1, 4, 1, 1);
IUFillNumber(&GroupSettingsN[FILTER_SLOT], "FILTER_SLOT", "Filter", "%2.f", 0, 12, 1, 0);
IUFillNumber(&GroupSettingsN[CCD_EXPOSURE_VALUE], "CCD_EXPOSURE_VALUE", "Duration (s)", "%5.2f", 0, 36000, 0, 1.0);
IUFillNumberVector(&GroupSettingsNP, GroupSettingsN.data(), GroupSettingsN.size(), Imager::DEVICE_NAME.c_str(),
GroupSettingsNP[IMAGE_COUNT].fill("IMAGE_COUNT", "Image count", "%3.0f", 1, 100, 1, 1);
GroupSettingsNP[CCD_BINNING].fill("CCD_BINNING", "Binning", "%1.0f", 1, 4, 1, 1);
GroupSettingsNP[FILTER_SLOT].fill( "FILTER_SLOT", "Filter", "%2.f", 0, 12, 1, 0);
GroupSettingsNP[CCD_EXPOSURE_VALUE].fill("CCD_EXPOSURE_VALUE", "Duration (s)", "%5.2f", 0, 36000, 0, 1.0);
GroupSettingsNP.fill(Imager::DEVICE_NAME.c_str(),
groupSettingsName.c_str(), "Image group settings",
groupName.c_str(), IP_RW, 60, IPS_IDLE);
}

int Group::binning() const
{
return GroupSettingsN[CCD_BINNING].value;
return GroupSettingsNP[CCD_BINNING].getValue();
}

int Group::filterSlot() const
{
return GroupSettingsN[FILTER_SLOT].value;
return GroupSettingsNP[FILTER_SLOT].getValue();
}

double Group::exposure() const
{
return GroupSettingsN[CCD_EXPOSURE_VALUE].value;
return GroupSettingsNP[CCD_EXPOSURE_VALUE].getValue();
}

int Group::count() const
{
return GroupSettingsN[IMAGE_COUNT].value;
return GroupSettingsNP[IMAGE_COUNT].getValue();
}


Expand All @@ -78,20 +78,20 @@ bool Group::ISNewNumber(const char *dev, const char *name, double values[], char
INDI_UNUSED(dev);
if (groupSettingsName == name)
{
IUUpdateNumber(&GroupSettingsNP, values, names, n);
GroupSettingsNP.s = IPS_OK;
IDSetNumber(&GroupSettingsNP, nullptr);
GroupSettingsNP.update(values, names, n);
GroupSettingsNP.setState(IPS_OK);
GroupSettingsNP.apply();
return true;
}
return false;
}

void Group::defineProperties()
{
imager->defineProperty(&GroupSettingsNP);
imager->defineProperty(GroupSettingsNP);
}

void Group::deleteProperties()
{
imager->deleteProperty(GroupSettingsNP.name);
imager->deleteProperty(GroupSettingsNP.getName());
}
11 changes: 9 additions & 2 deletions drivers/agent/group.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,15 @@ class Group
std::string groupName;
std::string groupSettingsName;
Imager* imager;
INumberVectorProperty GroupSettingsNP;
std::vector<INumber> GroupSettingsN;
INDI::PropertyNumber GroupSettingsNP {4};
enum
{
IMAGE_COUNT,
CCD_BINNING,
FILTER_SLOT,
CCD_EXPOSURE_VALUE
};
// std::vector<INumber> GroupSettingsN;
};


0 comments on commit 0fdeef6

Please sign in to comment.