Skip to content

Commit

Permalink
TBD Apple extension code
Browse files Browse the repository at this point in the history
  • Loading branch information
suveshpratapa committed Oct 15, 2024
1 parent 85d86bd commit fdc8a0b
Show file tree
Hide file tree
Showing 31 changed files with 1,825 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/lock-app/silabs/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ silabs_executable("lock_app") {
deps = [
":sdk",
app_data_model,
"third_party/apple-matter-extensions"
]

if (wifi_soc) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Copyright (c) 2023 Apple Inc. All rights reserved.
#
# Apple Matter Extensions is licensed under Apple Inc.'s MFi Sample Code
# License Agreement, which is contained in the LICENSE file distributed with
# the Apple Matter Extensions, and only to those who accept that license.

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

source_set("apple-matter-extensions") {
sources = [
"lib/src/support/TLV8.cpp",
]

cflags = [ "-Wconversion" ]
deps = [ "${chip_root}/src/lib" ]

public_configs = [ ":config" ]
}

config("config") {
include_dirs = [ "lib/include" ]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
Apple Inc.
Apple Matter Extensions
MFi Sample Code License Agreement

IMPORTANT: This Apple software is supplied to you, by Apple Inc. ("Apple"), in your capacity as a
current, and in good standing, Licensee in the MFi Licensing Program. Use of this Apple software is
governed by and subject to the terms and conditions of your MFi License, the Master Prototype
License and Confidentiality Agreement, and Project Fell exhibit ("MFi Agreements"), including, but
not limited to, the restrictions specified in the MFi License provision entitled "Public Software",
and is further subject to your agreement to the following additional terms, and your agreement that
the use, installation, modification or redistribution of this Apple software constitutes acceptance
of these additional terms. If you do not agree with these additional terms, you may not use,
install, modify or redistribute this Apple software.

Subject to all of these terms and in consideration of your agreement to abide by them, Apple grants
you, for as long as you are a current and in good-standing MFi Licensee, a personal, non-exclusive
license, under Apple's copyrights in this Apple software (the "Apple Software"), to use, reproduce,
and modify the Apple Software in source form, and to use, reproduce, modify, and redistribute the
Apple Software, with or without modifications, in binary form, in each of the foregoing cases to
the extent necessary to develop and/or manufacture "Proposed Products" and "Licensed Products" in
accordance with the terms of your MFi Agreements. While you may not redistribute the Apple Software
in source form, should you redistribute the Apple Software in binary form, you must retain this
notice and the following text and disclaimers in all such redistributions of the Apple Software.
Neither the name, trademarks, service marks, or logos of Apple Inc. may be used to endorse or
promote products derived from the Apple Software without specific prior written permission from
Apple. Except as expressly stated in this notice, no other rights or licenses, express or implied,
are granted by Apple herein, including but not limited to any patent rights that may be infringed
by your derivative works or by other works in which the Apple Software may be incorporated. Apple
may terminate this license to the Apple Software by removing it from the list of Licensed
Technology in the MFi License, or otherwise in accordance with the terms of the MFi Agreements.

Unless you explicitly state otherwise, if you provide any ideas, suggestions, recommendations, bug
fixes or enhancements to Apple in connection with this software ("Feedback"), you hereby grant to
Apple a non-exclusive, fully paid-up, perpetual, irrevocable, worldwide license to make, use,
reproduce, incorporate, modify, display, perform, sell, make or have made derivative works of,
distribute (directly or indirectly) and sublicense, such Feedback in connection with Apple products
and services. Providing this Feedback is voluntary, but if you do provide Feedback to Apple, you
acknowledge and agree that Apple may exercise the license granted above without the payment of
royalties or further consideration to Participant.

The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO WARRANTIES, EXPRESS OR
IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY
AND FITNESS FOR A PARTICULAR PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE
OR IN COMBINATION WITH YOUR PRODUCTS.

IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION
AND/OR DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF CONTRACT,
TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF APPLE HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

Copyright (c) 2023 Apple Inc. All Rights Reserved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Apple Matter Extensions

Copyright (c) 2023 Apple Inc. All Rights Reserved.

Apple Matter Extensions is licensed under Apple Inc.'s MFi Sample Code License Agreement, which is
contained in the [LICENSE](LICENSE) file distributed with the Apple Matter Extensions, and only to
those who accept that license.

## Overview

This repository contains a collection of Apple extensions to the Matter specification and SDK.
Some of these are code examples that need to be copied into an application project manually,
while other functionality can be used simply by adding this repository as a third-party dependency.

## Using apple-matter-extensions as a dependency

Follow these steps to add an `apple-matter-extensions` dependency to your Matter SDK app project:

1. Locate the `third_party` directory. When building a standalone Matter app, this directory should
already exist and should contain a `connectedhomeip` symlink or sub-directory for the Matter SDK.
1. Add a `apple-matter-extensions` symlink to this repository to the `third_party` directory.
A git sub-module or a directory containing an unpacked archive of this repository work as well.
1. In the `BUILD.gn` file for your Matter app, add `"third_party/apple-matter-extensions"` to the
`deps` of your application target.
1. The include paths for your target are automatically set up so that Apple extension functionality
can be imported via the prefix `apple`
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Sample Code / Implementations

## Device Information

The [Apple Device Information](device-information/) cluster.
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Apple Device Information cluster

To add support for the Apple Device Information cluster in your
application using the [Matter
SDK](https://github.com/project-chip/connectedhomeip/), perform the
following steps while in the root of the Matter repository:

1. Place the [`apple-device-information-cluster.xml`](apple-device-information-cluster.xml) file in this directory at `src/app/zap-templates/zcl/data-model/apple/apple-device-information-cluster.xml`

2. Modify `src/app/zap-templates/zcl/zcl.json` to include the string `"./data-model/apple/"` in the `xmlRoot` array.

3. Modify `src/app/zap-templates/zcl/zcl.json` to include the string `"apple-device-information-cluster.xml"` in the `xmlFile` array.

4. Run `scripts/tools/zap/generate.py src/controller/data_model/controller-clusters.zap -t src/app/common/templates/templates.json -o zzz_generated/app-common/app-common/zap-generated` to generate the app-common files for the extension.

5. Modify `src/app/zap_cluster_list.json` to include `"APPLE_DEVICE_INFORMATION_CLUSTER": [ "apple-device-information-server" ]` in the `"ServerDirectories"` section.

6. Place the [`apple-device-information-server.cpp`](apple-device-information-server.cpp) file in this directory at `src/app/clusters/apple-device-information-server/apple-device-information-server.cpp`.

7. Run `scripts/tools/zap/run_zaptool.sh examples/lock-app/lock-common/lock-app.zap` (or whichever lock-app `.zap` file is being used) and:
1. Enable the server side of the "Apple Device Information" cluster on endpoint 0.
2. Enable the SupportsTapToUnlock attribute in that cluster.
3. Set the default value of that attribute to 1.

8. Run `scripts/tools/zap/generate.py examples/lock-app/lock-common/lock-app.zap` (or whichever lock-app `.zap` file is being used) to generate the files for the lock app.

9. Run the `gn gen` command to generate files.

10. Run the `ninja` command to compile the generated files from `gn`.

Steps 1 through 8 may be accomplished by running the
[`update-matter-repo.py`](update-matter-repo.py) script in this directory
while at the root of the Matter repository.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<!--
Copyright (c) 2023 Apple Inc. All rights reserved.
Apple Matter Extensions is licensed under Apple Inc.'s MFi Sample Code
License Agreement, which is contained in the LICENSE file distributed with
the Apple Matter Extensions, and only to those who accept that license.
-->
<configurator>
<domain name="CHIP"/>

<cluster>
<name>Apple Device Information</name>
<domain>CHIP</domain>
<code>0x1349FC00</code>
<define>APPLE_DEVICE_INFORMATION_CLUSTER</define>
<description>This cluster provides Apple-specific information about the device.</description>
<globalAttribute side="either" code="0xFFFD" value="1"/>

<!-- Whether this device supports tap to unlock. -->
<attribute side="server" code="0x0000" define="SUPPORTS_TAP_TO_UNLOCK" type="boolean" optional="true">SupportsTapToUnlock</attribute>
<attribute side="server" code="0x0001" define="SUPPORTS_WED" type="boolean" optional="true">SupportsWED</attribute>

</cluster>
</configurator>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright (c) 2023 Apple Inc. All rights reserved.
*
* Apple Matter Extensions is licensed under Apple Inc.'s MFi Sample Code
* License Agreement, which is contained in the LICENSE file distributed with
* the Apple Matter Extensions, and only to those who accept that license.
*/

void MatterAppleDeviceInformationPluginServerInitCallback()
{
}
Loading

0 comments on commit fdc8a0b

Please sign in to comment.