Skip to content

Commit

Permalink
[IM] Fix interaction model build & Enable IM build for Linux presubmit (
Browse files Browse the repository at this point in the history
#5725)

* [im] Fix build

* Rename to CHIP_ENABLE_INTERACTION_MODEL

* Run codegen

* Enable build on Linux

* Restyled by gn

* Fix typo

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
erjiaqing and restyled-commits authored Apr 1, 2021
1 parent 19b5417 commit ebc41b5
Show file tree
Hide file tree
Showing 14 changed files with 126 additions and 135 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

strategy:
matrix:
type: [gcc_debug, gcc_release, clang, mbedtls]
type: [gcc_debug, gcc_release, clang, mbedtls, clang_experimental]
env:
BUILD_TYPE: ${{ matrix.type }}
BUILD_IMAGE: chip-build-openssl
Expand Down Expand Up @@ -60,6 +60,7 @@ jobs:
"gcc_release") GN_ARGS='is_debug=false';;
"clang") GN_ARGS='is_clang=true';;
"mbedtls") GN_ARGS='chip_crypto="mbedtls"';;
"clang_experimental") GN_ARGS='is_clang=true chip_enable_interaction_model=true';;
*) ;;
esac
Expand Down
30 changes: 15 additions & 15 deletions examples/all-clusters-app/all-clusters-common/gen/endpoint_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,11 @@
{ 0x0009, ZAP_TYPE(INT32U), 4, ZAP_ATTRIBUTE_MASK(SINGLETON), \
ZAP_LONG_DEFAULTS_INDEX(176) }, /* Basic (server): SoftwareVersion */ \
{ 0x000A, ZAP_TYPE(CHAR_STRING), 64, ZAP_ATTRIBUTE_MASK(SINGLETON), \
ZAP_LONG_DEFAULTS_INDEX(180) }, /* Basic (server): SoftwareVersionString */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* General Commissioning (server): cluster revision */ \
ZAP_LONG_DEFAULTS_INDEX(180) }, /* Basic (server): SoftwareVersionString */ \
{ 0x0000, ZAP_TYPE(OCTET_STRING), 8, 0, ZAP_LONG_DEFAULTS_INDEX(244) }, /* General Commissioning (server): FabricId */ \
{ 0x0001, ZAP_TYPE(INT64U), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), \
ZAP_LONG_DEFAULTS_INDEX(252) }, /* General Commissioning (server): Breadcrumb */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* General Commissioning (server): cluster revision */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Network Commissioning (server): cluster revision */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(3) }, /* Door Lock (server): cluster revision */ \
{ 0x0000, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(2) }, /* Door Lock (server): lock state */ \
Expand Down Expand Up @@ -450,25 +450,25 @@
{ 0x0001, ZAP_TYPE(ENUM16), 2, 0, ZAP_EMPTY_DEFAULT() }, /* IAS Zone (server): zone type */ \
{ 0x0002, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* IAS Zone (server): zone status */ \
{ 0x0010, ZAP_TYPE(IEEE_ADDRESS), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), \
ZAP_LONG_DEFAULTS_INDEX(514) }, /* IAS Zone (server): IAS CIE address */ \
{ 0x0011, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0xff) }, /* IAS Zone (server): Zone ID */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Low Power (server): cluster revision */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Application Basic (server): cluster revision */ \
ZAP_LONG_DEFAULTS_INDEX(514) }, /* IAS Zone (server): IAS CIE address */ \
{ 0x0011, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0xff) }, /* IAS Zone (server): Zone ID */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Low Power (server): cluster revision */ \
{ 0x0000, ZAP_TYPE(OCTET_STRING), 32, 0, ZAP_LONG_DEFAULTS_INDEX(522) }, /* Application Basic (server): vendor name */ \
{ 0x0001, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Application Basic (server): vendor id */ \
{ 0x0002, ZAP_TYPE(OCTET_STRING), 32, 0, \
ZAP_LONG_DEFAULTS_INDEX(554) }, /* Application Basic (server): application name */ \
{ 0x0003, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Application Basic (server): product id */ \
ZAP_LONG_DEFAULTS_INDEX(554) }, /* Application Basic (server): application name */ \
{ 0x0003, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Application Basic (server): product id */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Application Basic (server): cluster revision */ \
{ 0x0005, ZAP_TYPE(OCTET_STRING), 32, 0, \
ZAP_LONG_DEFAULTS_INDEX(586) }, /* Application Basic (server): application id */ \
{ 0x0006, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Application Basic (server): catalog vendor id */ \
{ 0x0007, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* Application Basic (server): application satus */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Binding (server): cluster revision */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Group Key Management (server): cluster revision */ \
ZAP_LONG_DEFAULTS_INDEX(586) }, /* Application Basic (server): application id */ \
{ 0x0006, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Application Basic (server): catalog vendor id */ \
{ 0x0007, ZAP_TYPE(ENUM8), 1, 0, ZAP_SIMPLE_DEFAULT(0x01) }, /* Application Basic (server): application satus */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Binding (server): cluster revision */ \
{ 0x0000, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(618) }, /* Group Key Management (server): groups */ \
{ 0x0001, ZAP_TYPE(ARRAY), 254, 0, ZAP_LONG_DEFAULTS_INDEX(872) }, /* Group Key Management (server): group keys */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* On/off (server): cluster revision */ \
{ 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* On/off (server): on/off */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Group Key Management (server): cluster revision */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(2) }, /* On/off (server): cluster revision */ \
{ 0x0000, ZAP_TYPE(BOOLEAN), 1, 0, ZAP_SIMPLE_DEFAULT(0x00) }, /* On/off (server): on/off */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), \
ZAP_SIMPLE_DEFAULT(3) }, /* Basic (server): cluster revision */ \
{ 0x0000, ZAP_TYPE(INT16U), 2, ZAP_ATTRIBUTE_MASK(SINGLETON), \
Expand Down
2 changes: 1 addition & 1 deletion examples/lighting-app/lighting-common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ source_set("lighting-common") {
"gen/callback-stub.cpp",
]

if (chip_app_use_interaction_model) {
if (chip_enable_interaction_model) {
sources += [
"${chip_root}/src/app/util/ember-compatibility-functions.cpp",
"gen/IMClusterCommandHandler.cpp",
Expand Down
12 changes: 6 additions & 6 deletions examples/tv-app/tv-common/gen/endpoint_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,15 @@
{ 0x0001, ZAP_TYPE(ENUM16), 2, 0, ZAP_EMPTY_DEFAULT() }, /* IAS Zone (server): zone type */ \
{ 0x0002, ZAP_TYPE(BITMAP16), 2, 0, ZAP_SIMPLE_DEFAULT(0x0000) }, /* IAS Zone (server): zone status */ \
{ 0x0010, ZAP_TYPE(IEEE_ADDRESS), 8, ZAP_ATTRIBUTE_MASK(WRITABLE), \
ZAP_LONG_DEFAULTS_INDEX(498) }, /* IAS Zone (server): IAS CIE address */ \
{ 0x0011, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0xff) }, /* IAS Zone (server): Zone ID */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Low Power (server): cluster revision */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Application Basic (server): cluster revision */ \
ZAP_LONG_DEFAULTS_INDEX(498) }, /* IAS Zone (server): IAS CIE address */ \
{ 0x0011, ZAP_TYPE(INT8U), 1, 0, ZAP_SIMPLE_DEFAULT(0xff) }, /* IAS Zone (server): Zone ID */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Low Power (server): cluster revision */ \
{ 0x0000, ZAP_TYPE(OCTET_STRING), 32, 0, ZAP_LONG_DEFAULTS_INDEX(506) }, /* Application Basic (server): vendor name */ \
{ 0x0001, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Application Basic (server): vendor id */ \
{ 0x0002, ZAP_TYPE(OCTET_STRING), 32, 0, \
ZAP_LONG_DEFAULTS_INDEX(538) }, /* Application Basic (server): application name */ \
{ 0x0003, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Application Basic (server): product id */ \
ZAP_LONG_DEFAULTS_INDEX(538) }, /* Application Basic (server): application name */ \
{ 0x0003, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Application Basic (server): product id */ \
{ 0xFFFD, ZAP_TYPE(INT16U), 2, 0, ZAP_SIMPLE_DEFAULT(0x0001) }, /* Application Basic (server): cluster revision */ \
{ 0x0005, ZAP_TYPE(OCTET_STRING), 32, 0, \
ZAP_LONG_DEFAULTS_INDEX(570) }, /* Application Basic (server): application id */ \
{ 0x0006, ZAP_TYPE(INT16U), 2, 0, ZAP_EMPTY_DEFAULT() }, /* Application Basic (server): catalog vendor id */ \
Expand Down
1 change: 0 additions & 1 deletion src/app/common_flags.gni
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,4 @@
declare_args() {
# Temporary flag for interaction model and echo protocols, set it to true to enable
chip_app_use_echo = false
chip_app_use_interaction_model = false
}
4 changes: 0 additions & 4 deletions src/app/server/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ import("${chip_root}/src/app/common_flags.gni")
config("server_config") {
defines = []

if (chip_app_use_interaction_model) {
defines += [ "CHIP_APP_USE_INTERACTION_MODEL" ]
}

if (chip_app_use_echo) {
defines += [ "CHIP_APP_USE_ECHO" ]
}
Expand Down
8 changes: 4 additions & 4 deletions src/app/server/Server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ class ServerCallback : public SecureSessionMgrDelegate
AppDelegate * mDelegate = nullptr;
};

#if defined(CHIP_APP_USE_INTERACTION_MODEL) || defined(CHIP_APP_USE_ECHO)
#if CHIP_ENABLE_INTERACTION_MODEL || defined(CHIP_APP_USE_ECHO)
Messaging::ExchangeManager gExchangeMgr;
#endif
ServerCallback gCallbacks;
Expand Down Expand Up @@ -482,15 +482,15 @@ void InitServer(AppDelegate * delegate)
err = gSessions.Init(chip::kTestDeviceNodeId, &DeviceLayer::SystemLayer, &gTransports, &gAdminPairings);
SuccessOrExit(err);

#if defined(CHIP_APP_USE_INTERACTION_MODEL) || defined(CHIP_APP_USE_ECHO)
#if CHIP_ENABLE_INTERACTION_MODEL || defined(CHIP_APP_USE_ECHO)
err = gExchangeMgr.Init(&gSessions);
SuccessOrExit(err);
#else
gSessions.SetDelegate(&gCallbacks);
#endif

#if defined(CHIP_APP_USE_INTERACTION_MODEL)
err = chip::app::InteractionModelEngine::GetInstance()->Init(&gExchangeMgr);
#if CHIP_ENABLE_INTERACTION_MODEL
err = chip::app::InteractionModelEngine::GetInstance()->Init(&gExchangeMgr, nullptr);
SuccessOrExit(err);
#endif

Expand Down
6 changes: 1 addition & 5 deletions src/app/zap-templates/templates/chip/CHIPClusters-src.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Controller {
{{#chip_server_cluster_commands}}
CHIP_ERROR {{asCamelCased clusterName false}}Cluster::{{asCamelCased name false}}(Callback::Cancelable * onSuccessCallback, Callback::Cancelable * onFailureCallback{{#chip_server_cluster_command_arguments}}, {{chipType}} {{asCamelCased label}}{{/chip_server_cluster_command_arguments}})
{
#ifdef CHIP_APP_USE_INTERACTION_MODEL
#if CHIP_ENABLE_INTERACTION_MODEL
VerifyOrReturnError(mDevice != nullptr, CHIP_ERROR_INCORRECT_STATE);
(void) onSuccessCallback;
(void) onFailureCallback;
Expand All @@ -38,11 +38,7 @@ CHIP_ERROR {{asCamelCased clusterName false}}Cluster::{{asCamelCased name false}
uint8_t argSeqNumber = 0;
{{/first}}
// {{asCamelCased label}}: {{asCamelCased type}}
{{#if (isCharString type)}}
ReturnErrorOnFailure(writer.PutString(TLV::ContextTag(argSeqNumber++), {{asCamelCased label}}));
{{else}}
ReturnErrorOnFailure(writer.Put(TLV::ContextTag(argSeqNumber++), {{asCamelCased label}}));
{{/if}}
{{else}}
// Command takes no arguments.
{{/chip_server_cluster_command_arguments}}
Expand Down
5 changes: 0 additions & 5 deletions src/controller/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
# limitations under the License.

import("//build_overrides/chip.gni")
import("${chip_root}/src/app/common_flags.gni")

static_library("controller") {
output_name = "libChipController"
Expand Down Expand Up @@ -47,8 +46,4 @@ static_library("controller") {
]

defines = []

if (chip_app_use_interaction_model) {
defines += [ "CHIP_APP_USE_INTERACTION_MODEL" ]
}
}
Loading

0 comments on commit ebc41b5

Please sign in to comment.