Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yongjia matter #4

Open
wants to merge 20 commits into
base: beken-chip
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
0112731
Add beken base code into Matter SDK
jamesluo11 Dec 14, 2021
d01d6a0
Support rotate-id
jamesluo11 Jan 27, 2022
0418518
When the device bring up,auto connect to WIFI that the device has
fuxingguo16 Jan 28, 2022
d7e1f2f
network commission refactor
ThomasFang1012 Feb 17, 2022
b353e83
Fix the SoftwareDiagnostics attributes implementation
jamesluo11 Feb 22, 2022
5de404c
1. Add SystemTimer support 2. Fix TC-WIFIDIAG-WiFiDiagnostics cases
jamesluo11 Feb 23, 2022
bd865db
Fix TC-WIFIDIAG-3.1,command:reset-counts
jamesluo11 Feb 24, 2022
3a8ace1
Correct the system timer as the frequency is 500HZ
jamesluo11 Feb 24, 2022
19ea857
syn payload config&git interfaces
ThomasFang1012 Feb 23, 2022
1a91502
Add the OTA function to device.
fuxingguo16 Feb 25, 2022
6976db8
Optimize the code.
fuxingguo16 Feb 28, 2022
3880dbc
sync with TE8/rc3
jamesluo11 Mar 3, 2022
abf1584
When the Beken driver malloc spaces from MEM_HEAP TYPE,the device would
fuxingguo16 Apr 12, 2022
2b848cf
Add networkcommission interface:ScanNetworks & GetConnectedNetwork
ThomasFang1012 Apr 20, 2022
d77202d
Resolve the problem that device print 'watchdog triggered'.
fuxingguo16 Apr 26, 2022
623951e
Sync with TE9
jamesluo11 May 9, 2022
df88c00
Synchronize OTA to TE9.
fuxingguo16 May 17, 2022
22c4a98
KV interface implementation is incorrect. KeyValueStoreManagerImpl::_…
jamesluo11 May 17, 2022
793cdfd
Implement DeviceInfoProvider on beken platform.
fuxingguo16 May 19, 2022
b4d8ef5
modify interface for new chiptool scan command
ThomasFang1012 May 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions config/beken/.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# 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 = {
target_cpu = "arm"
target_os = "freertos"

import("//args.gni")
}
29 changes: 29 additions & 0 deletions config/beken/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 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.

# Options from standalone-chip.mk that differ from configure defaults. These
# options are used from examples/.

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

#import("${chip_root}/build/chip/tests.gni")

group("beken") {
deps = [ "${chip_root}/src/lib" ]

}
group("default") {
deps = [ ":beken" ]
}
38 changes: 38 additions & 0 deletions config/beken/args.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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.

# Options from standalone-chip.mk that differ from configure defaults. These
# options are used from examples/.

chip_device_platform = "beken"

chip_project_config_include = ""
chip_system_project_config_include = ""
chip_ble_project_config_include = ""

mbedtls_target = "//mbedtls:mbedtls"
lwip_platform = "external"

chip_build_tests = false

chip_inet_config_enable_tcp_endpoint = true
chip_inet_config_enable_udp_endpoint = true

chip_config_network_layer_ble = true
chip_config_memory_management = "platform"
chip_enable_additional_data_advertising = true
chip_enable_rotating_device_id = true
chip_enable_ota_requestor = true

custom_toolchain = "//third_party/connectedhomeip/config/beken/toolchain:beken"
1 change: 1 addition & 0 deletions config/beken/build
1 change: 1 addition & 0 deletions config/beken/build_overrides
22 changes: 22 additions & 0 deletions config/beken/mbedtls/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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.

# Options from standalone-chip.mk that differ from configure defaults. These
# options are used from examples/.

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

# Ameba has its own mbedtls, so nothing to do, just provide a target
group("mbedtls") {
}
1 change: 1 addition & 0 deletions config/beken/third_party/connectedhomeip
35 changes: 35 additions & 0 deletions config/beken/toolchain/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# 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")
#import("${build_root}/toolchain/arm_gcc/arm_toolchain.gni")
import("${build_root}/toolchain/gcc_toolchain.gni")
declare_args() {
beken_ar = ""
beken_cc = ""
beken_cxx = ""
}

gcc_toolchain("beken") {
ar = beken_ar
cc = beken_cc
cxx = beken_cxx

toolchain_args = {
current_os = "freertos"
is_clang = false
import("${chip_root}/src/platform/Beken/args.gni")
}
}
168 changes: 168 additions & 0 deletions examples/lighting-app/beken/main/CHIPDeviceManager.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
/*
*
* 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.
*/

/**
* @file
* This file implements the CHIP Device Interface that is used by
* applications to interact with the CHIP stack
*
*/

#include <stdlib.h>

#include "CHIPDeviceManager.h"
#include <app/util/basic-types.h>
#include <support/CHIPMem.h>
#include <support/CodeUtils.h>
#include <support/ErrorStr.h>

#include <app-common/zap-generated/attribute-id.h>
#include <app-common/zap-generated/attributes/Accessors.h>
#include <app-common/zap-generated/cluster-id.h>
#include <app-common/zap-generated/command-id.h>
#include <app/util/af-types.h>
#include <app/util/attribute-storage.h>
#include <app/util/util.h>

using namespace ::chip;

namespace chip {

namespace DeviceManager {

using namespace ::chip::DeviceLayer;

void CHIPDeviceManager::CommonDeviceEventHandler(const ChipDeviceEvent * event, intptr_t arg)
{
CHIPDeviceManagerCallbacks * cb = reinterpret_cast<CHIPDeviceManagerCallbacks *>(arg);
if (cb != nullptr)
{
cb->DeviceEventCallback(event, reinterpret_cast<intptr_t>(cb));
}
}

CHIP_ERROR CHIPDeviceManager::Init(CHIPDeviceManagerCallbacks * cb)
{
CHIP_ERROR err;
mCB = cb;

err = PlatformMgr().InitChipStack();
SuccessOrExit(err);

if (CONFIG_NETWORK_LAYER_BLE)
{
ConnectivityMgr().SetBLEAdvertisingEnabled(true);
}

err = Platform::MemoryInit();
SuccessOrExit(err);

PlatformMgr().AddEventHandler(CHIPDeviceManager::CommonDeviceEventHandler, reinterpret_cast<intptr_t>(cb));

// // Start a task to run the CHIP Device event loop.
err = PlatformMgr().StartEventLoopTask();
if (err != CHIP_NO_ERROR)
{
ChipLogProgress(Zcl, "StartEventLoopTask() - ERROR!\r\n");
}
else
{
ChipLogProgress(Zcl, "StartEventLoopTask() - OK\r\n");
}

exit:
return err;
}
} // namespace DeviceManager
} // namespace chip

void MatterPostAttributeChangeCallback(const chip::app::ConcreteAttributePath & attributePath, uint8_t mask, uint8_t type,
uint16_t size, uint8_t * value)
{
chip::DeviceManager::CHIPDeviceManagerCallbacks * cb =
chip::DeviceManager::CHIPDeviceManager::GetInstance().GetCHIPDeviceManagerCallbacks();

EndpointId endpointId = attributePath.mEndpointId;
ClusterId clusterId = attributePath.mClusterId;
AttributeId attributeId = attributePath.mAttributeId;

if (clusterId == ZCL_ON_OFF_CLUSTER_ID)
{
if (attributeId != ZCL_ON_OFF_ATTRIBUTE_ID)
{
ChipLogProgress(Zcl, "Unknown attribute ID: %" PRIx32, attributeId);
return;
}
}
else if (clusterId == ZCL_LEVEL_CONTROL_CLUSTER_ID)
{
if (attributeId != ZCL_CURRENT_LEVEL_ATTRIBUTE_ID)
{
ChipLogProgress(Zcl, "Unknown attribute ID: %" PRIx32, attributeId);
return;
}
if (size == 1)
{
// ChipLogProgress(Zcl, "New level: %u ", *value);
}
else
{
ChipLogError(Zcl, "wrong length for level: %d\n", size);
}
}
else if (clusterId == ZCL_COLOR_CONTROL_CLUSTER_ID)
{
uint8_t hue, saturation;

if ((attributeId != ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID) &&
(attributeId != ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID))
{
ChipLogProgress(Zcl, "Unknown attribute ID: %" PRIx32, attributeId);
return;
}

if (attributeId == ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID)
{
hue = *value;
emberAfReadServerAttribute(endpointId, ZCL_COLOR_CONTROL_CLUSTER_ID, ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID,
&saturation, sizeof(uint8_t));
}
if (attributeId == ZCL_COLOR_CONTROL_CURRENT_SATURATION_ATTRIBUTE_ID)
{
saturation = *value;
emberAfReadServerAttribute(endpointId, ZCL_COLOR_CONTROL_CLUSTER_ID, ZCL_COLOR_CONTROL_CURRENT_HUE_ATTRIBUTE_ID, &hue,
sizeof(uint8_t));
}
ChipLogProgress(Zcl, "New hue: %d, New saturation: %d ", hue, saturation);
}
else if (clusterId == ZCL_IDENTIFY_CLUSTER_ID)
{
if (attributeId == ZCL_IDENTIFY_TIME_ATTRIBUTE_ID)
{
if (cb != nullptr)
{
cb->PostAttributeChangeCallback(endpointId, clusterId, attributeId, mask, type, size, value);
}
ChipLogProgress(Zcl, "ZCL_IDENTIFY_TIME_ATTRIBUTE_ID value: %u ", *value);
}
}
else
{
// ChipLogProgress(Zcl, "Unknown cluster ID: %" PRIx32, clusterId);
return;
}
}
Loading