Skip to content

Commit

Permalink
Added Restyled changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jwinder-ca committed Jun 8, 2022
1 parent ad6e8fc commit 0bb582b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
2 changes: 1 addition & 1 deletion examples/bridge-app/linux/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ assert(chip_build_tools)

executable("chip-bridge-app") {
sources = [
"${chip_root}/examples/tv-app/tv-common/include/CHIPProjectAppConfig.h",
"${chip_root}/examples/bridge-app/linux/bridged-actions-stub.cpp",
"${chip_root}/examples/tv-app/tv-common/include/CHIPProjectAppConfig.h",
"Device.cpp",
"include/Device.h",
"main.cpp",
Expand Down
28 changes: 13 additions & 15 deletions examples/bridge-app/linux/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ constexpr CommandId onOffIncomingCommands[] = {
DECLARE_DYNAMIC_CLUSTER_LIST_BEGIN(bridgedLightClusters)
DECLARE_DYNAMIC_CLUSTER(ZCL_ON_OFF_CLUSTER_ID, onOffAttrs, onOffIncomingCommands, nullptr),
DECLARE_DYNAMIC_CLUSTER(ZCL_DESCRIPTOR_CLUSTER_ID, descriptorAttrs, nullptr, nullptr),
DECLARE_DYNAMIC_CLUSTER(ZCL_BRIDGED_DEVICE_BASIC_CLUSTER_ID, bridgedDeviceBasicAttrs, nullptr, nullptr)
DECLARE_DYNAMIC_CLUSTER_LIST_END;
DECLARE_DYNAMIC_CLUSTER(ZCL_BRIDGED_DEVICE_BASIC_CLUSTER_ID, bridgedDeviceBasicAttrs, nullptr,
nullptr) DECLARE_DYNAMIC_CLUSTER_LIST_END;

// Declare Bridged Light endpoint
DECLARE_DYNAMIC_ENDPOINT(bridgedLightEndpoint, bridgedLightClusters);
Expand All @@ -146,8 +146,8 @@ DeviceOnOff Light2("Light 2", "Office");
DeviceSwitch Switch1("Switch 1", "Office", EMBER_AF_SWITCH_FEATURE_LATCHING_SWITCH);
DeviceSwitch Switch2("Switch 2", "Office",
EMBER_AF_SWITCH_FEATURE_MOMENTARY_SWITCH | EMBER_AF_SWITCH_FEATURE_MOMENTARY_SWITCH_RELEASE |
EMBER_AF_SWITCH_FEATURE_MOMENTARY_SWITCH_LONG_PRESS |
EMBER_AF_SWITCH_FEATURE_MOMENTARY_SWITCH_MULTI_PRESS);
EMBER_AF_SWITCH_FEATURE_MOMENTARY_SWITCH_LONG_PRESS |
EMBER_AF_SWITCH_FEATURE_MOMENTARY_SWITCH_MULTI_PRESS);

// ---------------------------------------------------------------------------
//
Expand Down Expand Up @@ -182,8 +182,8 @@ DECLARE_DYNAMIC_ATTRIBUTE(ZCL_NODE_LABEL_ATTRIBUTE_ID, CHAR_STRING, kNodeLabelSi
DECLARE_DYNAMIC_CLUSTER_LIST_BEGIN(bridgedSwitchClusters)
DECLARE_DYNAMIC_CLUSTER(ZCL_SWITCH_CLUSTER_ID, switchAttrs, nullptr, nullptr),
DECLARE_DYNAMIC_CLUSTER(ZCL_DESCRIPTOR_CLUSTER_ID, switchDescriptorAttrs, nullptr, nullptr),
DECLARE_DYNAMIC_CLUSTER(ZCL_BRIDGED_DEVICE_BASIC_CLUSTER_ID, switchBridgedDeviceBasicAttrs, nullptr, nullptr)
DECLARE_DYNAMIC_CLUSTER_LIST_END;
DECLARE_DYNAMIC_CLUSTER(ZCL_BRIDGED_DEVICE_BASIC_CLUSTER_ID, switchBridgedDeviceBasicAttrs, nullptr,
nullptr) DECLARE_DYNAMIC_CLUSTER_LIST_END;

// Declare Bridged Switch endpoint
DECLARE_DYNAMIC_ENDPOINT(bridgedSwitchEndpoint, bridgedSwitchClusters);
Expand Down Expand Up @@ -595,7 +595,6 @@ const EmberAfDeviceType gComposedSwitchDeviceTypes[] = { { DEVICE_TYPE_LO_ON_OFF

const EmberAfDeviceType gComposedPowerSourceDeviceTypes[] = { { DEVICE_TYPE_POWER_SOURCE, DEVICE_VERSION_DEFAULT } };


#define POLL_INTERVAL_MS (100)
uint8_t poll_prescale = 0;

Expand Down Expand Up @@ -654,17 +653,16 @@ void * bridge_polling_thread(void * context)
Light2.Toggle();
}
}
continue;
continue;
}

// Sleep to avoid tight loop reading commands
// Sleep to avoid tight loop reading commands
usleep(POLL_INTERVAL_MS * 1000);
}

return NULL;
}


int main(int argc, char * argv[])
{
// Clear out the device database
Expand All @@ -674,17 +672,17 @@ int main(int argc, char * argv[])

Light1.SetChangeCallback(&HandleDeviceOnOffStatusChanged);
Light2.SetChangeCallback(&HandleDeviceOnOffStatusChanged);

Light1.SetReachable(true);
Light2.SetReachable(true);

Switch1.SetChangeCallback(&HandleDeviceSwitchStatusChanged);
Switch2.SetChangeCallback(&HandleDeviceSwitchStatusChanged);

Switch1.SetReachable(true);
Switch2.SetReachable(true);

// Define composed device with two switches
// Define composed device with two switches
ComposedDevice ComposedDevice("Composed Switcher", "Bedroom");
DeviceSwitch ComposedSwitch1("Composed Switch 1", "Bedroom", EMBER_AF_SWITCH_FEATURE_LATCHING_SWITCH);
DeviceSwitch ComposedSwitch2("Composed Switch 2", "Bedroom",
Expand Down Expand Up @@ -732,11 +730,11 @@ int main(int argc, char * argv[])
// Disable last fixed endpoint, which is used as a placeholder for all of the
// supported clusters so that ZAP will generated the requisite code.
emberAfEndpointEnableDisable(emberAfEndpointFromIndex(static_cast<uint16_t>(emberAfFixedEndpointCount() - 1)), false);

// Add light 1 -> will be mapped to ZCL endpoints 3
AddDeviceEndpoint(&Light1, &bridgedLightEndpoint, Span<const EmberAfDeviceType>(gBridgedOnOffDeviceTypes),
Span<DataVersion>(gLight1DataVersions), 1);

// Add switch 1..2 --> will be mapped to ZCL endpoints 4,5
AddDeviceEndpoint(&Switch1, &bridgedSwitchEndpoint, Span<const EmberAfDeviceType>(gBridgedSwitchDeviceTypes),
Span<DataVersion>(gSwitch1DataVersions), 1);
Expand Down

0 comments on commit 0bb582b

Please sign in to comment.