3 * Copyright (c) 2020 Project CHIP Authors
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
20 * Copyright (c) 2020 Silicon Labs
22 * Licensed under the Apache License, Version 2.0 (the "License");
23 * you may not use this file except in compliance with the License.
24 * You may obtain a copy of the License at
26 * http://www.apache.org/licenses/LICENSE-2.0
28 * Unless required by applicable law or agreed to in writing, software
29 * distributed under the License is distributed on an "AS IS" BASIS,
30 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31 * See the License for the specific language governing permissions and
32 * limitations under the License.
34 /****************************************************************************
36 * @brief APIs for the Barrier Control Server plugin.
37 *******************************************************************************
38 ******************************************************************************/
45 #include <app/util/basic-types.h>
47 #ifndef DOXYGEN_SHOULD_SKIP_THIS
48 // There are helper getter/setting APIs that are shared between the core
49 // implementation and the CLI code. They are private to the plugin.
51 // This will always either return the current BarrierPosition attribute value
53 uint8_t emAfPluginBarrierControlServerGetBarrierPosition(chip::EndpointId endpoint);
55 // This will always either set the current BarrierPosition attribute value or
57 void emAfPluginBarrierControlServerSetBarrierPosition(chip::EndpointId endpoint, uint8_t barrierPosition);
59 // This will either return whether or not the PartialBarrier bit is set in the
60 // Capabilities attribute value, or it will assert.
61 bool emAfPluginBarrierControlServerIsPartialBarrierSupported(chip::EndpointId endpoint);
63 // This will increment the OpenEvents, CloseEvents, CommandOpenEvents, and
64 // CommandCloseEvents attribute values depending on which combination of the
65 // open and command arguments are passed, or assert.
66 void emAfPluginBarrierControlServerIncrementEvents(chip::EndpointId endpoint, bool open, bool command);
68 // This will read the SafetyStatus attribute and return the value, or assert.
69 uint16_t emAfPluginBarrierControlServerGetSafetyStatus(chip::EndpointId endpoint);
71 // We use a minimum delay so that our barrier changes position in a realistic
73 #define MIN_POSITION_CHANGE_DELAY_MS 30