Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into add-dem-example-code-for-1-4
Browse files Browse the repository at this point in the history
PeterC1965 authored Jul 25, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 07ed1fa + ba949bf commit eecd532
Showing 14 changed files with 378 additions and 180 deletions.
2 changes: 1 addition & 1 deletion integrations/docker/images/base/chip-build/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
65 : [nrfconnect] Update nRF Connect SDK version.
66 : [Telink] Update Docker image (Zephyr update)
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@ RUN set -x \
&& : # last line

# Setup Zephyr
ARG ZEPHYR_REVISION=ab81a585fca6a83b30e1f4e58a021113d6a3acb8
ARG ZEPHYR_REVISION=ef7bfc2214602ecf237332b71e6a2bdd69205fbd
WORKDIR /opt/telink/zephyrproject
RUN set -x \
&& python3 -m pip install --break-system-packages -U --no-cache-dir west \
Original file line number Diff line number Diff line change
@@ -307,7 +307,7 @@
{ (uint16_t) 0xBB8, (uint16_t) -0x6AB3, (uint16_t) 0x7FFF }, /* MaxHeatSetpointLimit */ \
{ (uint16_t) 0x640, (uint16_t) -0x6AB3, (uint16_t) 0x7FFF }, /* MinCoolSetpointLimit */ \
{ (uint16_t) 0xC80, (uint16_t) -0x6AB3, (uint16_t) 0x7FFF }, /* MaxCoolSetpointLimit */ \
{ (uint16_t) 0x19, (uint16_t) 0x0, (uint16_t) 0x7F }, /* MinSetpointDeadBand */ \
{ (uint16_t) 0x19, (uint16_t) 0x0, (uint16_t) 0x19 }, /* MinSetpointDeadBand */ \
{ (uint16_t) 0x4, (uint16_t) 0x0, (uint16_t) 0x5 }, /* ControlSequenceOfOperation */ \
{ (uint16_t) 0x1, (uint16_t) 0x0, (uint16_t) 0x9 }, /* SystemMode */ \
\
22 changes: 21 additions & 1 deletion src/app/ReadClient.cpp
Original file line number Diff line number Diff line change
@@ -403,6 +403,11 @@ CHIP_ERROR ReadClient::BuildDataVersionFilterList(DataVersionFilterIBs::Builder
const Span<DataVersionFilter> & aDataVersionFilters,
bool & aEncodedDataVersionList)
{
#if CHIP_PROGRESS_LOGGING
size_t encodedFilterCount = 0;
size_t irrelevantFilterCount = 0;
size_t skippedFilterCount = 0;
#endif
for (auto & filter : aDataVersionFilters)
{
VerifyOrReturnError(filter.IsValidDataVersionFilter(), CHIP_ERROR_INVALID_ARGUMENT);
@@ -420,6 +425,9 @@ CHIP_ERROR ReadClient::BuildDataVersionFilterList(DataVersionFilterIBs::Builder

if (!intersected)
{
#if CHIP_PROGRESS_LOGGING
++irrelevantFilterCount;
#endif
continue;
}

@@ -428,19 +436,31 @@ CHIP_ERROR ReadClient::BuildDataVersionFilterList(DataVersionFilterIBs::Builder
CHIP_ERROR err = EncodeDataVersionFilter(aDataVersionFilterIBsBuilder, filter);
if (err == CHIP_NO_ERROR)
{
#if CHIP_PROGRESS_LOGGING
++encodedFilterCount;
#endif
aEncodedDataVersionList = true;
}
else if (err == CHIP_ERROR_NO_MEMORY || err == CHIP_ERROR_BUFFER_TOO_SMALL)
{
// Packet is full, ignore the rest of the list
aDataVersionFilterIBsBuilder.Rollback(backup);
return CHIP_NO_ERROR;
#if CHIP_PROGRESS_LOGGING
ssize_t nonSkippedFilterCount = &filter - aDataVersionFilters.data();
skippedFilterCount = aDataVersionFilters.size() - static_cast<size_t>(nonSkippedFilterCount);
#endif // CHIP_PROGRESS_LOGGING
break;
}
else
{
return err;
}
}

ChipLogProgress(DataManagement,
"%lu data version filters provided, %lu not relevant, %lu encoded, %lu skipped due to lack of space",
static_cast<unsigned long>(aDataVersionFilters.size()), static_cast<unsigned long>(irrelevantFilterCount),
static_cast<unsigned long>(encodedFilterCount), static_cast<unsigned long>(skippedFilterCount));
return CHIP_NO_ERROR;
}

1 change: 1 addition & 0 deletions src/app/chip_data_model.gni
Original file line number Diff line number Diff line change
@@ -420,6 +420,7 @@ template("chip_data_model") {
":${_data_model_name}_zapgen",
"${chip_root}/src/access",
"${chip_root}/src/app",
"${chip_root}/src/app/cluster-building-blocks",
"${chip_root}/src/app/common:attribute-type",
"${chip_root}/src/app/common:cluster-objects",
"${chip_root}/src/app/common:enums",
198 changes: 129 additions & 69 deletions src/app/clusters/level-control/level-control.cpp

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/app/clusters/thermostat-server/thermostat-server.cpp
Original file line number Diff line number Diff line change
@@ -409,7 +409,7 @@ MatterThermostatClusterServerPreAttributeChangedCallback(const app::ConcreteAttr
requested = *value;
if (!AutoSupported)
return imcode::UnsupportedAttribute;
if (requested < 0 || requested > 127)
if (requested < 0 || requested > 25)
return imcode::InvalidValue;
return imcode::Success;
}
6 changes: 3 additions & 3 deletions src/app/tests/suites/certification/Test_TC_TSTAT_2_1.yaml
Original file line number Diff line number Diff line change
@@ -243,8 +243,8 @@ tests:
response:
constraints:
type: int8s
minValue: -127
maxValue: 127
minValue: -25
maxValue: 25

- label: "Step 13a: TH reads attribute OccupiedCoolingSetpoint from the DUT"
PICS: TSTAT.S.F01 && TSTAT.S.A0017 && TSTAT.S.A0018
@@ -426,7 +426,7 @@ tests:
constraints:
type: int8s
minValue: 0
maxValue: 127
maxValue: 25

- label: "Step 22: TH reads the RemoteSensing attribute from the DUT"
PICS: TSTAT.S.A001a
21 changes: 21 additions & 0 deletions src/app/zap-templates/zcl/data-model/chip/global-structs.xml
Original file line number Diff line number Diff line change
@@ -31,4 +31,25 @@ TODO: Make these structures global rather than defining them for each cluster.
<item fieldId="1" name="FloorNumber" type="int16s" isNullable="true" optional="false"/>
<item fieldId="2" name="AreaType" type="AreaTypeTag" isNullable="true" optional="false"/>
</struct>

<!--
These are test global items (no cluster attached) for testing only.
Their usage is defined for UnitTestCluster only.
-->
<bitmap name="TestGlobalBitmap" type="bitmap32">
<field mask="0x01" name="FirstBit" />
<field mask="0x02" name="SecondBit" />
</bitmap>

<enum name="TestGlobalEnum" type="enum8">
<item name="SomeValue" value="0x00"/>
<item name="SomeOtherValue" value="0x01"/>
<item name="FinalValue" value="0x02"/>
</enum>

<struct name="TestGlobalStruct">
<item fieldId="0" name="Name" type="char_string" length="128" isNullable="false" optional="false"/>
<item fieldId="1" name="MyBitmap" type="TestGlobalBitmap" isNullable="true" optional="false"/>
<item fieldId="2" name="MyEnum" type="TestGlobalEnum" isNullable="true" optional="true"/>
</struct>
</configurator>
Original file line number Diff line number Diff line change
@@ -337,7 +337,7 @@ limitations under the License.
<access op="read" privilege="view"/>
<access op="write" privilege="manage"/>
</attribute>
<attribute side="server" code="0x0010" define="LOCAL_TEMPERATURE_CALIBRATION" type="int8s" min="-127" max="127" writable="true" default="0x00" optional="true">
<attribute side="server" code="0x0010" define="LOCAL_TEMPERATURE_CALIBRATION" type="int8s" min="0xE7" max="0x19" writable="true" default="0x00" optional="true">
<description>LocalTemperatureCalibration</description>
<access op="write" privilege="manage"/>
</attribute>
@@ -361,7 +361,7 @@ limitations under the License.
<description>MaxCoolSetpointLimit</description>
<access op="write" privilege="manage"/>
</attribute>
<attribute side="server" code="0x0019" define="MIN_SETPOINT_DEAD_BAND" type="int8s" min="0" max="127" writable="true" default="25" optional="true">
<attribute side="server" code="0x0019" define="MIN_SETPOINT_DEAD_BAND" type="int8s" min="0" max="25" writable="true" default="25" optional="true">
<description>MinSetpointDeadBand</description>
<access op="write" privilege="manage"/>
</attribute>
61 changes: 58 additions & 3 deletions src/controller/python/ChipDeviceController-ScriptBinding.cpp
Original file line number Diff line number Diff line change
@@ -213,7 +213,8 @@ PyChipError pychip_DeviceCommissioner_CloseBleConnection(chip::Controller::Devic
const char * pychip_Stack_StatusReportToString(uint32_t profileId, uint16_t statusCode);

PyChipError pychip_GetConnectedDeviceByNodeId(chip::Controller::DeviceCommissioner * devCtrl, chip::NodeId nodeId,
chip::Controller::Python::PyObject * context, DeviceAvailableFunc callback);
chip::Controller::Python::PyObject * context, DeviceAvailableFunc callback,
int transportPayloadCapability);
PyChipError pychip_FreeOperationalDeviceProxy(chip::OperationalDeviceProxy * deviceProxy);
PyChipError pychip_GetLocalSessionId(chip::OperationalDeviceProxy * deviceProxy, uint16_t * localSessionId);
PyChipError pychip_GetNumSessionsToPeer(chip::OperationalDeviceProxy * deviceProxy, uint32_t * numSessions);
@@ -239,6 +240,13 @@ void pychip_Storage_ShutdownAdapter(chip::Controller::Python::StorageAdapter * s
// ICD
//
void pychip_CheckInDelegate_SetOnCheckInCompleteCallback(PyChipCheckInDelegate::OnCheckInCompleteCallback * callback);

//
// LargePayload and TCP
PyChipError pychip_SessionAllowsLargePayload(chip::OperationalDeviceProxy * deviceProxy, bool * allowsLargePayload);
PyChipError pychip_IsSessionOverTCPConnection(chip::OperationalDeviceProxy * deviceProxy, bool * isSessionOverTCP);
PyChipError pychip_IsActiveSession(chip::OperationalDeviceProxy * deviceProxy, bool * isActiveSession);
PyChipError pychip_CloseTCPConnectionWithPeer(chip::OperationalDeviceProxy * deviceProxy);
}

void * pychip_Storage_InitializeStorageAdapter(chip::Controller::Python::PyObject * context,
@@ -807,11 +815,58 @@ struct GetDeviceCallbacks
} // anonymous namespace

PyChipError pychip_GetConnectedDeviceByNodeId(chip::Controller::DeviceCommissioner * devCtrl, chip::NodeId nodeId,
chip::Controller::Python::PyObject * context, DeviceAvailableFunc callback)
chip::Controller::Python::PyObject * context, DeviceAvailableFunc callback,
int transportPayloadCapability)
{
VerifyOrReturnError(devCtrl != nullptr, ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT));
auto * callbacks = new GetDeviceCallbacks(context, callback);
return ToPyChipError(devCtrl->GetConnectedDevice(nodeId, &callbacks->mOnSuccess, &callbacks->mOnFailure));
return ToPyChipError(devCtrl->GetConnectedDevice(nodeId, &callbacks->mOnSuccess, &callbacks->mOnFailure,
static_cast<chip::TransportPayloadCapability>(transportPayloadCapability)));
}

PyChipError pychip_SessionAllowsLargePayload(chip::OperationalDeviceProxy * deviceProxy, bool * allowsLargePayload)
{
VerifyOrReturnError(deviceProxy->GetSecureSession().HasValue(), ToPyChipError(CHIP_ERROR_MISSING_SECURE_SESSION));
VerifyOrReturnError(allowsLargePayload != nullptr, ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT));

*allowsLargePayload = deviceProxy->GetSecureSession().Value()->AsSecureSession()->AllowsLargePayload();

return ToPyChipError(CHIP_NO_ERROR);
}

PyChipError pychip_IsSessionOverTCPConnection(chip::OperationalDeviceProxy * deviceProxy, bool * isSessionOverTCP)
{
VerifyOrReturnError(deviceProxy->GetSecureSession().HasValue(), ToPyChipError(CHIP_ERROR_MISSING_SECURE_SESSION));
VerifyOrReturnError(isSessionOverTCP != nullptr, ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT));

*isSessionOverTCP = deviceProxy->GetSecureSession().Value()->AsSecureSession()->GetTCPConnection() != nullptr;

return ToPyChipError(CHIP_NO_ERROR);
}

PyChipError pychip_IsActiveSession(chip::OperationalDeviceProxy * deviceProxy, bool * isActiveSession)
{
VerifyOrReturnError(isActiveSession != nullptr, ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT));

*isActiveSession = false;
if (deviceProxy->GetSecureSession().HasValue())
{
*isActiveSession = deviceProxy->GetSecureSession().Value()->AsSecureSession()->IsActiveSession();
}

return ToPyChipError(CHIP_NO_ERROR);
}

PyChipError pychip_CloseTCPConnectionWithPeer(chip::OperationalDeviceProxy * deviceProxy)
{
VerifyOrReturnError(deviceProxy->GetSecureSession().HasValue(), ToPyChipError(CHIP_ERROR_MISSING_SECURE_SESSION));
VerifyOrReturnError(deviceProxy->GetSecureSession().Value()->AsSecureSession()->AllowsLargePayload(),
ToPyChipError(CHIP_ERROR_INVALID_ARGUMENT));

deviceProxy->GetExchangeManager()->GetSessionManager()->TCPDisconnect(
deviceProxy->GetSecureSession().Value()->AsSecureSession()->GetTCPConnection(), /* shouldAbort = */ false);

return ToPyChipError(CHIP_NO_ERROR);
}

PyChipError pychip_FreeOperationalDeviceProxy(chip::OperationalDeviceProxy * deviceProxy)
Loading

0 comments on commit eecd532

Please sign in to comment.