2 * Copyright (c) 2021 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/accessibility/bridge/bridge-value.h>
24 using namespace Dali::Accessibility;
26 BridgeValue::BridgeValue()
30 void BridgeValue::RegisterInterfaces()
32 DBus::DBusInterfaceDescription desc{AtspiDbusInterfaceValue};
33 AddGetSetPropertyToInterface(desc, "CurrentValue", &BridgeValue::GetCurrentValue, &BridgeValue::SetCurrentValue);
34 AddGetPropertyToInterface(desc, "MaximumValue", &BridgeValue::GetMaximumValue);
35 AddGetPropertyToInterface(desc, "MinimumIncrement", &BridgeValue::GetMinimumIncrement);
36 AddGetPropertyToInterface(desc, "MinimumValue", &BridgeValue::GetMinimumValue);
37 dbusServer.addInterface("/", desc, true);
40 Value* BridgeValue::FindSelf() const
42 auto s = BridgeBase::FindSelf();
44 auto s2 = dynamic_cast<Value*>(s);
46 throw std::domain_error{"object " + s->GetAddress().ToString() + " doesn't have Value interface"};
49 double BridgeValue::GetCurrentValue()
51 return FindSelf()->GetCurrent();
53 void BridgeValue::SetCurrentValue(double new_value)
55 FindSelf()->SetCurrent(new_value);
57 double BridgeValue::GetMaximumValue()
59 return FindSelf()->GetMaximum();
61 double BridgeValue::GetMinimumIncrement()
63 return FindSelf()->GetMinimumIncrement();
65 double BridgeValue::GetMinimumValue()
67 return FindSelf()->GetMinimum();