Automatically update devices on an interval

This commit is contained in:
Charles Magahern
2015-12-31 23:29:48 -08:00
parent e6dd661338
commit 697a7e1de9
4 changed files with 107 additions and 2 deletions
+19 -1
View File
@@ -8,7 +8,7 @@
import Foundation
class WemoDevice {
class WemoDevice: Hashable {
enum State {
case Off
case On
@@ -57,4 +57,22 @@ class WemoDevice {
self.serial = String(serial)
}
}
var hashValue: Int
{
var hash: Int = 0x0
hash ^= self.name.hash
hash ^= self.host.hash
hash ^= self.model.hash
hash ^= self.state.hashValue
hash ^= self.type.hashValue
hash ^= self.serial.hashValue
return hash
}
}
func ==(lhs: WemoDevice, rhs: WemoDevice) -> Bool
{
return (lhs.serial == rhs.serial)
}