Commit Graph

335 Commits

Author SHA1 Message Date
Jonathan Hui 69d98d4a53 [code-style] apply clang-format 2018-02-09 21:43:42 +00:00
Abtin Keshavarzian 5fc97364f3 [locator] adding OwnerLocator (#2346)
This commit adds a new class `OwnerLocator` which is used by the
callback providing types (like `Timer` or `Tasklet`) to remember the
owner of the object. This change help simplify the handling of
callbacks from such objects. The object itself can be used to get
to its owner using `GetOwner<Type>()` method.  If support for multiple
OpenThread instances is enabled, an `OwnerLocator`  object maintains a
pointer to the owner. But for the single OpenThread instance scenario,
the owner is derived from the single `ot::Instance` object.
2017-11-28 22:42:54 +00:00
Jonathan Hui 741941e271 [radio] remove transmit power config from core (#2352)
Thread (and OpenThread) does not employ any form of transmit power control.
As a result, while OpenThread provides APIs to control transmit power, it
simply buffers and passes the transmit power value straight through to the
radio.

Currently, the transmit power APIs allow specifying an int8_t in units of
dBm.  This is overly constraining for platforms that have more advanced ways
of configuring the transmit power.

This commit removes the transmit power configuration from the core.  This
provides better flexibility in platform-specific ways to configure transmit
power.
2017-11-28 17:33:32 +00:00
Abtin Keshavarzian 02c876ef62 [instance] define ot::Instance class (#2307)
This commit makes the following changes: It defines the public
`otInstance` as an empty opaque structure which is used by all public
C OpenThread APIs. It defines a new class `ot::Instance` (inheriting
from `otInstance) which is then used in core source files. The
functionality related to the instance is also moved/added into the
newly added `Instance` class (as class/static or member methods).
2017-11-13 08:27:57 -08:00
Jonathan Hui 74b3160f9d [meshcop] use IEEE EUI-64 rather than Joiner ID on user input (#2311) 2017-11-07 09:41:46 -08:00
Kamil Burzynski 005781d066 [network-data] add Service/Server TLV support (#2256) 2017-10-26 12:27:19 -07:00
Łukasz Duda 7b084eca71 [toolchain] fix warnings/errors in Keil compiler (#2286) 2017-10-25 08:54:17 -07:00
rongli 28d08916a5 [cli] separate the result and child list in different lines for THCI (#2296) 2017-10-24 08:46:46 -07:00
Abtin Keshavarzian 2ea56446a4 [config-header] simplify config header file includes (#2255)
This commit simplifies the config header files includes in
OpenThread core and non-public source files. With this change the
"openthread-core-config.h" becomes the main config header file. This
header file includes all other config ones:
1) The `configure` generated `<openthread/config.h>;
2) The project specific one by `OPENTHREAD_PROJECT_CORE_CONFIG_FILE`;
3) The "openthread-core-default-config.h" defining default settings.

With the change in this commit, all header files include "openthread-
core-config.h" as the first `#include`, and in `.cpp` files, the first
`#include` continues to be the unit's corresponding header file. The
new model ensures that the configuration settings are visible and
consistent in all the source files. This commit also updates the
style guide document accordingly.
2017-10-17 09:46:34 -07:00
rongli 11924b09ff [cli] networkdiagnostic: pass tlv types directly (#2261) 2017-10-16 07:52:56 -07:00
rongli b1baa7da52 [mac] rename mRxWhitelistFiltered to mRxAddressFiltered (#2263) 2017-10-13 09:33:23 -07:00
Giedrius e190edf8a0 [message] extend buffer info provided by otMessageGetBufferInfo() (#2249)
* Include application CoAP messages and buffers
* Include cached messages and buffers
* Set unused buffer info fields to zero
2017-10-09 23:53:03 -07:00
Robert Lubos 1bfa370f1f [cli] add neighbor command (#2244) 2017-10-04 21:19:38 -07:00
Jonathan Hui d1d3f5d63a [cli] remove useless call (#2228) 2017-09-27 23:06:52 -07:00
Wojciech Bober aa6e1a4c22 [cli] add support for extending CLI with user commands (#2223) 2017-09-27 06:12:35 -07:00
Robert Lubos 141ceb0446 [mac] fix tx counters (#2134) 2017-08-28 20:17:41 -07:00
DuaneEllis-TI e937542990 [debug] add debug uart (#2082) 2017-08-24 10:28:01 -07:00
Jonathan Hui 5ecab16f86 [configure] replace --with-platform-info using project config (#2077) 2017-08-08 22:10:07 -07:00
Jonathan Hui 5d7a03334f [radio] unify around otExtAddress type (#2029) 2017-07-28 08:05:06 -07:00
Jonathan Hui f88c537c6c [udp] add cli-based example for UDP APIs (#2027) 2017-07-26 12:14:44 -07:00
Abtin Keshavarzian fc72e4e719 [instance-locator] use instance reference instead of pointer (#2007)
This commit changes the `InstanceLocator` class to keep track of a
reference to `otInstance` (instead of a pointer) to make it behave
similar to other `ObjectLocator` classes. The method `GetInstance()`
in all locator objects is updated to provide a reference (instead
of a pointer) to `otInstance`.

The logging macros are updated such that a reference to `otInstance`
is passed as the first argument (with the exception of
`otLog<Level>Plat()` macros which are used by platform code in C
domain). The documentation for log macros are also updated.
2017-07-25 15:06:14 -07:00
Buke Po 2aa9830a07 [cli][posix] allow Ctrl-D to exit (#2017) 2017-07-20 22:13:49 -07:00
Buke Po e14598c680 [scheduler] move schedulers into otInstance (#1997) 2017-07-14 16:23:22 -07:00
rongli 502c6ca5d6 [mac filter] add rssfilter support and integrate whitelist/blacklist to AddressFilter (#1967)
* [mac filter] add rssfilter support and integrate whitelist/blacklist
- provide RssIn filter function to fix the received signal strength for test purpose.
- provide Address filter function which integrates whitelist and blacklist, save (~300B) RAM.
- update cli and spinel-cli to reflect new otLinkFilterX() APIs.
- keep whitelist/blacklist spinel properties the same as before while implemented with new otLinkFilterX() APIs.
- THCI: add setOutBoundLinkQuality() API for DEV-1530
- THCI: update Allow/Block relative APIs
- update some test scripts due to new OT_ERROR_ALEADY when adding duplicate address to whitelist

* update for comments

* add MAC_FIXED_RSS spinel property

* rebase and apply new OutboundFrameBegin(aHeader)

* update OpenThread.py
2017-07-11 22:38:49 -07:00
Shu Chen 129c419107 [timer] multiple microseconds timer support (#1962)
* [timer] multiple microseconds timer support

* Remove TimerSchedulerLocator, Timer inherit from Ip6Locator instead to get TimerScheduler.

* Add separate UsecTimer and UsecTimerScheduler for multiple microseconds timer support.

* [timer] refine Timer names

* Rename alarm header files to alarm-milli.h and alarm-micro.h

* Rename alarm APIs to start with otPlatAlarmMilli and otPlatAlarmMicro

* Rename Timer classes to TimerMilli/TimerMilliScheduler and TimerMicro/TimerMicroScheduler

* [Timer] Refactor Timer code structure

* Create TimerBase and TimerSchedulerBase class for common functions;

* Use TimerMilli/TimerMicro and TimerMilliScheduler/TimerMicroScheduler for different functions;

* Define AlarmApi, so then TimerMilliScheduler/TimerMicroScheduler could use different AlarmApi.
2017-07-10 16:01:27 -07:00
Abtin Keshavarzian bbab3074ed [instance] single OpenThread instance optimizations (#1926)
This commit new configuration option `enable-multiple-instances` and
its corresponding option `OPENTHREAD_ENABLE_MULTIPLE_INSTANCES`. When
enabled OpenThread supports handling of multiple instances. By default
this is disabled.

This commit also adds two optimizations for single instance case to
simplify the code and also help reduce memory/RAM usage:

(1) OpenThread objects/classes typically keep a reference to a higher
level object (e.g., many classes keep track of owning `ThreadNetif`)
to be able to access other objects/methods within OpenThread class
hierarchy. In single instance mode, the reference member variables are
removed and instead global functions are used to access the singleton
objects from one class to the other. To implement this, a group of
`<Object>Locator` classes are defined (e.g., `ThreadNetifLocator`,
etc.) which are then used as base class of other OpenThread classes.

(2) OpenThread objects which provide a callback/handler (e.g.,
`Timer`, `Tasklet`, etc.) have `void *mContext` member variable which
is used to keep track of the owner of the object. In single instance
mode the `mConext` member variables are removed since the owner is
expected to be a singleton and can be uniquely determined from the
callback function.

To implement this, two changes are made: First the handler methods are
modified to provide a reference to the object (e.g., `Timer` handler
will provide a `Timer &aTimer` as a parameter of its handler
callback). Second, a new base class `Context` is introduced which
hides the implementation providing an arbitrary context information. A
new static method `GetOwner(aContext)` is added to classes which own a
callback providing objects. This method help convert a `Context` to
the reference of the owner class object.
2017-06-30 11:48:26 -07:00
Abtin Keshavarzian 8924a545c0 Use OT_UNUSED_VARIABLE(variable) to replace (void)variable (#1934) 2017-06-26 22:22:37 -07:00
Łukasz Duda 70775bdb9a Add ping stop command. (#1925) 2017-06-22 00:04:24 -07:00
Shu Chen 844482a52b cli: Add parent priority set cli (#1923) 2017-06-22 00:03:26 -07:00
Mike 8dc31d6e27 Enable defines (#1877)
* Add dhcp6 client define, and update openthred-config include scheme

* #1663 - update include to use quotes instead of angle brackets

* #1663 - update file to use underscore instead of dash

* #1663 - remove extra space

* #1663 - update location of new header file and update files to point to it

* #1663 - update location of new header file and update files to point to it

* #1663 update makefile.am to include new header

* update for make pretty changes

* more pretty fixes

* cleanup, and remove automatic mbedtls change

* remove debugging change

* #1663 - Remove extra space, and change include to use angle brackets instead of quotes.

* rename the enable defines file to openthred_config

* #1663 clean up for code review

* #1663 - clean up last nits

* #1663 - missed merge conflicts - file openthread-config.h -> openthread/openthread_config.h
2017-06-12 13:26:44 -07:00
Jonathan Hui 2304e4d5ac Clean up state changed names. (#1887) 2017-06-08 08:50:00 -07:00
Shu Chen 473b83b02f Add --enable-border-router configure option (#1834)
* Use `OPENTHREAD_ENABLE_BORDER_ROUTER` feature flag to wrap Border Router related features

* MTD devices could also act as a Border Router
2017-06-02 21:49:07 -07:00
Shu Chen 86d740dcf1 Separate Link Quality name from LQI (#1867) 2017-06-02 18:18:07 -07:00
Shu Chen 4460fb1815 Don't return parent info if the device is not a child (#1868)
* Fix the issue that the previous parent information could be retrieved
  even after the device is not a child

* Print more parent information in CLI
2017-06-02 09:03:48 -07:00
Jonathan Hui 8872e292eb Clean up CoAP CLI. (#1864)
- Change static methods into class methods.
- Remove client/server distinction.
- Fix callback method types and remove unnecessary type casts.
- Update README.md to reflect changes.
2017-06-02 08:56:47 -07:00
Jonathan Hui 3c408bac8e Clean up CLI member names. (#1855) 2017-05-31 18:24:59 -07:00
Jonathan Hui 48a9a63252 Clean up radio names. (#1837) 2017-05-27 21:27:06 -07:00
Jonathan Hui 427ef53900 Cleanup device role names. (#1820) 2017-05-25 15:36:43 -07:00
Jonathan Hui ded892f8c6 Clean up ICMP names. (#1825) 2017-05-25 14:43:27 -07:00
Jonathan Hui 344a78f39f Cleanup MLE attach names. (#1816) 2017-05-24 08:41:38 -07:00
Jonathan Hui fce2d83927 Clean up route preference names. (#1810) 2017-05-24 08:34:49 -07:00
Jonathan Hui 48b9299544 Clean up error names. (#1764) 2017-05-23 09:34:35 -07:00
Shu Chen 8899793e61 Add txpowermax CLI (#1775) 2017-05-16 09:10:26 -07:00
Jonathan Hui 39b1162b1e Combine CoAP Client and Server into a single CoAP agent. (#1745) 2017-05-12 11:51:19 -07:00
Jonathan Hui fbfd76a990 Apply #include code style. (#1723) 2017-05-05 11:28:29 -07:00
Jonathan Hui da7ba8ba19 Require Thread Master Key to be 16 bytes. (#1724)
- Update code to use `otMasterKey` type.
2017-05-05 09:21:43 -07:00
Vaas Krishnamurthy 8d5a701adb Set steering data and enable MLE discovery response filtering. (#1685)
Enable OPENTHREAD_CONFIG_ENABLE_STEERING_DATA_SET_OOB to be able to set
steering data out of band on FFDs.

On joining device, enable filtering MLE discovery responses based on Factory assigned EUI64.
2017-05-03 13:24:02 -07:00
Buke Po 9a35b0de05 Make Network Diagnostic optional for MTD. (#1686)
* make network diagnostic optional for mtd
2017-05-01 20:07:39 -07:00
Shu Chen 90d62a4e22 Remove some Leader/Router related features from MTD build (#1680)
* Unify the location of "#if OPENTHREAD_FTD" which include/exclude the whole file

Also correct some comments in xxx_api.cpp

* Remove Address Resolver related features from MTD build

* Remove some Leader/Router related features from MTD build

* Remove Leader/Router related APIs from MTD build

* Remove Leader/Router related functions from MTD build
2017-04-30 20:46:22 -07:00
Jonathan Hui 1eabda6a08 Change top-level namespace from 'Thread' to 'ot'. (#1664) 2017-04-27 22:29:05 -07:00