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 mDbusServer.addInterface("/", desc, true);
40 Value* BridgeValue::FindSelf() const
42 auto self = BridgeBase::FindSelf();
44 auto valueInterface = dynamic_cast<Value*>(self);
47 throw std::domain_error{"object " + self->GetAddress().ToString() + " doesn't have Value interface"};
49 return valueInterface;
52 double BridgeValue::GetCurrentValue()
54 return FindSelf()->GetCurrent();
57 void BridgeValue::SetCurrentValue(double newValue)
59 FindSelf()->SetCurrent(newValue);
62 double BridgeValue::GetMaximumValue()
64 return FindSelf()->GetMaximum();
67 double BridgeValue::GetMinimumIncrement()
69 return FindSelf()->GetMinimumIncrement();
72 double BridgeValue::GetMinimumValue()
74 return FindSelf()->GetMinimum();