Skip to content

Commit

Permalink
[connman-qt] Added connecting and lastConnectError service properties…
Browse files Browse the repository at this point in the history
…. Related to JB#38719

connecting becomes true (and lastConnectError becomes empty) when
requestConnect() is called, and connecting stays true while the
Connect call is pending and/or the service is in one of the
transient states. If the call fails, lastConnectError is set.
  • Loading branch information
monich committed Jun 29, 2017
1 parent 1873085 commit 2b7881a
Show file tree
Hide file tree
Showing 4 changed files with 523 additions and 181 deletions.
38 changes: 35 additions & 3 deletions libconnman-qt/commondbustypes.cpp
@@ -1,13 +1,45 @@
/*
* Copyright © 2010, Intel Corporation.
* Copyright © 2010 Intel Corporation.
* Copyright © 2012-2017 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* This program is licensed under the terms and conditions of the
* Apache License, version 2.0. The full text of the Apache License is at
* http://www.apache.org/licenses/LICENSE-2.0
*
*/

#include "commondbustypes.h"
#include "libconnman_p.h"

#define CONNMAN_ERROR "net.connman.Error"

const QString ConnmanError::Failed(CONNMAN_ERROR ".Failed");
const QString ConnmanError::InvalidArguments(CONNMAN_ERROR ".InvalidArguments");
const QString ConnmanError::PermissionDenied(CONNMAN_ERROR ".PermissionDenied");
const QString ConnmanError::PassphraseRequired(CONNMAN_ERROR ".PassphraseRequired");
const QString ConnmanError::NotRegistered(CONNMAN_ERROR ".NotRegistered");
const QString ConnmanError::NotUnique(CONNMAN_ERROR ".NotUnique");
const QString ConnmanError::NotSupported(CONNMAN_ERROR ".NotSupported");
const QString ConnmanError::NotImplemented(CONNMAN_ERROR ".NotImplemented");
const QString ConnmanError::NotFound(CONNMAN_ERROR ".NotFound");
const QString ConnmanError::NoCarrier(CONNMAN_ERROR ".NoCarrier");
const QString ConnmanError::InProgress(CONNMAN_ERROR ".InProgress");
const QString ConnmanError::AlreadyExists(CONNMAN_ERROR ".AlreadyExists");
const QString ConnmanError::AlreadyEnabled(CONNMAN_ERROR ".AlreadyEnabled");
const QString ConnmanError::AlreadyDisabled(CONNMAN_ERROR ".AlreadyDisabled");
const QString ConnmanError::AlreadyConnected(CONNMAN_ERROR ".AlreadyConnected");
const QString ConnmanError::NotConnected(CONNMAN_ERROR ".NotConnected");
const QString ConnmanError::OperationAborted(CONNMAN_ERROR ".OperationAborted");
const QString ConnmanError::OperationTimeout(CONNMAN_ERROR ".OperationTimeout");
const QString ConnmanError::InvalidService(CONNMAN_ERROR ".InvalidService");
const QString ConnmanError::InvalidProperty(CONNMAN_ERROR ".InvalidProperty");

const QString ConnmanState::Idle("idle");
const QString ConnmanState::Association("association");
const QString ConnmanState::Configuration("configuration");
const QString ConnmanState::Ready("ready");
const QString ConnmanState::Online("online");
const QString ConnmanState::Disconnect("disconnect");
const QString ConnmanState::Failure("failure");

// Marshall the ConnmanObject data into a D-Bus argument
QDBusArgument &operator<<(QDBusArgument &argument, const ConnmanObject &obj)
Expand Down
40 changes: 40 additions & 0 deletions libconnman-qt/libconnman_p.h
Expand Up @@ -15,6 +15,46 @@
#define CONNMAN_BUS QDBusConnection::systemBus()
#define CONNMAN_SERVICE QLatin1String("net.connman")

class ConnmanError {
public:
static const QString Failed;
static const QString InvalidArguments;
static const QString PermissionDenied;
static const QString PassphraseRequired;
static const QString NotRegistered;
static const QString NotUnique;
static const QString NotSupported;
static const QString NotImplemented;
static const QString NotFound;
static const QString NoCarrier;
static const QString InProgress;
static const QString AlreadyExists;
static const QString AlreadyEnabled;
static const QString AlreadyDisabled;
static const QString AlreadyConnected;
static const QString NotConnected;
static const QString OperationAborted;
static const QString OperationTimeout;
static const QString InvalidService;
static const QString InvalidProperty;
};

class ConnmanState {
public:
static const QString Idle;
static const QString Association;
static const QString Configuration;
static const QString Ready;
static const QString Online;
static const QString Disconnect;
static const QString Failure;

static inline bool connecting(QString state)
{ return (state == Association || state == Configuration); }
static inline bool connected(QString state)
{ return (state == Online || state == Ready); }
};

#ifndef CONNMAN_DEBUG
# define CONNMAN_DEBUG 0
#endif // CONNMAN_DEBUG
Expand Down

0 comments on commit 2b7881a

Please sign in to comment.