Skip to content

Commit

Permalink
Add rvc example app (#29103)
Browse files Browse the repository at this point in the history
* Added an RVC app example containg the RvcRunMode and RvcClean clusters.

* Regenerated zap code.

* Added the RvcRunMode and RvcClean clusters' logic to the RVC app example.

* Added the RvcOpState cluster's logic to the RVC app example.

* Added documentation about the RVC example app.

* Added an implementation for the GetCoutdownTime virtual function.

* Restyled by whitespace

* Restyled by clang-format

* Restyled by gn

* Added constants for the Cluster's endpoints. Adde vendor mode tags for the mapping mode.

* Restyled by clang-format

* Fixed the feature value for the RvcRun and RvcClean clusters.

* Restyled by clang-format

* zap regen after pull.

* Removed unused clusters form the zap and matter files.

* RVC App: Removed unneccissary error checking.

* RVC App: Changed how the RVC cluster endpoint IDs are set.

* RVC App: refactored method parameter names.

* Update examples/rvc-app/linux/include/CHIPProjectAppConfig.h

Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>

---------

Co-authored-by: Restyled.io <commits@restyled.io>
Co-authored-by: Matt Hazley <hello@matthazley.com>
Co-authored-by: Boris Zbarsky <bzbarsky@apple.com>
  • Loading branch information
4 people authored and pull[bot] committed Sep 21, 2023
1 parent e90a9a4 commit 4093520
Show file tree
Hide file tree
Showing 17 changed files with 12,946 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/rvc-app/RVC_app_state_diagram_drawio.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<mxfile host="confluence.dyson.global.corp" modified="2023-08-07T15:57:02.487Z" agent="5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/115.0.0.0 Safari/537.36" etag="a3AkzVRr4_AOLl6lZ8n9" version="13.5.8" type="atlas"><mxAtlasLibraries/>&#xa; <diagram id="N0rWrYp3qDkjG9NJX1FR" name="Page-1">&#xa; <mxGraphModel dx="902" dy="1752" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="0" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">&#xa; <root>&#xa; <mxCell id="0"/>&#xa; <mxCell id="1" parent="0"/>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-4" value="" style="rounded=1;whiteSpace=wrap;html=1;fontSize=33;fontFamily=Courier New;fillColor=#e1d5e7;strokeColor=#9673a6;" parent="1" vertex="1">&#xa; <mxGeometry x="760" y="1560" width="400" height="400" as="geometry"/>&#xa; </mxCell>&#xa; <mxCell id="I-mBjJadrvhkbWsZapjA-1" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.265;entryDx=0;entryDy=0;entryPerimeter=0;" parent="1" source="UeLTHoZ75eWKntnag94N-6" target="UeLTHoZ75eWKntnag94N-4" edge="1">&#xa; <mxGeometry relative="1" as="geometry"/>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-6" value="&lt;font style=&quot;font-size: 20px&quot;&gt;Start&lt;/font&gt;" style="shape=image;html=1;verticalAlign=top;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;imageAspect=0;aspect=fixed;image=https://cdn0.iconfinder.com/data/icons/octicons/1024/primitive-dot-128.png" parent="1" vertex="1">&#xa; <mxGeometry x="460" y="1602" width="128" height="128" as="geometry"/>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-7" value="&lt;font style=&quot;font-size: 20px&quot;&gt;STOPPED&lt;/font&gt;" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">&#xa; <mxGeometry x="899.5" y="1580" width="121" height="20" as="geometry"/>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-8" value="&lt;font style=&quot;font-size: 18px&quot;&gt;RvcOpState Pause&lt;/font&gt;" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.25;entryY=0;entryDx=0;entryDy=0;exitX=0.25;exitY=1;exitDx=0;exitDy=0;" parent="1" source="UeLTHoZ75eWKntnag94N-14" target="UeLTHoZ75eWKntnag94N-19" edge="1">&#xa; <mxGeometry x="0.0667" relative="1" as="geometry">&#xa; <mxPoint as="offset"/>&#xa; </mxGeometry>&#xa; </mxCell>&#xa; <mxCell id="I-mBjJadrvhkbWsZapjA-2" value="&lt;span style=&quot;color: rgb(0 , 0 , 0) ; font-family: &amp;#34;helvetica&amp;#34; ; font-size: 18px ; font-style: normal ; font-weight: 400 ; letter-spacing: normal ; text-align: center ; text-indent: 0px ; text-transform: none ; word-spacing: 0px ; background-color: rgb(255 , 255 , 255) ; display: inline ; float: none&quot;&gt;RvcRun ChangeToMode IDLE&lt;/span&gt;" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="UeLTHoZ75eWKntnag94N-14" target="UeLTHoZ75eWKntnag94N-4" edge="1">&#xa; <mxGeometry relative="1" as="geometry"/>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-14" value="" style="rounded=1;whiteSpace=wrap;html=1;fontSize=33;fontFamily=Courier New;fillColor=#e1d5e7;strokeColor=#9673a6;" parent="1" vertex="1">&#xa; <mxGeometry x="1470" y="1560" width="390" height="290" as="geometry"/>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-15" value="&lt;span style=&quot;font-size: 20px&quot;&gt;RUNNING&lt;/span&gt;" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">&#xa; <mxGeometry x="1604.5" y="1570" width="121" height="20" as="geometry"/>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-16" value="" style="rounded=1;whiteSpace=wrap;html=1;fontSize=33;fontFamily=Courier New;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" vertex="1">&#xa; <mxGeometry x="1520" y="1600" width="170" height="100" as="geometry"/>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-17" value="" style="rounded=1;whiteSpace=wrap;html=1;fontSize=33;fontFamily=Courier New;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" vertex="1">&#xa; <mxGeometry x="1520" y="1710" width="170" height="100" as="geometry"/>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-18" value="&lt;font style=&quot;font-size: 18px&quot;&gt;RvcOpState Resume&lt;/font&gt;" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.75;entryY=1;entryDx=0;entryDy=0;exitX=0.75;exitY=0;exitDx=0;exitDy=0;" parent="1" source="UeLTHoZ75eWKntnag94N-19" target="UeLTHoZ75eWKntnag94N-14" edge="1">&#xa; <mxGeometry x="-0.0667" relative="1" as="geometry">&#xa; <mxPoint x="1763" y="2030" as="sourcePoint"/>&#xa; <mxPoint as="offset"/>&#xa; </mxGeometry>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-19" value="" style="rounded=1;whiteSpace=wrap;html=1;fontSize=33;fontFamily=Courier New;fillColor=#e1d5e7;strokeColor=#9673a6;" parent="1" vertex="1">&#xa; <mxGeometry x="1470" y="1925" width="390" height="105" as="geometry"/>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-20" value="&lt;span style=&quot;font-size: 20px&quot;&gt;PAUSED&lt;/span&gt;" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">&#xa; <mxGeometry x="1604.5" y="1935" width="121" height="20" as="geometry"/>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-21" value="&lt;font style=&quot;font-size: 18px&quot;&gt;CLEANING/MAPPING&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fontSize=33;fontFamily=Courier New;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" vertex="1">&#xa; <mxGeometry x="1510" y="1965" width="200" height="40" as="geometry"/>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-22" value="&lt;span style=&quot;font-family: &amp;#34;courier new&amp;#34; ; font-size: 18px&quot;&gt;CLEANING&lt;/span&gt;" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">&#xa; <mxGeometry x="1585" y="1610" width="40" height="20" as="geometry"/>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-23" value="&lt;font style=&quot;font-size: 18px&quot;&gt;RvcRun ChangeToMode Cleaning&lt;br&gt;[RvcRunMode = IDLE]&lt;br&gt;&lt;/font&gt;" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.25;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="UeLTHoZ75eWKntnag94N-4" target="UeLTHoZ75eWKntnag94N-16" edge="1">&#xa; <mxGeometry x="-0.1351" relative="1" as="geometry">&#xa; <mxPoint x="1188" y="1490" as="sourcePoint"/>&#xa; <mxPoint x="1630" y="1540" as="targetPoint"/>&#xa; <Array as="points">&#xa; <mxPoint x="1360" y="1660"/>&#xa; <mxPoint x="1360" y="1650"/>&#xa; </Array>&#xa; <mxPoint as="offset"/>&#xa; </mxGeometry>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-24" value="&lt;span style=&quot;font-family: &amp;#34;courier new&amp;#34; ; font-size: 18px&quot;&gt;MAPPING&lt;/span&gt;" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">&#xa; <mxGeometry x="1585" y="1720" width="40" height="20" as="geometry"/>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-43" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;exitX=1;exitY=0.75;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="1" source="UeLTHoZ75eWKntnag94N-4" target="UeLTHoZ75eWKntnag94N-17" edge="1">&#xa; <mxGeometry relative="1" as="geometry">&#xa; <Array as="points">&#xa; <mxPoint x="1359" y="1860"/>&#xa; <mxPoint x="1359" y="1760"/>&#xa; </Array>&#xa; <mxPoint x="1188" y="1839.98" as="sourcePoint"/>&#xa; <mxPoint x="1530" y="1522.48" as="targetPoint"/>&#xa; </mxGeometry>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-44" value="&lt;span style=&quot;font-size: 18px&quot;&gt;RvcRun ChangeToMode Mapping&lt;/span&gt;&lt;br style=&quot;font-size: 18px&quot;&gt;&lt;span style=&quot;font-size: 18px&quot;&gt;[RvcRunMode = IDLE]&lt;/span&gt;" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="UeLTHoZ75eWKntnag94N-43" vertex="1" connectable="0">&#xa; <mxGeometry x="0.0276" y="-1" relative="1" as="geometry">&#xa; <mxPoint x="-40" y="-16.949999999999996" as="offset"/>&#xa; </mxGeometry>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-45" value="" style="rounded=1;whiteSpace=wrap;html=1;fontSize=33;fontFamily=Courier New;fillColor=#d5e8d4;strokeColor=#82b366;" parent="1" vertex="1">&#xa; <mxGeometry x="800" y="1685" width="320" height="240" as="geometry"/>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-46" value="&lt;span style=&quot;font-family: &amp;#34;courier new&amp;#34; ; font-size: 18px&quot;&gt;IDLE&lt;/span&gt;" style="text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" parent="1" vertex="1">&#xa; <mxGeometry x="943" y="1695" width="40" height="20" as="geometry"/>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-47" value="&lt;font style=&quot;font-size: 18px&quot;&gt;RVC Clean Mode&lt;/font&gt;" style="rounded=1;whiteSpace=wrap;html=1;fontSize=33;fontFamily=Courier New;fillColor=#ffe6cc;strokeColor=#d79b00;" parent="1" vertex="1">&#xa; <mxGeometry x="818.5" y="1780" width="250" height="130" as="geometry"/>&#xa; </mxCell>&#xa; <mxCell id="UeLTHoZ75eWKntnag94N-48" value="&lt;font style=&quot;font-size: 18px&quot;&gt;RvcClean ChangeToMode&lt;/font&gt;" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.75;entryDx=0;entryDy=0;exitX=0;exitY=0.25;exitDx=0;exitDy=0;" parent="1" source="UeLTHoZ75eWKntnag94N-47" target="UeLTHoZ75eWKntnag94N-47" edge="1">&#xa; <mxGeometry relative="1" as="geometry">&#xa; <mxPoint x="818.5" y="1812" as="sourcePoint"/>&#xa; <mxPoint x="818.5" y="1877" as="targetPoint"/>&#xa; <Array as="points">&#xa; <mxPoint x="640" y="1813"/>&#xa; <mxPoint x="640" y="1878"/>&#xa; </Array>&#xa; </mxGeometry>&#xa; </mxCell>&#xa; </root>&#xa; </mxGraphModel>&#xa; </diagram>&#xa;</mxfile>
25 changes: 25 additions & 0 deletions examples/rvc-app/linux/.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2020 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/build.gni")

# The location of the build configuration file.
buildconfig = "${build_root}/config/BUILDCONFIG.gn"

# CHIP uses angle bracket includes.
check_system_includes = true

default_args = {
import("//args.gni")
}
53 changes: 53 additions & 0 deletions examples/rvc-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright (c) 2020 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/build.gni")
import("//build_overrides/chip.gni")

config("includes") {
include_dirs = [
".",
"include",
]
}

executable("chip-rvc-app") {
sources = [
"${chip_root}/examples/rvc-app/rvc-common/src/rvc-device.cpp",
"${chip_root}/examples/rvc-app/rvc-common/src/rvc-mode-delegates.cpp",
"${chip_root}/examples/rvc-app/rvc-common/src/rvc-operational-state-delegate.cpp",
"include/CHIPProjectAppConfig.h",
"main.cpp",
]

deps = [
"${chip_root}/examples/platform/linux:app-main",
"${chip_root}/examples/rvc-app/rvc-common",
"${chip_root}/src/lib",
]

include_dirs = [
"include",
"${chip_root}/examples/rvc-app/rvc-common/include",
]
output_dir = root_out_dir
}

group("linux") {
deps = [ ":chip-rvc-app" ]
}

group("default") {
deps = [ ":linux" ]
}
25 changes: 25 additions & 0 deletions examples/rvc-app/linux/args.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2020 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/chip.gni")

import("${chip_root}/config/standalone/args.gni")

chip_device_project_config_include = "<CHIPProjectAppConfig.h>"
chip_project_config_include = "<CHIPProjectAppConfig.h>"
chip_system_project_config_include = "<SystemProjectConfig.h>"

chip_project_config_include_dirs =
[ "${chip_root}/examples/rvc-app/linux/include" ]
chip_project_config_include_dirs += [ "${chip_root}/config/standalone" ]
1 change: 1 addition & 0 deletions examples/rvc-app/linux/build_overrides
34 changes: 34 additions & 0 deletions examples/rvc-app/linux/include/CHIPProjectAppConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
*
* Copyright (c) 2023 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* @file
* Example project configuration file for CHIP.
*
* This is a place to put application or project-specific overrides
* to the default configuration values for general CHIP features.
*
*/

#pragma once

// include the CHIPProjectConfig from config/standalone
#include <CHIPProjectConfig.h>

#define CHIP_DEVICE_CONFIG_DEVICE_TYPE 116 // 0x0074 = 116 = Matter Robotic Vacuum Cleaner
#define CHIP_DEVICE_CONFIG_DEVICE_NAME "Test RVC"
48 changes: 48 additions & 0 deletions examples/rvc-app/linux/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
*
* Copyright (c) 2023 Project CHIP Authors
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "rvc-device.h"
#include <AppMain.h>

using namespace chip;
using namespace chip::app;
using namespace chip::app::Clusters;

RvcDevice * rvcDevice = nullptr;

void ApplicationInit()
{
rvcDevice = new RvcDevice(1);
rvcDevice->Init();
}

void ApplicationShutdown()
{
delete rvcDevice;
rvcDevice = nullptr;
}

int main(int argc, char * argv[])
{
if (ChipLinuxAppInit(argc, argv) != 0)
{
return -1;
}

ChipLinuxAppMainLoop();
return 0;
}
1 change: 1 addition & 0 deletions examples/rvc-app/linux/third_party/connectedhomeip
27 changes: 27 additions & 0 deletions examples/rvc-app/rvc-common/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright (c) 2020 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/chip.gni")
import("${chip_root}/src/app/chip_data_model.gni")

config("config") {
include_dirs = [ "include" ]
}

chip_data_model("rvc-common") {
zap_file = "rvc-app.zap"

zap_pregenerated_dir = "${chip_root}/zzz_generated/rvc-app/zap-generated"
is_server = true
}
Loading

0 comments on commit 4093520

Please sign in to comment.