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

Mesh-api setters for eui64 and pskd #6025

Merged
merged 1 commit into from Feb 8, 2018

Conversation

Projects
None yet
5 participants
@karsev
Contributor

karsev commented Feb 6, 2018

Notes:

Description

New setters for mesh-api to be used by the Thread network.
Needed by customers when deploying devices for commissioning.

Status

IN DEVELOPMENT

Migrations

NO

Related PRs

Todos

Deploy notes

Steps to test or reproduce

@karsev

This comment has been minimized.

Contributor

karsev commented Feb 6, 2018

@0xc0170 0xc0170 requested review from SeppoTakalo, mikter and artokin Feb 6, 2018

@karsev karsev force-pushed the karsev:thread_api_adds branch 4 times, most recently from 10eab57 to 1f605ad Feb 6, 2018

@mikter

This comment has been minimized.

Contributor

mikter commented Feb 7, 2018

@kjbracey-arm please review

@mikter

mikter approved these changes Feb 7, 2018

* \return MESH_ERROR_NONE on success.
* \return MESH_ERROR_PARAM in case of illegal parameters.
* */
mesh_error_t device_eui64_set(uint8_t *eui64);

This comment has been minimized.

@kjbracey-arm

kjbracey-arm Feb 7, 2018

Contributor

Needs to be a const pointer. Don't see the point of an error return, if it's just a null check. How can an eui64 be invalid? I guess you could fault multicast ones?

This comment has been minimized.

@karsev

karsev Feb 7, 2018

Contributor

Giving NULL is the only case of an error. This is an application api, so even a simple NULL check should be done? Could be done with assert?

This comment has been minimized.

@kjbracey-arm

kjbracey-arm Feb 7, 2018

Contributor

I'm just generally very down on spending code space specifically on NULL checks in APIs. If someone somehow does it, it'll crash. There are lots of other invalid things - pointers to uninitialised memory, pointers to already-freed blocks, pointers outside RAM, multicast addresses... You can't totally protect people from themselves.

With the error test, you'll return the error, and they just won't bother checking the return code anyway...

Given that the existing calls in this API don't bother with NULL checks, I don't see a reason to start now.

Anyway, minor style nit - not really that bothered. The code-in-assert thing below is critical though.

@@ -278,14 +278,10 @@ void thread_tasklet_configure_and_connect_to_network(void)
// PSKd
const char PSKd[] = MBED_CONF_MBED_MESH_API_THREAD_PSKD;
MBED_ASSERT(sizeof(PSKd) > 5 && sizeof(PSKd) < 33);
if(device_configuration.PSKd_len==0) {
MBED_ASSERT(!thread_tasklet_device_pskd_set(PSKd));

This comment has been minimized.

@kjbracey-arm

kjbracey-arm Feb 7, 2018

Contributor

You can't put code in an assert - it won't be called if a release build.

@0xc0170 0xc0170 added needs: work and removed needs: review labels Feb 7, 2018

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Feb 7, 2018

@karsev Do you want to rebase to clean the log before we trigger tests (possibly squash to one commit ? ) ?

@0xc0170 0xc0170 added needs: CI and removed needs: work labels Feb 7, 2018

@karsev karsev force-pushed the karsev:thread_api_adds branch from 5f44e19 to f63dbf5 Feb 7, 2018

@0xc0170

This comment has been minimized.

Member

0xc0170 commented Feb 8, 2018

/morph build

@mbed-ci

This comment has been minimized.

mbed-ci commented Feb 8, 2018

Build : SUCCESS

Build number : 1090
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6025/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build

@mbed-ci

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@0xc0170 0xc0170 merged commit 65e751b into ARMmbed:master Feb 8, 2018

19 checks passed

AWS-CI uVisor Build & Test Success
Details
ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-test test completed
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
mbed-ci-generic Build finished.
Details
travis-ci/docs Local docs testing has passed
Details
travis-ci/events Local events testing has passed
Details
travis-ci/littlefs Local littlefs testing has passed
Details
travis-ci/mbed2-ATMEL Local mbed2-ATMEL testing has passed
Details
travis-ci/mbed2-MAXIM Local mbed2-MAXIM testing has passed
Details
travis-ci/mbed2-NORDIC Local mbed2-NORDIC testing has passed
Details
travis-ci/mbed2-NUVOTON Local mbed2-NUVOTON testing has passed
Details
travis-ci/mbed2-NXP Local mbed2-NXP testing has passed
Details
travis-ci/mbed2-RENESAS Local mbed2-RENESAS testing has passed
Details
travis-ci/mbed2-SILICON_LABS Local mbed2-SILICON_LABS testing has passed
Details
travis-ci/mbed2-STM Local mbed2-STM testing has passed
Details
travis-ci/tools Local tools testing has passed
Details

@0xc0170 0xc0170 removed the ready for merge label Feb 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment