Browse Source

device: add 'allowed' cache flag

bboozzoo/dbus-support-interfaces
Maciek Borzecki 8 years ago
parent
commit
936886f17d
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      src/mconnect/device.vala

+ 3
- 0
src/mconnect/device.vala View File

@ -41,6 +41,7 @@ class Device : Object {
[DBus (visible = false)] [DBus (visible = false)]
public InetAddress host { get; private set; default = null; } public InetAddress host { get; private set; default = null; }
public bool is_paired { get; private set; default = false; } public bool is_paired { get; private set; default = false; }
public bool allowed {get; set; default = false; }
// set to true if pair request was sent // set to true if pair request was sent
private bool _pair_in_progress = false; private bool _pair_in_progress = false;
@ -91,6 +92,7 @@ class Device : Object {
dev.tcp_port = (uint) cache.get_integer(name, "tcpPort"); dev.tcp_port = (uint) cache.get_integer(name, "tcpPort");
var last_ip_str = cache.get_string(name, "lastIPAddress"); var last_ip_str = cache.get_string(name, "lastIPAddress");
debug("last known address: %s:%u", last_ip_str, dev.tcp_port); debug("last known address: %s:%u", last_ip_str, dev.tcp_port);
dev.allowed = cache.get_boolean(name, "allowed");
var host = new InetAddress.from_string(last_ip_str); var host = new InetAddress.from_string(last_ip_str);
if (host == null) { if (host == null) {
@ -139,6 +141,7 @@ class Device : Object {
cache.set_integer(name, "protocolVersion", (int) this.protocol_version); cache.set_integer(name, "protocolVersion", (int) this.protocol_version);
cache.set_integer(name, "tcpPort", (int) this.tcp_port); cache.set_integer(name, "tcpPort", (int) this.tcp_port);
cache.set_string(name, "lastIPAddress", this.host.to_string()); cache.set_string(name, "lastIPAddress", this.host.to_string());
cache.set_boolean(name, "allowed", this.allowed);
} }
private async void greet() { private async void greet() {


Loading…
Cancel
Save