Skip to content

Commit cf0a20b

Browse files
jlatusekshgutte
authored andcommitted
Add switch to disable unique_id (project-chip#35195)
1 parent 9513f4f commit cf0a20b

26 files changed

+10751
-2
lines changed

.github/.wordlist.txt

+2
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ forkpty
563563
FOTA
564564
FreeRTOS
565565
FreeRTOSConfig
566+
FS
566567
fsl
567568
fstab
568569
fsync
@@ -855,6 +856,7 @@ MbedNewTarget
855856
mbedos
856857
mbedTarget
857858
mbedTLS
859+
MCORE
858860
mcu
859861
MCUboot
860862
mcumgr

.github/workflows/lint.yml

+2
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ jobs:
149149
if [ "$idl_file" = './examples/placeholder/linux/apps/app2/config.matter' ]; then continue; fi
150150
if [ "$idl_file" = './examples/thermostat/thermostat-common/thermostat.matter' ]; then continue; fi
151151
if [ "$idl_file" = './examples/window-app/common/window-app.matter' ]; then continue; fi
152+
# Example is intentionally not spe compliant for use in cert testing
153+
if [ "$idl_file" = './examples/lighting-app-data-mode-no-unique-id/lighting-common/lighting-app.matter' ]; then continue; fi
152154
153155
# Test files are intentionally small and not spec-compilant, just parse-compliant
154156
if [ "$idl_file" = "./scripts/py_matter_idl/matter_idl/tests/inputs/cluster_struct_attribute.matter" ]; then continue; fi

docs/examples/index.md

+9
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,15 @@ lighting-app/**/README
149149
lighting-app/qpg/APPLICATION
150150
```
151151

152+
## Lighting example without unique id
153+
154+
```{toctree}
155+
:glob:
156+
:maxdepth: 1
157+
158+
lighting-app-data-mode-no-unique-id/**/README
159+
```
160+
152161
## Light switch example
153162

154163
```{toctree}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Copyright (c) 2020 Project CHIP Authors
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import("//build_overrides/chip.gni")
16+
import("${chip_root}/src/app/chip_data_model.gni")
17+
18+
config("config") {
19+
include_dirs = [ "include" ]
20+
}
21+
22+
chip_data_model("lighting-common") {
23+
zap_file = "lighting-app.zap"
24+
is_server = true
25+
}
26+
27+
source_set("color-format") {
28+
public_configs = [ ":config" ]
29+
sources = [
30+
"include/ColorFormat.h",
31+
"src/ColorFormat.cpp",
32+
]
33+
}
34+
35+
source_set("lighting-manager") {
36+
deps = [ "${chip_root}/src/lib" ]
37+
public_configs = [ ":config" ]
38+
sources = [
39+
"include/LightingManager.h",
40+
"src/LightingManager.cpp",
41+
]
42+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
*
3+
* Copyright (c) 2021 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#pragma once
20+
21+
#include <stdint.h>
22+
23+
struct RgbColor_t
24+
{
25+
uint8_t r;
26+
uint8_t g;
27+
uint8_t b;
28+
};
29+
30+
struct HsvColor_t
31+
{
32+
uint8_t h;
33+
uint8_t s;
34+
uint8_t v;
35+
};
36+
37+
struct XyColor_t
38+
{
39+
uint16_t x;
40+
uint16_t y;
41+
};
42+
43+
struct CtColor_t
44+
{
45+
uint16_t ctMireds;
46+
};
47+
48+
RgbColor_t XYToRgb(uint8_t Level, uint16_t currentX, uint16_t currentY);
49+
RgbColor_t HsvToRgb(HsvColor_t hsv);
50+
RgbColor_t CTToRgb(CtColor_t ct);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
*
3+
* Copyright (c) 2020 Project CHIP Authors
4+
* All rights reserved.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
#pragma once
20+
21+
#include <stdbool.h>
22+
#include <stdint.h>
23+
24+
#include <functional>
25+
26+
#include <lib/core/CHIPError.h>
27+
28+
class LightingManager
29+
{
30+
public:
31+
enum Action_t
32+
{
33+
ON_ACTION = 0,
34+
OFF_ACTION,
35+
INVALID_ACTION
36+
} Action;
37+
38+
enum State_t
39+
{
40+
kState_On = 0,
41+
kState_Off,
42+
} State;
43+
44+
CHIP_ERROR Init();
45+
bool IsTurnedOn();
46+
bool InitiateAction(Action_t aAction);
47+
48+
using LightingCallback_fn = std::function<void(Action_t)>;
49+
50+
void SetCallbacks(LightingCallback_fn aActionInitiated_CB, LightingCallback_fn aActionCompleted_CB);
51+
52+
private:
53+
friend LightingManager & LightingMgr(void);
54+
State_t mState;
55+
56+
LightingCallback_fn mActionInitiated_CB;
57+
LightingCallback_fn mActionCompleted_CB;
58+
59+
void Set(bool aOn);
60+
61+
static LightingManager sLight;
62+
};
63+
64+
inline LightingManager & LightingMgr(void)
65+
{
66+
return LightingManager::sLight;
67+
}

0 commit comments

Comments
 (0)