Insert the description of the change. BUG: 27418257 Change-Id: I4c10da5990c1002d28cfc76133c9cec6a05601cf Reviewed-on: https://weave-review.googlesource.com/2785 Reviewed-by: Alex Vakulenko <avakulenko@google.com> Reviewed-by: Vitaly Buka <vitalybuka@google.com>
diff --git a/include/weave/provider/network.h b/include/weave/provider/network.h index 0fb147d..a73b75e 100644 --- a/include/weave/provider/network.h +++ b/include/weave/provider/network.h
@@ -14,6 +14,28 @@ namespace weave { namespace provider { +// This interface should be implemented by the user of libweave and +// provided during device creation in Device::Create(...) +// libweave will use this interface to create and interact with network +// sockets, implementing XMPP push notifications channel. +// +// There are 2 main parts of this interface. One part is used to check network +// connection status and signup for notification if connection status changes. +// Implementation of GetConnectionState() should return current network +// connection state (enum Network::State). +// Implementation of AddConnectionChangedCallback() should remember callback +// and invoke it network connection status changes. +// +// Second part of the interface is used to create new secure (SSL) socket and +// provide functionality to read/write data into sockets. +// Implementation of OpenSslSocket() should create SSL socket using whatever +// underlying mechanism is available on the current platform. It should also +// wrap read / write / disconnect functionality into Stream interface +// (include/weave/stream.h) and call OpenSslSocketCallback() callback +// with pointer to the Stream interface implementation. +// Reading data from the socket will be done through InputStream::Read() +// function. Writing to socket - through OutputStream::Write(). + // Interface with methods to detect network connectivity and opening network // connections. class Network {
diff --git a/include/weave/provider/task_runner.h b/include/weave/provider/task_runner.h index 095910b..28ad42c 100644 --- a/include/weave/provider/task_runner.h +++ b/include/weave/provider/task_runner.h
@@ -16,6 +16,27 @@ namespace weave { namespace provider { +// This interface should be implemented by the user of libweave and +// provided during device creation in Device::Create(...) +// libweave will use this interface to schedule task execution. +// +// libweave is a single threaded library that uses task scheduling (similar +// to message loop) to perform asynchronous tasks. libweave itself does not +// implement message loop, and rely on user to provide implementation +// for its platform. +// +// Implementation of PostDelayedTask(...) should add specified task (callback) +// after all current tasks in the queue with delay=0. If there are tasks in the +// queue with delay > 0, new task may be scheduled before or between existing +// tasks. Position of the new task in the queue depends on remaining delay for +// existing tasks and specified delay. Normally, new task should be scheduled +// after the last task with "remaining delay" <= "new task delay". This will +// guarantee that all tasks with delay=0 will be executed in the same order +// they are put in the task queue. +// +// If delay is specified, task should be invoked no sooner then timeout is +// reached (it might be delayed due to other tasks in the queue). + // Interface with methods to post tasks into platform-specific message loop of // the current thread. class TaskRunner {
diff --git a/include/weave/provider/wifi.h b/include/weave/provider/wifi.h index 7162084..033728f 100644 --- a/include/weave/provider/wifi.h +++ b/include/weave/provider/wifi.h
@@ -13,6 +13,34 @@ namespace weave { namespace provider { +// This interface should be implemented by the user of libweave and +// provided during device creation in Device::Create(...) +// libweave will use this interface to get WiFi capabilities and +// configure WiFi on the device. +// +// If device does not support WiFi (e.g. Ethernet device), user code +// should supply nullptr pointer for WiFi interface at the device creation +// time. +// +// Implementation of Connect(...) method should connect to specified +// WiFi access point (identified by ssid) using supplied passphrase. +// If WiFi access point allows open connection, passphrase will contain +// empty string. libweave should be notified when connection is established +// through callback invocation. +// +// Implementation of StartAccessPoint(...) should start open WiFi access point +// according to WiFi specification using specified ssid. New AP should be +// available on 2.4Ghz WiFi band, and be open (allow connection without +// passphrase). +// Implementation of StopAccessPoint() should stop previously started WiFi +// access point. +// +// Implementations of IsWifi24Supported() and IsWifi50Supported() should +// return if true if respectively 2.4Ghz and 5.0Ghz WiFi bands are supported. +// +// Implementation of GetConnectedSsid() should return SSID of the WiFi network +// device is currently connected to. + // Interface with methods to control WiFi capability of the device. class Wifi { public: