* @copydoc UiObject::getStyle()
*/
std::string getStyle() const;
+
/**
* @copydoc UiObject::getXPath()
*/
Rect<int> getWindowBoundingBox() const;
/**
+ * @copydoc UiObject::getMinValue()
+ *
+ */
+ double getMinValue() const;
+
+ /**
+ * @copydoc UiObject::getMaxValue()
+ *
+ */
+ double getMaxValue() const;
+
+ /**
+ * @copydoc UiObject::getValue()
+ *
+ */
+ double getValue() const;
+
+ /**
+ * @copydoc UiObject::getIncrement()
+ *
+ */
+ double getIncrement() const;
+
+ /**
* @copydoc UiObject::isCheckable()
*/
bool isCheckable() const;
virtual void updateXPath() = 0;
/**
+ * @copydoc UiObject::updateValue()
+ */
+ virtual void updateValue() = 0;
+
+ /**
* @copydoc UiObject::setFocus()
*/
virtual bool setFocus() = 0;
virtual bool setValue(std::string text) = 0;
/**
+ * @brief Sets Node's value.
+ *
+ * @param[in] value double
+ *
+ * @return true if success, else false
+ *
+ * @since_tizen 7.0
+ */
+ virtual bool setValue(double value) = 0;
+
+ /**
* @brief Check object valid or not.
*
* @return true if valid, else false
Rect<int> mWindowBoundingBox;
int mSupportingIfaces;
int mFeatureProperty;
+ double mMinValue;
+ double mMaxValue;
+ double mValue;
+ double mIncrement;
private:
bool mValid;
void updateXPath() override;
/**
+ * @copydoc UiObject::updateValue()
+ */
+ void updateValue() override;
+
+ /**
* @copydoc UiObject::setFocus()
*/
bool setFocus() override;
*/
bool setValue(std::string text) override;
+ /**
+ * @copydoc AccessibleNode::setValue()
+ */
+ bool setValue(double value) override;
+
private:
using AccessibleNode::setFeatureProperty;
static void Atspi_accessible_clear_cache (AtspiAccessible *node);
static gboolean Atspi_component_grab_focus(AtspiComponent *obj, GError **error);
static void Atspi_accessible_set_cache_mask(AtspiAccessible *node, AtspiCache mask);
+ static AtspiValue *Atspi_accessible_get_value(AtspiAccessible *node);
+ static gdouble Atspi_value_get_minimum_value(AtspiValue *iface, GError **error);
+ static gdouble Atspi_value_get_current_value(AtspiValue *iface, GError **error);
+ static gdouble Atspi_value_get_maximum_value(AtspiValue *iface, GError **error);
+ static gboolean Atspi_value_set_current_value(AtspiValue *iface, gdouble value, GError **error);
+ static gdouble Atspi_value_get_minimum_increment(AtspiValue *iface, GError **error);
private:
static std::recursive_mutex mMutex;
* @since_tizen 6.5
*/
void updateExtents() override;
+
/**
* @brief TBD
* @since_tizen 6.5
* @brief TBD
* @since_tizen 7.0
*/
+ void updateValue() override;
+
+ /**
+ * @brief TBD
+ * @since_tizen 7.0
+ */
bool setFocus() override;
/**
*/
bool setValue(std::string text) override;
+ /**
+ * @brief TBD
+ * @since_tizen 7.0
+ */
+ bool setValue(double value) override;
+
public:
using AccessibleNode::setFeatureProperty;
/**
const Rect<int> getWindowBoundingBox() const;
/**
+ * @brief Gets object's minimum value.
+ *
+ * @return double
+ *
+ * @since_tizen 7.0
+ */
+ const double getMinValue() const;
+
+ /**
+ * @brief Gets object's maximum value.
+ *
+ * @return double
+ *
+ * @since_tizen 7.0
+ */
+ const double getMaxValue() const;
+
+ /**
+ * @brief Gets object's current value.
+ *
+ * @return double
+ *
+ * @since_tizen 7.0
+ */
+ const double getValue() const;
+
+ /**
+ * @brief Gets object's current increment.
+ *
+ * @return double
+ *
+ * @since_tizen 7.0
+ */
+ const double getIncrement() const;
+
+ /**
+ * @brief Sets object's value.
+ *
+ * @param[in] double value
+ *
+ * @return true if success else false
+ *
+ * @since_tizen 7.0
+ */
+ bool setValue(double value);
+
+ /**
* @brief Gets object's checkable property.
*
* @return true if checkable else false
void updateXPath() const;
/**
+ * @brief Updates object's value information from atspi server.
+ *
+ * @since_tizen 7.0
+ */
+ void updateValue() const;
+
+ /**
* @brief Sets focus to object.
*
* @since_tizen 7.0
}
AccessibleNode::AccessibleNode()
-: mText{""}, mPkg{""}, mRole{""}, mId{""}, mType{""}, mStyle{""},
- mScreenBoundingBox{0,0,0,0}, mWindowBoundingBox{0,0,0,0}, mSupportingIfaces(0), mFeatureProperty(0), mValid{true}, mLock{}
+: mText{""}, mPkg{""}, mRole{""}, mId{""}, mAutomationId{""}, mType{""}, mStyle{""}, mXPath{""},
+ mScreenBoundingBox{0,0,0,0}, mWindowBoundingBox{0,0,0,0}, mSupportingIfaces(0), mFeatureProperty(0), mMinValue{0.0}, mMaxValue{0.0}, mValue{0.0}, mIncrement{0.0}, mValid{true}, mLock{}
{
}
{
return hasFeatureProperty(NodeFeatureProperties::ACTIVE);
}
+
+double AccessibleNode::getMinValue() const
+{
+ return mMinValue;
+}
+
+double AccessibleNode::getMaxValue() const
+{
+ return mMaxValue;
+}
+
+double AccessibleNode::getValue() const
+{
+ return mValue;
+}
+
+double AccessibleNode::getIncrement() const
+{
+ return mIncrement;
+}
\ No newline at end of file
mXPath = XMLDoc->getXPath(mId);
}
+void AtspiAccessibleNode::updateValue()
+{
+ AtspiWrapper::Atspi_accessible_clear_cache(mNode);
+
+ AtspiValue *value = AtspiWrapper::Atspi_accessible_get_value(mNode);
+ if (value) {
+ mMinValue= AtspiWrapper::Atspi_value_get_minimum_value(value, NULL);
+ mMaxValue= AtspiWrapper::Atspi_value_get_maximum_value(value, NULL);
+ mValue= AtspiWrapper::Atspi_value_get_current_value(value, NULL);
+ mIncrement= AtspiWrapper::Atspi_value_get_minimum_increment(value, NULL);
+ g_object_unref(value);
+ }
+}
+
bool AtspiAccessibleNode::setFocus()
{
AtspiComponent *component = AtspiWrapper::Atspi_accessible_get_component_iface(mNode);
g_free(windowExtent);
}
g_object_unref(component);
+ }
- if (updateAll) updateXPath();
+ AtspiValue *value = AtspiWrapper::Atspi_accessible_get_value(mNode);
+ if (value) {
+ mMinValue= AtspiWrapper::Atspi_value_get_minimum_value(value, NULL);
+ mMaxValue= AtspiWrapper::Atspi_value_get_maximum_value(value, NULL);
+ mValue= AtspiWrapper::Atspi_value_get_current_value(value, NULL);
+ mIncrement= AtspiWrapper::Atspi_value_get_minimum_increment(value, NULL);
+ g_object_unref(value);
}
+
+ if (updateAll) updateXPath();
+
} else {
setFeatureProperty(ATSPI_STATE_INVALID);
}
if (!iface) return false;
- refresh();
+ updateName();
int len = getText().length();
AtspiWrapper::Atspi_editable_text_delete_text(iface, 0, len, NULL);
AtspiWrapper::Atspi_editable_text_insert_text(iface, 0, text.c_str(), text.length(),
return true;
}
+bool AtspiAccessibleNode::setValue(double value)
+{
+ if (!isValid()){
+ return false;
+ }
+
+ AtspiValue *iface = AtspiWrapper::Atspi_accessible_get_value(mNode);
+ LOGI("set Value iface:%p obj:%p value:%lf",iface, mNode, value);
+
+ if (!iface) return false;
+
+ updateValue();
+ AtspiWrapper::Atspi_value_set_current_value(iface, value, NULL);
+ g_object_unref(iface);
+
+ return true;
+}
+
void AtspiAccessibleNode::setFeatureProperty(AtspiStateType type)
{
switch(type) {
std::unique_lock<std::recursive_mutex> lock(mMutex);
return atspi_accessible_set_cache_mask (node, mask);
}
+
+AtspiValue *AtspiWrapper::Atspi_accessible_get_value(AtspiAccessible *node)
+{
+ std::unique_lock<std::recursive_mutex> lock(mMutex);
+ return atspi_accessible_get_value_iface(node);
+}
+
+gdouble AtspiWrapper::Atspi_value_get_minimum_value(AtspiValue *iface, GError **error)
+{
+ std::unique_lock<std::recursive_mutex> lock(mMutex);
+ return atspi_value_get_minimum_value(iface, error);
+}
+
+gdouble AtspiWrapper::Atspi_value_get_current_value(AtspiValue *iface, GError **error)
+{
+ std::unique_lock<std::recursive_mutex> lock(mMutex);
+ return atspi_value_get_current_value(iface, error);
+}
+
+gdouble AtspiWrapper::Atspi_value_get_maximum_value(AtspiValue *iface, GError **error)
+{
+ std::unique_lock<std::recursive_mutex> lock(mMutex);
+ return atspi_value_get_maximum_value(iface, error);
+}
+
+gboolean AtspiWrapper::Atspi_value_set_current_value(AtspiValue *iface, gdouble value, GError **error)
+{
+ std::unique_lock<std::recursive_mutex> lock(mMutex);
+ return atspi_value_set_current_value(iface, value, error);
+}
+
+gdouble AtspiWrapper::Atspi_value_get_minimum_increment(AtspiValue *iface, GError **error)
+{
+ std::unique_lock<std::recursive_mutex> lock(mMutex);
+ return atspi_value_get_minimum_increment(iface, error);
+}
\ No newline at end of file
{
}
+void MockAccessibleNode::updateValue()
+{
+}
+
bool MockAccessibleNode::setFocus()
{
return false;
return true;
}
+bool MockAccessibleNode::setValue(double value)
+{
+ return true;
+}
+
void MockAccessibleNode::setFeatureProperty(int type)
{
switch(type) {
return getAccessibleNode()->getXPath();
}
+const double UiObject::getMinValue() const
+{
+ return getAccessibleNode()->getMinValue();
+}
+
+const double UiObject::getMaxValue() const
+{
+ return getAccessibleNode()->getMaxValue();
+}
+
+const double UiObject::getValue() const
+{
+ return getAccessibleNode()->getValue();
+}
+
+const double UiObject::getIncrement() const
+{
+ return getAccessibleNode()->getIncrement();
+}
+
+bool UiObject::setValue(double value)
+{
+ return getAccessibleNode()->setValue(value);
+}
+
bool UiObject::setText(std::string text)
{
return getAccessibleNode()->setValue(text);
mNode->updateXPath();
}
+void UiObject::updateValue() const
+{
+ mNode->updateValue();
+}
+
bool UiObject::setFocus() const
{
return mNode->setFocus();
root->set_isvisible(obj->isVisible());
root->set_isselectable(obj->isSelectable());
+ root->set_minvalue(obj->getMinValue());
+ root->set_maxvalue(obj->getMaxValue());
+ root->set_value(obj->getValue());
+ root->set_increment(obj->getIncrement());
+
for( auto && childNode : node->mChildren) {
::aurum::Element *child = root->add_child();
traverse(child, childNode, depth+1);
elm->set_isvisible(obj->isVisible());
elm->set_isselectable(obj->isSelectable());
+ elm->set_minvalue(obj->getMinValue());
+ elm->set_maxvalue(obj->getMaxValue());
+ elm->set_value(obj->getValue());
+ elm->set_increment(obj->getIncrement());
+
mResponse->set_status(::aurum::RspStatus::OK);
} else {
mResponse->set_status(::aurum::RspStatus::ERROR);
elm->set_isactive(obj->isActive());
elm->set_isvisible(obj->isVisible());
elm->set_isselectable(obj->isSelectable());
+
+ elm->set_minvalue(obj->getMinValue());
+ elm->set_maxvalue(obj->getMaxValue());
+ elm->set_value(obj->getValue());
+ elm->set_increment(obj->getIncrement());
}
mResponse->set_status(::aurum::RspStatus::OK);
} else {
#include "UiObject.h"
GetValueCommand::GetValueCommand(const ::aurum::ReqGetValue *request,
- ::aurum::RspGetValue *response)
+ ::aurum::RspGetValue *response)
: mRequest{request}, mResponse{response}
{
}
::grpc::Status GetValueCommand::execute()
{
LOGI("GetValue --------------- ");
- ObjectMapper *mObjMap = ObjectMapper::getInstance();
- std::shared_ptr<UiObject> obj = mObjMap->getElement(mRequest->elementid());
+ ::aurum::ParamType param_type = mRequest->type();
+ if (param_type == ::aurum::STRING) {
+ ObjectMapper *mObjMap = ObjectMapper::getInstance();
+ std::shared_ptr<UiObject> obj =
+ mObjMap->getElement(mRequest->elementid());
- if (obj) {
- obj->updateName();
- std::string text = obj->getText();
- mResponse->set_stringvalue(text.c_str());
- mResponse->set_status(::aurum::RspStatus::OK);
+ if (obj) {
+ obj->updateName();
+ std::string text = obj->getText();
+ mResponse->set_type(::aurum::STRING);
+ mResponse->set_stringvalue(text.c_str());
+ mResponse->set_status(::aurum::RspStatus::OK);
+ } else {
+ mResponse->set_status(::aurum::RspStatus::ERROR);
+ }
+ } else if (param_type == ::aurum::INT) {
+ LOGI("Integer is not supported.");
+ mResponse->set_status(::aurum::RspStatus::ERROR);
+ } else if (param_type == ::aurum::DOUBLE) {
+ ObjectMapper *mObjMap = ObjectMapper::getInstance();
+ std::shared_ptr<UiObject> obj =
+ mObjMap->getElement(mRequest->elementid());
+
+ if (obj) {
+ obj->updateValue();
+ double value = obj->getValue();
+ mResponse->set_type(::aurum::DOUBLE);
+ mResponse->set_doublevalue(value);
+ mResponse->set_status(::aurum::RspStatus::OK);
+ } else {
+ mResponse->set_status(::aurum::RspStatus::ERROR);
+ }
+ } else if (param_type == ::aurum::BOOL) {
+ LOGI("Boolean is not supported.");
+ mResponse->set_status(::aurum::RspStatus::ERROR);
}
return grpc::Status::OK;
{
bool ret = false;
LOGI("SetValue --------------- ");
- LOGI("text:%s", mRequest->stringvalue().c_str());
+ ::aurum::ParamType param_type = mRequest->type();
+ if (param_type == ::aurum::STRING) {
+ LOGI("text:%s", mRequest->stringvalue().c_str());
- ObjectMapper *mObjMap = ObjectMapper::getInstance();
- std::shared_ptr<UiObject> obj = mObjMap->getElement(mRequest->elementid());
- if (obj) ret = obj->setText(const_cast<std::string&>(mRequest->stringvalue()));
+ ObjectMapper* mObjMap = ObjectMapper::getInstance();
+ std::shared_ptr<UiObject> obj =
+ mObjMap->getElement(mRequest->elementid());
+ if (obj)
+ ret =
+ obj->setText(const_cast<std::string&>(mRequest->stringvalue()));
+ } else if (param_type == ::aurum::INT) {
+ LOGI("Integer is not supported.");
+ } else if (param_type == ::aurum::DOUBLE) {
+ LOGI("value:%lf", mRequest->doublevalue());
+ ObjectMapper* mObjMap = ObjectMapper::getInstance();
+ std::shared_ptr<UiObject> obj =
+ mObjMap->getElement(mRequest->elementid());
+ if (obj) ret = obj->setValue(mRequest->doublevalue());
- if (ret) mResponse->set_status(::aurum::RspStatus::OK);
- else mResponse->set_status(::aurum::RspStatus::ERROR);
+ } else if (param_type == ::aurum::BOOL) {
+ LOGI("Boolean is not supported.");
+ }
+
+ if (ret)
+ mResponse->set_status(::aurum::RspStatus::OK);
+ else
+ mResponse->set_status(::aurum::RspStatus::ERROR);
return grpc::Status::OK;
}
bool isActive = 21;
bool isVisible = 22;
bool isSelectable = 23;
+
+ double minValue = 24;
+ double maxValue = 25;
+ double value = 26;
+ double increment = 27;
}
message Point {
message ReqGetValue {
string elementId = 1;
+ ParamType type = 2;
// TODO : text, widgetstyle, widgettype, automationid
}
message RspGetValue {