aboutsummaryrefslogtreecommitdiff
path: root/src/commands
AgeCommit message (Collapse)Author
2016-07-22libweave: Update libchrome APIs to r405848Luis Hector Chavez
The new libchrome has been ported from Chromium and some APIs have changed. Make necessary changes at call sites. Notable changes are: - base::Bind() now explicitly disallows captures in lambdas (which was never allowed in the style guide). - base::ListValue::iterator now exposes std::unique_ptr<base::Value> instead of raw base::Value*. BUG=29104761 TEST=All tests in libweave_test pass on dragonboard-eng build TEST=make testall Change-Id: Ifb2d4f83f9f92b8ded5f12ac1c622e8ab5549b7d Reviewed-on: https://weave-review.googlesource.com/4185 Reviewed-by: Robert Ginda <rginda@google.com>
2016-03-29libweave: Remove release() calls on scoped_ptrAlex Vakulenko
Now that scoped_ptr is just a type alias to std::unique_ptr, there is no need to do release()/aquire semantics to convert between scoped_ptr and unique_ptr. Also, replaced base::Value::DeepCopy with the safer smart-pointer-enabled base::Value::CreateDeepCopy. Change-Id: I6b7ed78b3fae6d42a68b7d73ae4d9d5eebf48922 Reviewed-on: https://weave-review.googlesource.com/3067 Reviewed-by: Robert Ginda <rginda@google.com>
2016-03-09Return 'component' in command JSONVitaly Buka
BUG: 26730593 Change-Id: I7661511669de35ff0e67d1da06fbd5ff5df510e0 Reviewed-on: https://weave-review.googlesource.com/2887 Reviewed-by: Alex Vakulenko <avakulenko@google.com>
2016-03-01Applied clang-formatVitaly Buka
git clang-format -f weave/master~100 --style=file Change-Id: I94c111e81a59172c6e1ebb5d330f2d563fe43c15 Reviewed-on: https://weave-review.googlesource.com/2795 Reviewed-by: Alex Vakulenko <avakulenko@google.com>
2016-02-24Move minimalRole constants from schema_constants.h to a local .cc fileAlex Vakulenko
These constants are not being used outside of component_manager_impl.cc and they will be used for both command and state attributes, so the namespaces for the constants are no longer applicable either. BUG:24622262 Change-Id: I178c07cca7d4620d0eb0aad3f54d2428a09d01e8 Reviewed-on: https://weave-review.googlesource.com/2719 Reviewed-by: Alex Vakulenko <avakulenko@google.com>
2016-02-23Move mock_component_manager.h into test/ dirVitaly Buka
Change-Id: I4c3f95174a7fa83d9fc04fc75a89e4f908bb615a Reviewed-on: https://weave-review.googlesource.com/2707 Reviewed-by: Alex Vakulenko <avakulenko@google.com>
2016-02-02Periodicly clean up command queue and remove old processed commandsAlex Vakulenko
Do periodic command queue cleanup to reclaim memory from commands that have been in terminal state for certain period of time (5 mins). Change-Id: Ief9cdbf023a222412c296644c9e927c4be000024 Reviewed-on: https://weave-review.googlesource.com/2434 Reviewed-by: Alex Vakulenko <avakulenko@google.com>
2016-02-01Rename CommandQueue::DelayedRemove into RemoveLater()Alex Vakulenko
Changed the method name to be more consistent with similar primitives of base/ (e.g. MessageLoop::DeleteSoon). Change-Id: I4038e3a77c014e0adf83a44baf770c834246b5a1 Reviewed-on: https://weave-review.googlesource.com/2429 Reviewed-by: Vitaly Buka <vitalybuka@google.com>
2016-02-01Fix memory leak when removing CommandInstance from CommandQueueAlex Vakulenko
The observers for CommandInstance were forcefully cleared in CommandInstance::DetachFromQueue which caused failure of invoking CommandInstance::Observer::OnCommandDestroyed() and, as a result, CloudCommandProxy::OnCommandDestroyed was not called which caused leaking CloudCommandProxy object instance. BUG: 25707196 Change-Id: I119a67efce4968ffaa528632e77045265b8e8f2b Reviewed-on: https://weave-review.googlesource.com/2428 Reviewed-by: Vitaly Buka <vitalybuka@google.com>
2016-02-01Add a unit tests for deleting CloudCommandProxy along with CommandInstanceAlex Vakulenko
When CommandInstance is deleted, it should trigger destruction of associated CloudCommandProxy. Add a unit test to confirm this is the case. BUG: 25707196 Change-Id: I95cadf60e99302d236f1bc67782b7315efcec6d6 Reviewed-on: https://weave-review.googlesource.com/2427 Reviewed-by: Vitaly Buka <vitalybuka@google.com>
2016-01-22AddTo will return AddToTypeProxy for convenienceVitaly Buka
Change-Id: If86496af0c68af31a3e0c618b0fae861975a4ebf Reviewed-on: https://weave-review.googlesource.com/2321 Reviewed-by: Vitaly Buka <vitalybuka@google.com>
2016-01-22Remove domain from weave::ErrorVitaly Buka
We don't filter out errors by domain in libweave. BUG:26071451 Change-Id: I2114450aca1c8ede71cc45f19bd8e71d3464cb73 Reviewed-on: https://weave-review.googlesource.com/2289 Reviewed-by: Alex Vakulenko <avakulenko@google.com>
2015-12-16ReformatVitaly Buka
Change-Id: Ia98499f9ada220151b24ecb8b60b02524d700bc4 Reviewed-on: https://weave-review.googlesource.com/1967 Reviewed-by: Vitaly Buka <vitalybuka@google.com>
2015-12-07commands: delete obsolete includeJohan Euphrosine
This was removed in https://weave-review.googlesource.com/#/c/1788/ Change-Id: I7c1165c0e003cd7bb478555ac7886ed99d320615 Reviewed-on: https://weave-review.googlesource.com/1794 Reviewed-by: Alex Vakulenko <avakulenko@google.com>
2015-12-07Switch to use ComponentManager for traits/componentsAlex Vakulenko
Removed the old StateManager, CommandManager and related classes and switched over to using ComponentManager for all device trait and component definitions as well as device state. Change-Id: I99b99a935ba217703d31aa523a3124cca0fa3e90 Reviewed-on: https://weave-review.googlesource.com/1788 Reviewed-by: Alex Vakulenko <avakulenko@google.com>
2015-12-04Add "component" property to command instanceAlex Vakulenko
When sending commands, we'll use "component" to route the command to the target component it was designated for. As a temporary stop-gap, use "device" as the component name before we have full implementation of component/trait schema model. Also removed CommandDictionary from CommandInstance::FromJson since the validation will be done outside of JSON parsing code in the future Component Manager class. BUG: 25841719 Change-Id: I5c649c257fb48ecaaedc1ced84931009f94c2bb3 Reviewed-on: https://weave-review.googlesource.com/1764 Reviewed-by: Vitaly Buka <vitalybuka@google.com>
2015-12-02commands: fix unused-function warningJohan Euphrosine
Change-Id: I3227a7245ebb8eede99b5469f3aa0cffaafe9450 Reviewed-on: https://weave-review.googlesource.com/1732 Reviewed-by: Alex Vakulenko <avakulenko@google.com>
2015-12-01Remove CommandDefinition classAlex Vakulenko
In preparation for traits support, remove CommandDefinition class and incorporate the missing functionality into CommandDictionary. BUG: 25841719 Change-Id: Iead48aa0503e9de6061c4c1588b0b930dd82c8d0 Reviewed-on: https://weave-review.googlesource.com/1680 Reviewed-by: Alex Vakulenko <avakulenko@google.com>
2015-11-25Fix GCC 4.7 errorsVitaly Buka
GCC 4.7.2 fail overriding constructors defined with virtual and default. Debian build also fails linking without -lrt. INT64_C is not defined on Debian with 4.7.2. "ll" should be enough. Change-Id: Ia779f094ed64fc3b1941429485e81520d017c2f5 Reviewed-on: https://weave-review.googlesource.com/1671 Reviewed-by: Alex Vakulenko <avakulenko@google.com>
2015-11-25Replace Get* methods returning unique_ptr with reference alternativeVitaly Buka
Existing code created temporarily objects and returned them to the client. It was not efficient and error-prone as client code could retrieve pointers to internal objects without keeping unique_ptr alive. Change-Id: I9e17c8d9f66dfc9f52ce9ffc9a31992b16b00461 Reviewed-on: https://weave-review.googlesource.com/1672 Reviewed-by: Alex Vakulenko <avakulenko@google.com>
2015-11-25Remove object schema type systemAlex Vakulenko
Since libweave no longer semantically parses command/state definitions and validates commands and states, there is no need for this extra code. BUG: 25841230 Change-Id: I53dfab20db8c97b621c07fe234a7b3c6da7325bb Reviewed-on: https://weave-review.googlesource.com/1660 Reviewed-by: Vitaly Buka <vitalybuka@google.com>
2015-11-24Support GCC 4.7Vitaly Buka
Removed constructors inheritance. Removed emplace use. Change-Id: I45224e3232d39ff22f758c7e387be2c9aff5eae0 Reviewed-on: https://weave-review.googlesource.com/1606 Reviewed-by: Vitaly Buka <vitalybuka@google.com>
2015-11-24Remove object schema parsing in CommandDefinitionAlex Vakulenko
The only thing we now care about in CommandDefinition is the "minimalRole" field. Everything else is a black-box which we just forward to the server without any semantic parsing. Also completely removed command visibility support since it no longer applies to trait/component model. BUG: 25841230 Change-Id: Ie8fff57ffada289caa7876c2a53150bb116fd65b Reviewed-on: https://weave-review.googlesource.com/1617 Reviewed-by: Vitaly Buka <vitalybuka@google.com>
2015-11-23Remove schema validation from command parameters/returnsAlex Vakulenko
Do not use ObjectSchema and instead pass parameters, progress and return values as opaque JSON objects. BUG: 25841230 Change-Id: I0ea5fc31d526b1e5d6c66453b613e7284aa3fcac Reviewed-on: https://weave-review.googlesource.com/1611 Reviewed-by: Vitaly Buka <vitalybuka@google.com>
2015-11-04Include cmath, needed for FP std::abs.Taral Joglekar
Change-Id: I0275b8090c96a2762597c62ecfd9dd422fd731a7 Reviewed-on: https://weave-review.googlesource.com/1470 Reviewed-by: Vitaly Buka <vitalybuka@google.com>
2015-11-02Remove unused constantVitaly Buka
Change-Id: Ife62ee96608a76f70d7118d6cd2de92d45988708 Reviewed-on: https://weave-review.googlesource.com/1443 Reviewed-by: Vitaly Buka <vitalybuka@google.com> Reviewed-by: Alex Vakulenko <avakulenko@google.com>
2015-11-02Remove the unneeded libweave directoryPaul Westbrook
Change-Id: I30fd8c5626cf83da6415ffa14a2019ef43be9916 Reviewed-on: https://weave-review.googlesource.com/1450 Reviewed-by: Paul Westbrook <pwestbro@google.com>