Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into x10062-clock-type-2…
Browse files Browse the repository at this point in the history
…-timers
  • Loading branch information
kpschoedel committed Oct 21, 2021
2 parents bc64f81 + 1b9ac5f commit 607c4d8
Show file tree
Hide file tree
Showing 132 changed files with 903 additions and 5,183 deletions.
32 changes: 16 additions & 16 deletions .pullapprove.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,14 @@ groups:
teams: [reviewers-comcast]
reviews:
request: 10
shared-reviewers-espressif:
type: optional
conditions:
- files.include('*')
reviewers:
teams: [reviewers-espressif]
reviews:
request: 10
# shared-reviewers-espressif:
# type: optional
# conditions:
# - files.include('*')
# reviewers:
# teams: [reviewers-espressif]
# reviews:
# request: 10
shared-reviewers-google:
type: optional
conditions:
Expand All @@ -107,14 +107,14 @@ groups:
teams: [reviewers-google]
reviews:
request: 10
shared-reviewers-lg:
type: optional
conditions:
- files.include('*')
reviewers:
teams: [reviewers-lg]
reviews:
request: 10
# shared-reviewers-lg:
# type: optional
# conditions:
# - files.include('*')
# reviewers:
# teams: [reviewers-lg]
# reviews:
# request: 10
shared-reviewers-nordic:
type: optional
conditions:
Expand Down
4 changes: 2 additions & 2 deletions examples/bridge-app/esp32/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ void EncodeFixedLabel(const char * label, const char * value, uint8_t * buffer,
uint16_t listCount = 1;
_LabelStruct labelStruct;

labelStruct.label = chip::ByteSpan(Uint8::from_const_char(label), strlen(label));
labelStruct.value = chip::ByteSpan(Uint8::from_const_char(value), strlen(value));
labelStruct.label = chip::CharSpan(label, strlen(label));
labelStruct.value = chip::CharSpan(value, strlen(value));

emberAfCopyList(ZCL_FIXED_LABEL_CLUSTER_ID, am, true, buffer, reinterpret_cast<uint8_t *>(&labelStruct), 1);
emberAfCopyList(ZCL_FIXED_LABEL_CLUSTER_ID, am, true, buffer, reinterpret_cast<uint8_t *>(&listCount), 0);
Expand Down
8 changes: 6 additions & 2 deletions examples/bridge-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,14 @@ void EncodeFixedLabel(const char * label, const char * value, uint8_t * buffer,
uint16_t listCount = 1;
_LabelStruct labelStruct;

labelStruct.label = chip::ByteSpan(reinterpret_cast<const uint8_t *>(label), kFixedLabelElementsOctetStringSize);
// TODO: This size is obviously wrong. See
// https://github.com/project-chip/connectedhomeip/issues/10743
labelStruct.label = CharSpan(label, kFixedLabelElementsOctetStringSize);

strncpy(zclOctetStrBuf, value, sizeof(zclOctetStrBuf));
labelStruct.value = chip::ByteSpan(reinterpret_cast<uint8_t *>(&zclOctetStrBuf[0]), sizeof(zclOctetStrBuf));
// TODO: This size is obviously wrong. See
// https://github.com/project-chip/connectedhomeip/issues/10743
labelStruct.value = CharSpan(&zclOctetStrBuf[0], sizeof(zclOctetStrBuf));

emberAfCopyList(ZCL_FIXED_LABEL_CLUSTER_ID, am, true, buffer, reinterpret_cast<uint8_t *>(&labelStruct), 1);
emberAfCopyList(ZCL_FIXED_LABEL_CLUSTER_ID, am, true, buffer, reinterpret_cast<uint8_t *>(&listCount), 0);
Expand Down
7 changes: 7 additions & 0 deletions examples/chip-tool/commands/tests/TestCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ CHIP_ERROR TestCommand::WaitForMs(uint32_t ms)
return chip::DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Milliseconds32(ms), OnWaitForMsFn, this);
}

CHIP_ERROR TestCommand::Log(const char * message)
{
ChipLogDetail(chipTool, "%s", message);
WaitForMs(0);
return CHIP_NO_ERROR;
}

void TestCommand::Exit(std::string message)
{
ChipLogError(chipTool, " ***** Test Failure: %s\n", message.c_str());
Expand Down
1 change: 1 addition & 0 deletions examples/chip-tool/commands/tests/TestCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class TestCommand : public CHIPCommand

/////////// GlobalCommands Interface /////////
CHIP_ERROR WaitForMs(uint32_t ms);
CHIP_ERROR Log(const char * message);

protected:
ChipDevice * mDevice;
Expand Down
16 changes: 1 addition & 15 deletions examples/chip-tool/templates/partials/test_cluster.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class {{filename}}: public TestCommand
{{#if (isTestOnlyCluster cluster)}}
CHIP_ERROR {{>testCommand}}()
{
return {{command}}({{#chip_tests_item_parameters}}{{#not_first}}, {{/not_first}}{{definedValue}}{{/chip_tests_item_parameters}});
return {{command}}({{#chip_tests_item_parameters}}{{#not_first}}, {{/not_first}}{{#if (isString type)}}"{{/if}}{{definedValue}}{{#if (isString type)}}"{{/if}}{{/chip_tests_item_parameters}});
}
{{else}}
{{#*inline "failureResponse"}}OnFailureResponse_{{index}}{{/inline}}
Expand All @@ -119,7 +119,6 @@ class {{filename}}: public TestCommand
{{/chip_tests_item_parameters}}

auto success = [](void * context, const responseType & data) {
{{! TODO Update CHAR_STRING to be of type chip::CharSpan instead of chip::ByteSpan }}
(static_cast<{{filename}} *>(context))->OnSuccessResponse_{{index}}({{#chip_tests_item_response_parameters}}{{#not_first}}, {{/not_first}}data.{{asLowerCamelCase name}}{{/chip_tests_item_response_parameters}});
};

Expand Down Expand Up @@ -190,16 +189,3 @@ class {{filename}}: public TestCommand
};

{{/chip_tests}}

void registerCommandsTests(Commands & commands)
{
const char * clusterName = "Tests";

commands_list clusterCommands = {
{{#chip_tests tests}}
make_unique<{{filename}}>(),
{{/chip_tests}}
};

commands.Register(clusterName, clusterCommands);
}
13 changes: 13 additions & 0 deletions examples/chip-tool/templates/tests-commands.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,16 @@
#include <commands/tests/TestCommand.h>

{{>test_cluster tests=(getTests)}}

void registerCommandsTests(Commands & commands)
{
const char * clusterName = "Tests";

commands_list clusterCommands = {
{{#chip_tests (getTests)}}
make_unique<{{filename}}>(),
{{/chip_tests}}
};

commands.Register(clusterName, clusterCommands);
}
1 change: 1 addition & 0 deletions examples/chip-tool/templates/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ function getTests()
'TestClusterComplexTypes',
'TestConstraints',
'TestDelayCommands',
'TestLogCommands',
'TestDescriptorCluster',
'TestOperationalCredentialsCluster',
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ CHIP_ERROR AudioOutputManager::proxyGetListOfAudioOutputInfo(chip::app::Attribut
{
chip::app::Clusters::AudioOutput::Structs::AudioOutputInfo::Type audioOutputInfo;
audioOutputInfo.outputType = EMBER_ZCL_AUDIO_OUTPUT_TYPE_HDMI;
audioOutputInfo.name = chip::ByteSpan(chip::Uint8::from_char(name), sizeof(name) - 1);
audioOutputInfo.name = chip::CharSpan(name, sizeof(name) - 1);
audioOutputInfo.index = static_cast<uint8_t>(1 + i);
ReturnErrorOnFailure(encoder.Encode(audioOutputInfo));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ CHIP_ERROR MediaInputManager::proxyGetInputList(chip::app::AttributeValueEncoder
for (int i = 0; i < maximumVectorSize; ++i)
{
chip::app::Clusters::MediaInput::Structs::MediaInputInfo::Type mediaInput;
mediaInput.description = chip::ByteSpan(chip::Uint8::from_char(description), sizeof(description) - 1);
mediaInput.name = chip::ByteSpan(chip::Uint8::from_char(name), sizeof(name) - 1);
mediaInput.description = chip::CharSpan(description, sizeof(description) - 1);
mediaInput.name = chip::CharSpan(name, sizeof(name) - 1);
mediaInput.inputType = EMBER_ZCL_MEDIA_INPUT_TYPE_HDMI;
mediaInput.index = static_cast<uint8_t>(1 + i);
ReturnErrorOnFailure(encoder.Encode(mediaInput));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ CHIP_ERROR TargetNavigatorManager::proxyGetTargetInfoList(chip::app::AttributeVa
for (int i = 0; i < maximumVectorSize; ++i)
{
chip::app::Clusters::TargetNavigator::Structs::NavigateTargetTargetInfo::Type targetInfo;
targetInfo.name = chip::ByteSpan(chip::Uint8::from_char(name), sizeof(name) - 1);
targetInfo.name = chip::CharSpan(name, sizeof(name) - 1);
targetInfo.identifier = static_cast<uint8_t>(1 + i);
ReturnErrorOnFailure(encoder.Encode(targetInfo));
}
Expand Down
6 changes: 3 additions & 3 deletions examples/tv-app/linux/include/tv-channel/TvChannelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ CHIP_ERROR TvChannelManager::proxyGetTvChannelList(chip::app::AttributeValueEnco
for (int i = 0; i < maximumVectorSize; ++i)
{
chip::app::Clusters::TvChannel::Structs::TvChannelInfo::Type channelInfo;
channelInfo.affiliateCallSign = ByteSpan(Uint8::from_char(affiliateCallSign), sizeof(affiliateCallSign) - 1);
channelInfo.callSign = ByteSpan(Uint8::from_char(callSign), sizeof(callSign) - 1);
channelInfo.name = ByteSpan(Uint8::from_char(name), sizeof(name) - 1);
channelInfo.affiliateCallSign = CharSpan(affiliateCallSign, sizeof(affiliateCallSign) - 1);
channelInfo.callSign = CharSpan(callSign, sizeof(callSign) - 1);
channelInfo.name = CharSpan(name, sizeof(name) - 1);
channelInfo.majorNumber = static_cast<uint8_t>(1 + i);
channelInfo.minorNumber = static_cast<uint16_t>(2 + i);
ReturnErrorOnFailure(encoder.Encode(channelInfo));
Expand Down
5 changes: 5 additions & 0 deletions integrations/cloudbuild/smoke-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ steps:
/workspace/artifacts/
waitFor:
- Bootstrap
- ESP32
entrypoint: ./scripts/run_in_build_env.sh
volumes:
- name: pwenv
Expand All @@ -55,6 +56,7 @@ steps:
/workspace/artifacts/
waitFor:
- Bootstrap
- NRFConnect
entrypoint: ./scripts/run_in_build_env.sh
volumes:
- name: pwenv
Expand All @@ -71,12 +73,14 @@ steps:
/workspace/artifacts/
waitFor:
- Bootstrap
- EFR32
entrypoint: ./scripts/run_in_build_env.sh
volumes:
- name: pwenv
path: /pwenv

- name: "connectedhomeip/chip-build-vscode:0.5.18"
id: Android
env:
- PW_ENVIRONMENT_ROOT=/pwenv
args:
Expand All @@ -86,6 +90,7 @@ steps:
--create-archives /workspace/artifacts/
waitFor:
- Bootstrap
- Linux
entrypoint: ./scripts/run_in_build_env.sh
volumes:
- name: pwenv
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
import sys
import subprocess
import logging
import time
import click
from pathlib import Path
from dataclasses import dataclass
from enum import Enum
from multiprocessing.connection import Listener, Client
Expand Down Expand Up @@ -73,6 +75,7 @@ def __call__(self):


SERVER_ADDRESS = "/tmp/cirque-helper.socket"
CLIENT_WAIT_TIMEOUT_SECONDS = 5


def CommandFactory(args):
Expand Down Expand Up @@ -105,6 +108,13 @@ def ServerMain(args):
def ClientMain(args):
if len(args) == 0:
sys.exit(1)
# The server may start very slowly, wait for a few seconds to see if the server will start.
for _ in range(CLIENT_WAIT_TIMEOUT_SECONDS):
socks = Path(SERVER_ADDRESS)
if socks.exists():
break
time.sleep(1)
# If the address does not exist, Client constructor will throw an exception, so no need to add a flag.
with Client(SERVER_ADDRESS) as conn:
conn.send(args)
res = conn.recv()
Expand Down
7 changes: 1 addition & 6 deletions scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,7 @@ def AndroidTargets():
yield target.Extend('x64-chip-tool', board=AndroidBoard.X64, app=AndroidApp.CHIP_TOOL)
yield target.Extend('x86-chip-tool', board=AndroidBoard.X86, app=AndroidApp.CHIP_TOOL)
yield target.Extend('arm64-chip-test', board=AndroidBoard.ARM64, app=AndroidApp.CHIP_TEST)
# TODO: android studio build is broken:
# - When compile succeeds, build artifact copy fails with "No such file or
# directory: '<out_prefix>/android-androidstudio-chip-tool/outputs/apk/debug/app-debug.apk'
# - Compiling locally in the vscode image fails with
# "2 files found with path 'lib/armeabi-v7a/libCHIPController.so'"
# yield target.Extend('androidstudio-chip-tool', board=AndroidBoard.AndroidStudio, app=AndroidApp.CHIP_TOOL)
yield target.Extend('androidstudio-chip-tool', board=AndroidBoard.AndroidStudio, app=AndroidApp.CHIP_TOOL)


ALL = []
Expand Down
16 changes: 10 additions & 6 deletions scripts/build/builders/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,11 @@ def _build(self):
title='Building APP ' + self.identifier)

def build_outputs(self):
outputs = {
self.app.AppName() + '-debug.apk':
if not self.board.IsIde():
outputs = {
self.app.AppName() + 'app-debug.apk':
os.path.join(self.output_dir, 'outputs', 'apk', 'debug',
'app-debug.apk'),
}
if not self.board.IsIde():
outputs.update({
'CHIPController.jar':
os.path.join(self.output_dir, 'lib',
'src/controller/java/CHIPController.jar'),
Expand All @@ -243,6 +241,12 @@ def build_outputs(self):
'jni/%s/libc++_shared.so' % self.board.AbiName():
os.path.join(self.output_dir, 'lib', 'jni',
self.board.AbiName(), 'libc++_shared.so'),
})
}
else:
outputs = {
self.app.AppName() + '-debug.apk':
os.path.join(self.root, "src/android", self.app.AppName(),
'app/build/outputs/apk/debug/app-debug.apk')
}

return outputs
1 change: 1 addition & 0 deletions scripts/build/testdata/all_targets_except_host.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ameba-amebad-all-clusters
android-androidstudio-chip-tool
android-arm-chip-tool
android-arm64-chip-test
android-arm64-chip-tool
Expand Down
15 changes: 15 additions & 0 deletions scripts/build/testdata/build_all_except_host.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ python3 build/chip/java/tests/generate_jars_for_test.py
# Setting up Android deps through Gradle
python3 third_party/android_deps/set_up_android_deps.py

# Generating android-androidstudio-chip-tool
gn gen --check --fail-on-unused-args {out}/android-androidstudio-chip-tool '--args=target_os="android" target_cpu="arm64" android_ndk_root="TEST_ANDROID_NDK_HOME" android_sdk_root="TEST_ANDROID_HOME" chip_use_clusters_for_ip_commissioning="true"' --ide=json --json-ide-script=//scripts/examples/gn_to_cmakelists.py

# Accepting NDK licenses
bash -c 'yes | TEST_ANDROID_HOME/tools/bin/sdkmanager --licenses >/dev/null'

# Generating JARs for Java build rules test
python3 build/chip/java/tests/generate_jars_for_test.py

# Setting up Android deps through Gradle
python3 third_party/android_deps/set_up_android_deps.py

# Generating android-arm-chip-tool
gn gen --check --fail-on-unused-args {out}/android-arm-chip-tool '--args=target_os="android" target_cpu="arm" android_ndk_root="TEST_ANDROID_NDK_HOME" android_sdk_root="TEST_ANDROID_HOME" chip_use_clusters_for_ip_commissioning="true"'

Expand Down Expand Up @@ -248,6 +260,9 @@ gn gen --check --fail-on-unused-args --root={root}/examples/lighting-app/linux '
# Building ameba-amebad-all-clusters
ninja -C {out}/ameba-amebad-all-clusters

# Building APP android-androidstudio-chip-tool
{root}/src/android/CHIPTool/gradlew -p {root}/src/android/CHIPTool -PmatterBuildSrcDir={out}/android-androidstudio-chip-tool -PmatterSdkSourceBuild=true assembleDebug

# Building JNI android-arm-chip-tool
ninja -C {out}/android-arm-chip-tool

Expand Down
6 changes: 3 additions & 3 deletions src/app/ConcreteAttributePath.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ struct ConcreteAttributePath
return mEndpointId == other.mEndpointId && mClusterId == other.mClusterId && mAttributeId == other.mAttributeId;
}

const EndpointId mEndpointId = 0;
const ClusterId mClusterId = 0;
const AttributeId mAttributeId = 0;
EndpointId mEndpointId = 0;
ClusterId mClusterId = 0;
AttributeId mAttributeId = 0;
};
} // namespace app
} // namespace chip
6 changes: 3 additions & 3 deletions src/app/ConcreteCommandPath.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ struct ConcreteCommandPath
return mEndpointId == other.mEndpointId && mClusterId == other.mClusterId && mCommandId == other.mCommandId;
}

const EndpointId mEndpointId = 0;
const ClusterId mClusterId = 0;
const CommandId mCommandId = 0;
EndpointId mEndpointId = 0;
ClusterId mClusterId = 0;
CommandId mCommandId = 0;
};
} // namespace app
} // namespace chip
Loading

0 comments on commit 607c4d8

Please sign in to comment.