Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP32: Add bridge app example to ESP32 #8368

Merged
merged 1 commit into from
Aug 4, 2021

Conversation

sweetymhaiske
Copy link
Contributor

@sweetymhaiske sweetymhaiske commented Jul 14, 2021

Problem

  • Add bridge-app example to ESP32.

Change overview

  • Created 4 devices (non-chip devices).
  • Created dynamic endpoints, clusters, and attributes
  • Non CHIP devices are added to the endpoint 2, 4, 5, 6.

Testing

  • Build and flash the application on esp32 DevkitC
  • Performed on-off cluster control using python chip controller on the dynamically created endpoints.

command 1

chip-device-ctrl > zclread Descriptor PartsList 135246 0 0

output 1

[1626447466.983630][446912:446920] CHIP:ZCL: ReadAttributesResponse:
[1626447466.983634][446912:446920] CHIP:ZCL:   ClusterId: 0x001d
[1626447466.983640][446912:446920] CHIP:ZCL:   attributeId: 0x0003
[1626447466.983642][446912:446920] CHIP:ZCL:   status: Success                (0x0000)
[1626447466.983649][446912:446920] CHIP:ZCL:   attribute TLV Type: 0x17
[1626447466.983659][446912:446920] CHIP:ZCL:   attributeValue: List of length 4

command 2

chip-device-ctrl > zcl OnOff Off 135246 4 0

output 2

I (217115) chip[ZCL]: On/Off set value: 4 0
I (217125) chip[DL]: HandleReadOnOffAttribute: attrId=0, maxReadLength=1
I (217125) chip[ZCL]: Toggle on/off from 1 to 0
I (217135) chip[DL]: HandleWriteOnOffAttribute: attrId=0
I (217145) chip[DL]: Device[Light 3]: OFF

@todo
Copy link

todo bot commented Jul 14, 2021

(cecille): Fix for the case where BLE and SoftAP are both enabled.`

// TODO(cecille): Fix for the case where BLE and SoftAP are both enabled.`
ConnectivityMgr().SetBLEAdvertisingEnabled(false);
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}
else
{
// If rendezvous is bypassed, enable SoftAP so that the device can still
// be communicated with via its SoftAP as needed.
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}


This comment was generated by todo based on a TODO comment in fa94d0d in #8368. cc @sweetymhaiske.

@todo
Copy link

todo bot commented Jul 14, 2021

(cecille): Fix for the case where BLE and SoftAP are both enabled.`

// TODO(cecille): Fix for the case where BLE and SoftAP are both enabled.`
ConnectivityMgr().SetBLEAdvertisingEnabled(false);
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}
else
{
// If rendezvous is bypassed, enable SoftAP so that the device can still
// be communicated with via its SoftAP as needed.
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}


This comment was generated by todo based on a TODO comment in 6b33427 in #8368. cc @sweetymhaiske.

@todo
Copy link

todo bot commented Jul 14, 2021

(cecille): Fix for the case where BLE and SoftAP are both enabled.`

// TODO(cecille): Fix for the case where BLE and SoftAP are both enabled.`
ConnectivityMgr().SetBLEAdvertisingEnabled(false);
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}
else
{
// If rendezvous is bypassed, enable SoftAP so that the device can still
// be communicated with via its SoftAP as needed.
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}


This comment was generated by todo based on a TODO comment in 24f3bbc in #8368. cc @sweetymhaiske.

@todo
Copy link

todo bot commented Jul 14, 2021

(cecille): Fix for the case where BLE and SoftAP are both enabled.`

// TODO(cecille): Fix for the case where BLE and SoftAP are both enabled.`
ConnectivityMgr().SetBLEAdvertisingEnabled(false);
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}
else
{
// If rendezvous is bypassed, enable SoftAP so that the device can still
// be communicated with via its SoftAP as needed.
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}


This comment was generated by todo based on a TODO comment in 239dede in #8368. cc @sweetymhaiske.

@todo
Copy link

todo bot commented Jul 14, 2021

(cecille): Fix for the case where BLE and SoftAP are both enabled.`

// TODO(cecille): Fix for the case where BLE and SoftAP are both enabled.`
ConnectivityMgr().SetBLEAdvertisingEnabled(false);
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}
else
{
// If rendezvous is bypassed, enable SoftAP so that the device can still
// be communicated with via its SoftAP as needed.
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}


This comment was generated by todo based on a TODO comment in d6c7bb9 in #8368. cc @sweetymhaiske.

@todo
Copy link

todo bot commented Jul 14, 2021

(cecille): Fix for the case where BLE and SoftAP are both enabled.`

// TODO(cecille): Fix for the case where BLE and SoftAP are both enabled.`
ConnectivityMgr().SetBLEAdvertisingEnabled(false);
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}
else
{
// If rendezvous is bypassed, enable SoftAP so that the device can still
// be communicated with via its SoftAP as needed.
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}


This comment was generated by todo based on a TODO comment in f0f071e in #8368. cc @sweetymhaiske.

@todo
Copy link

todo bot commented Jul 14, 2021

(cecille): Fix for the case where BLE and SoftAP are both enabled.`

// TODO(cecille): Fix for the case where BLE and SoftAP are both enabled.`
ConnectivityMgr().SetBLEAdvertisingEnabled(false);
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}
else
{
// If rendezvous is bypassed, enable SoftAP so that the device can still
// be communicated with via its SoftAP as needed.
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}


This comment was generated by todo based on a TODO comment in e6d60d5 in #8368. cc @sweetymhaiske.

examples/bridge-app/esp32/main/CHIPDeviceManager.cpp Outdated Show resolved Hide resolved
examples/bridge-app/esp32/main/Device.cpp Outdated Show resolved Hide resolved
examples/bridge-app/esp32/main/Device.cpp Outdated Show resolved Hide resolved
examples/bridge-app/esp32/main/Device.cpp Outdated Show resolved Hide resolved
examples/bridge-app/esp32/main/DeviceCallbacks.cpp Outdated Show resolved Hide resolved
examples/bridge-app/esp32/main/main.cpp Outdated Show resolved Hide resolved
examples/bridge-app/esp32/main/main.cpp Outdated Show resolved Hide resolved
examples/bridge-app/esp32/main/main.cpp Outdated Show resolved Hide resolved
examples/bridge-app/esp32/main/main.cpp Outdated Show resolved Hide resolved
examples/bridge-app/esp32/main/main.cpp Outdated Show resolved Hide resolved
examples/bridge-app/esp32/main/main.cpp Show resolved Hide resolved
examples/bridge-app/esp32/main/main.cpp Show resolved Hide resolved
examples/bridge-app/esp32/main/main.cpp Outdated Show resolved Hide resolved
examples/bridge-app/esp32/main/main.cpp Outdated Show resolved Hide resolved
examples/bridge-app/esp32/main/main.cpp Outdated Show resolved Hide resolved
examples/bridge-app/esp32/CMakeLists.txt Outdated Show resolved Hide resolved
examples/bridge-app/esp32/CMakeLists.txt Outdated Show resolved Hide resolved
examples/bridge-app/esp32/CMakeLists.txt Outdated Show resolved Hide resolved
examples/bridge-app/esp32/main/CMakeLists.txt Outdated Show resolved Hide resolved
examples/bridge-app/esp32/main/CMakeLists.txt Outdated Show resolved Hide resolved
examples/bridge-app/esp32/main/Kconfig.projbuild Outdated Show resolved Hide resolved
examples/bridge-app/esp32/main/Kconfig.projbuild Outdated Show resolved Hide resolved
examples/bridge-app/esp32/main/main.cpp Outdated Show resolved Hide resolved
examples/bridge-app/esp32/main/main.cpp Show resolved Hide resolved
@dhrishi
Copy link
Contributor

dhrishi commented Jul 14, 2021

@sweetymhaiske Please add the actual controller commands in the Testing section.

@todo
Copy link

todo bot commented Jul 19, 2021

(cecille): Fix for the case where BLE and SoftAP are both enabled.`

// TODO(cecille): Fix for the case where BLE and SoftAP are both enabled.`
ConnectivityMgr().SetBLEAdvertisingEnabled(false);
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}
else
{
// If rendezvous is bypassed, enable SoftAP so that the device can still
// be communicated with via its SoftAP as needed.
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}


This comment was generated by todo based on a TODO comment in e020577 in #8368. cc @sweetymhaiske.

@sweetymhaiske
Copy link
Contributor Author

@dhrishi @bzbarsky-apple @andy31415 PTAL.

@sweetymhaiske
Copy link
Contributor Author

@bzbarsky-apple PTAL

Copy link
Contributor

@bzbarsky-apple bzbarsky-apple left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for addressing most of the issues!

The two problems remaining are:

  1. This is still adding yet another copy/paste of ToZclCharString instead of putting it as a utility somewhere shared. I'd really prefer for this to be fixed before merging this, but can probably live with a commitment to do it immediately after this merges.
  2. No tests. Followup for this, I guess, since testing on-device things is not trivial.

@todo
Copy link

todo bot commented Jul 23, 2021

(cecille): Fix for the case where BLE and SoftAP are both enabled.`

// TODO(cecille): Fix for the case where BLE and SoftAP are both enabled.`
ConnectivityMgr().SetBLEAdvertisingEnabled(false);
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}
else
{
// If rendezvous is bypassed, enable SoftAP so that the device can still
// be communicated with via its SoftAP as needed.
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}


This comment was generated by todo based on a TODO comment in 4cf8219 in #8368. cc @sweetymhaiske.

@sweetymhaiske
Copy link
Contributor Author

Thank you for addressing most of the issues!

The two problems remaining are:

  1. This is still adding yet another copy/paste of ToZclCharString instead of putting it as a utility somewhere shared. I'd really prefer for this to be fixed before merging this, but can probably live with a commitment to do it immediately after this merges.
  2. No tests. Followup for this, I guess, since testing on-device things is not trivial.
  1. I am waiting for this PR [TV app] Store string attributes as ZCL strings #8325 to get merged. Once done I assure you, I will add those changes in this app too.
  2. For now, I have added the local test using python controller in PR description.

@todo
Copy link

todo bot commented Jul 23, 2021

(cecille): Fix for the case where BLE and SoftAP are both enabled.`

// TODO(cecille): Fix for the case where BLE and SoftAP are both enabled.`
ConnectivityMgr().SetBLEAdvertisingEnabled(false);
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}
else
{
// If rendezvous is bypassed, enable SoftAP so that the device can still
// be communicated with via its SoftAP as needed.
ConnectivityMgr().SetWiFiAPMode(ConnectivityManager::kWiFiAPMode_Enabled);
}


This comment was generated by todo based on a TODO comment in fdca9cc in #8368. cc @sweetymhaiske.

@dhrishi dhrishi requested a review from bzbarsky-apple July 27, 2021 15:48
@sweetymhaiske
Copy link
Contributor Author

@bzbarsky-apple PTAL

@bzbarsky-apple
Copy link
Contributor

@andy31415 are your comments here addressed?

@sweetymhaiske
Copy link
Contributor Author

@andy31415 Please help to get this merge.

@andy31415 andy31415 merged commit 1ef0443 into project-chip:master Aug 4, 2021
kpschoedel added a commit to kpschoedel/connectedhomeip that referenced this pull request Aug 4, 2021
@bzbarsky-apple
Copy link
Contributor

@sweetymhaiske Should this new app have a README.md explaining how to build and whatnot?

@bzbarsky-apple
Copy link
Contributor

@sweetymhaiske And shouldn't examples/bridge-app/esp32/build/ and examples/bridge-app/esp32/sdkconfig be added to .gitignore?

nikita-s-wrk pushed a commit to nikita-s-wrk/connectedhomeip that referenced this pull request Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants