Skip to content

Commit

Permalink
Merge branch 'project-chip:master' into feature/SiWx917_platform_bringup
Browse files Browse the repository at this point in the history
  • Loading branch information
chirag-silabs authored Nov 29, 2022
2 parents b9741ee + 4f1bc14 commit b4e824b
Show file tree
Hide file tree
Showing 138 changed files with 1,057 additions and 327 deletions.
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
Checks: >
bugprone-*,
modernize-redundant-void-arg,
modernize-use-bool-literals,
modernize-use-nullptr,
performance-for-range-copy,
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -460,15 +460,15 @@ jobs:
uses: actions/upload-artifact@v3
if: ${{ failure() && !env.ACT }}
with:
name: crash-core-linux-python-repl
name: crash-core-linux-java-controller
path: /tmp/cores/
# Cores are big; don't hold on to them too long.
retention-days: 5
- name: Uploading objdir for debugging
uses: actions/upload-artifact@v3
if: ${{ failure() && !env.ACT }}
with:
name: crash-objdir-linux-python-repl
name: crash-objdir-linux-java-controller
path: objdir-clone/
# objdirs are big; don't hold on to them too long.
retention-days: 5
Expand Down
22 changes: 11 additions & 11 deletions docs/style/coding/CODING_STYLE_GUIDE.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ leveraged through toolchain-compatibility preprocessor macros.
CHIP strives to use the latest C++ functionality as long as existing compilers
support such standards.

C{plusplus}14 is considered pervasive enough to be used. As compilers start
C{plusplus}14 is considered pervasive enough to be used. As compilers start
supporting standards such as C{plusplus}17, C{plusplus}20 and beyond,
CHIP may follow suit.

Expand Down Expand Up @@ -354,7 +354,7 @@ static chipDEFINE_ALIGNED_VAR(sThreadAttributes, sizeof (pthread_attr_t), uint64
#endif // USE_STRUCT_STORAGE
int foobar(void)
int foobar()
{
int retval;
int status;
Expand Down Expand Up @@ -427,10 +427,10 @@ destructed after deinitialization.
class ThreadAttributes
{
public:
ThreadAttributes(void) {};
~ThreadAttributes(void) {};
ThreadAttributes() {};
~ThreadAttributes() {};
operator pthread_attr_t *(void) { return &mAttributes; }
operator pthread_attr_t *() { return &mAttributes; }
private:
pthread_attr_t mAttributes;
Expand All @@ -444,7 +444,7 @@ extern void * foobar_entry(void *aArgument);
static chipDEFINE_ALIGNED_VAR(sThreadAttributes, sizeof (ThreadAttributes), uint64_t);
int foobar(void)
int foobar()
{
int retval = -1;
int status;
Expand Down Expand Up @@ -530,9 +530,9 @@ storage of objects from a static array of storage.
class Foo
{
public:
Foo(void);
Foo();
Foo(const Foo &inFoo);
~Foo(void);
~Foo();
};
// Global Variables
Expand All @@ -554,7 +554,7 @@ static void CreateFooAllocator(void *inStorage,
inDestroy);
}
static StaticAllocatorBitmap &GetFooAllocator(void)
static StaticAllocatorBitmap &GetFooAllocator()
{
return *sFooAllocator;
}
Expand All @@ -571,7 +571,7 @@ static void FooDestroy(AllocatorBase &inAllocator, void *inObject)
return;
}
int Init(void)
int Init()
{
static const size_t sFooCount = CHIP_FOO_COUNT;
static chipAllocatorStaticBitmapStorageDefine(sFooStorage, Foo, sFooCount, uint32_t, sizeof (void *));
Expand All @@ -586,7 +586,7 @@ int Init(void)
return retval;
}
Foo * FooAllocate(void)
Foo * FooAllocate()
{
Foo *foo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ CHIP_ERROR ActionsAttrAccess::Read(const ConcreteReadAttributePath & aPath, Attr
}
} // anonymous namespace

void MatterActionsPluginServerInitCallback(void)
void MatterActionsPluginServerInitCallback()
{
registerAttributeAccessOverride(&gAttrAccess);
}
2 changes: 1 addition & 1 deletion examples/bridge-app/linux/bridged-actions-stub.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ CHIP_ERROR ActionsAttrAccess::Read(const ConcreteReadAttributePath & aPath, Attr
}
} // anonymous namespace

void MatterActionsPluginServerInitCallback(void)
void MatterActionsPluginServerInitCallback()
{
registerAttributeAccessOverride(&gAttrAccess);
}
4 changes: 2 additions & 2 deletions examples/chip-tool/commands/common/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ const char * Command::GetArgumentDescription(size_t index) const
return nullptr;
}

const char * Command::GetAttribute(void) const
const char * Command::GetAttribute() const
{
size_t argsCount = mArgs.size();
for (size_t i = 0; i < argsCount; i++)
Expand All @@ -818,7 +818,7 @@ const char * Command::GetAttribute(void) const
return nullptr;
}

const char * Command::GetEvent(void) const
const char * Command::GetEvent() const
{
size_t argsCount = mArgs.size();
for (size_t i = 0; i < argsCount; i++)
Expand Down
25 changes: 25 additions & 0 deletions examples/platform/silabs/efr32/project_include/OpenThreadConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,31 @@
// Enable use of external heap allocator (calloc/free) for OpenThread.
#define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 1

#if CHIP_DEVICE_CONFIG_ENABLE_SED
#define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 0
// In seconds
#define OPENTHREAD_CONFIG_MLE_CHILD_TIMEOUT_DEFAULT (SL_SLEEP_TIME_MS / 1000)
#endif

/****Uncomment below section for OpenThread Debug logs*/
// #define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_DEBG

// #ifndef OPENTHREAD_CONFIG_LOG_CLI
// #define OPENTHREAD_CONFIG_LOG_CLI 1
// #endif

// #ifndef OPENTHREAD_CONFIG_LOG_PKT_DUMP
// #define OPENTHREAD_CONFIG_LOG_PKT_DUMP 1
// #endif

// #ifndef OPENTHREAD_CONFIG_LOG_PLATFORM
// #define OPENTHREAD_CONFIG_LOG_PLATFORM 1
// #endif

// #ifndef OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL
// #define OPENTHREAD_CONFIG_LOG_PREPEND_LEVEL 1
// #endif

// EFR32MG21A020F1024IM32 has 96k of RAM. Reduce the number of buffers to
// conserve RAM for this Series 2 part.
#if defined(EFR32MG21)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import android.util.Log;
import chip.platform.NsdManagerServiceResolver;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class NsdDiscoveryListener implements NsdManager.DiscoveryListener {
private static final String TAG = NsdDiscoveryListener.class.getSimpleName();
Expand All @@ -33,6 +35,7 @@ public class NsdDiscoveryListener implements NsdManager.DiscoveryListener {
private final SuccessCallback<DiscoveredNodeData> successCallback;
private final FailureCallback failureCallback;
private final NsdManagerServiceResolver.NsdManagerResolverAvailState nsdManagerResolverAvailState;
private final ExecutorService resolutionExecutor;

public NsdDiscoveryListener(
NsdManager nsdManager,
Expand All @@ -49,6 +52,7 @@ public NsdDiscoveryListener(
this.successCallback = successCallback;
this.failureCallback = failureCallback;
this.nsdManagerResolverAvailState = nsdManagerResolverAvailState;
this.resolutionExecutor = Executors.newSingleThreadExecutor();
}

@Override
Expand All @@ -58,24 +62,32 @@ public void onDiscoveryStarted(String regType) {

@Override
public void onServiceFound(NsdServiceInfo service) {
Log.d(TAG, "Service discovery success. " + service);
if (service.getServiceType().equals(targetServiceType)) {
if (nsdManagerResolverAvailState != null) {
nsdManagerResolverAvailState.acquireResolver();
}
nsdManager.resolveService(
service,
new NsdResolveListener(
nsdManager,
deviceTypeFilter,
preCommissionedVideoPlayers,
successCallback,
failureCallback,
nsdManagerResolverAvailState,
1));
} else {
Log.d(TAG, "Ignoring discovered service: " + service.toString());
}
this.resolutionExecutor.execute(
new Runnable() {
@Override
public void run() {
Log.d(TAG, "Service discovery success. " + service);
if (service.getServiceType().equals(targetServiceType)) {
if (nsdManagerResolverAvailState != null) {
nsdManagerResolverAvailState.acquireResolver();
}

Log.d(TAG, "Calling NsdManager.resolveService for " + service);
nsdManager.resolveService(
service,
new NsdResolveListener(
nsdManager,
deviceTypeFilter,
preCommissionedVideoPlayers,
successCallback,
failureCallback,
nsdManagerResolverAvailState,
1));
} else {
Log.d(TAG, "Ignoring discovered service: " + service.toString());
}
}
});
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class CommissionableDataProviderImpl : public CommissionableDataProvider

CHIP_ERROR GetSpake2pIterationCount(uint32_t & iterationCount) override
{
if (mSetupDiscriminator > 0)
if (mSpake2pIterationCount > 0)
{
iterationCount = mSpake2pIterationCount;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@
CoreData,
"-Wl,-unexported_symbol,\"__Z*\"",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.matter.TvCasting-sharadb";
PRODUCT_BUNDLE_IDENTIFIER = com.matter.TvCasting;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down Expand Up @@ -467,7 +467,7 @@
"-Wformat-nonliteral",
"-Wformat-security",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.matter.TvCasting-sharadb";
PRODUCT_BUNDLE_IDENTIFIER = com.matter.TvCasting;
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ struct TvCastingApp: App {
}
appParameters.rotatingDeviceIdUniqueId = Data(rotatingDeviceIdUniqueId)

let onboardingParameters: OnboardingPayload = OnboardingPayload()
onboardingParameters.setupPasscode = 20202021
onboardingParameters.setupDiscriminator = 3840

appParameters.onboardingPayload = onboardingParameters

castingServerBridge.initApp(appParameters, clientQueue: DispatchQueue.main, initAppStatusHandler: { (result: Bool) -> () in
self.Log.info("initApp result \(result)")
})
Expand Down
9 changes: 9 additions & 0 deletions scripts/tools/zap/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class CmdLineArgs:
templateFile: str
outputDir: str
runBootstrap: bool
parallel: bool = True


CHIP_ROOT_DIR = os.path.realpath(
Expand Down Expand Up @@ -103,6 +104,9 @@ def runArgumentsParser() -> CmdLineArgs:
help='Output directory for the generated files (default: automatically selected)')
parser.add_argument('--run-bootstrap', default=None, action='store_true',
help='Automatically run ZAP bootstrap. By default the bootstrap is not triggered')
parser.add_argument('--parallel', action='store_true')
parser.add_argument('--no-parallel', action='store_false', dest='parallel')
parser.set_defaults(parallel=True)
args = parser.parse_args()

# By default, this script assumes that the global CHIP template is used with
Expand Down Expand Up @@ -259,6 +263,11 @@ def main():

# The maximum memory usage is over 4GB (#15620)
os.environ["NODE_OPTIONS"] = "--max-old-space-size=8192"

if cmdLineArgs.parallel:
# Parallel-compatible runs will need separate state
os.environ["ZAP_TEMPSTATE"] = "1"

runGeneration(cmdLineArgs.zapFile, cmdLineArgs.zclFile, cmdLineArgs.templateFile, cmdLineArgs.outputDir)

prettifiers = [
Expand Down
26 changes: 24 additions & 2 deletions scripts/tools/zap_regen_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import sys
import subprocess
import logging
import multiprocessing

from dataclasses import dataclass

CHIP_ROOT_DIR = os.path.realpath(
Expand Down Expand Up @@ -113,6 +115,11 @@ def setupArgumentsParser():
help="Don't do any generation, just log what targets would be generated (default: False)")
parser.add_argument('--run-bootstrap', default=None, action='store_true',
help='Automatically run ZAP bootstrap. By default the bootstrap is not triggered')

parser.add_argument('--parallel', action='store_true')
parser.add_argument('--no-parallel', action='store_false', dest='parallel')
parser.set_defaults(parallel=True)

return parser.parse_args()


Expand Down Expand Up @@ -253,6 +260,14 @@ def getTargets(type, test_target):
return targets


def _ParallelGenerateOne(target):
"""
Helper method to be passed to multiprocessing parallel generation of
items.
"""
target.generate()


def main():
logging.basicConfig(
level=logging.INFO,
Expand All @@ -269,8 +284,15 @@ def main():
if args.run_bootstrap:
subprocess.check_call(os.path.join(CHIP_ROOT_DIR, "scripts/tools/zap/zap_bootstrap.sh"), shell=True)

for target in targets:
target.generate()
if args.parallel:
# Ensure each zap run is independent
os.environ['ZAP_TEMPSTATE'] = '1'
with multiprocessing.Pool() as pool:
for _ in pool.imap_unordered(_ParallelGenerateOne, targets):
pass
else:
for target in targets:
target.generate()


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion src/app/AttributePathExpandIterator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ using namespace chip;
// Note: Some of the generated files that depended by af.h are gen_config.h and gen_tokens.h
typedef uint8_t EmberAfClusterMask;

extern uint16_t emberAfEndpointCount(void);
extern uint16_t emberAfEndpointCount();
extern uint16_t emberAfIndexFromEndpoint(EndpointId endpoint);
extern uint8_t emberAfClusterCount(EndpointId endpoint, bool server);
extern uint16_t emberAfGetServerAttributeCount(chip::EndpointId endpoint, chip::ClusterId cluster);
Expand Down
2 changes: 1 addition & 1 deletion src/app/EventManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class CircularEventReader : public TLV::TLVReader
virtual ~CircularEventReader() = default;
};

EventManagement & EventManagement::GetInstance(void)
EventManagement & EventManagement::GetInstance()
{
return sInstance;
}
Expand Down
Loading

0 comments on commit b4e824b

Please sign in to comment.