Class: Botvac::Robot

Inherits:
Object
  • Object
show all
Defined in:
lib/botvac/robot.rb

Defined Under Namespace

Classes: Hmac

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(serial, secret) ⇒ Robot

Returns a new instance of Robot.



10
11
12
13
# File 'lib/botvac/robot.rb', line 10

def initialize(serial, secret)
  self.serial  = serial
  self.secret  = secret
end

Instance Attribute Details

#secretObject

Returns the value of attribute secret.



8
9
10
# File 'lib/botvac/robot.rb', line 8

def secret
  @secret
end

#serialObject

Returns the value of attribute serial.



8
9
10
# File 'lib/botvac/robot.rb', line 8

def serial
  @serial
end

Instance Method Details

#disable_scheduleObject



49
50
51
# File 'lib/botvac/robot.rb', line 49

def disable_schedule
  connection.post("messages", JSON.dump({ reqId: "1", cmd: "disableSchedule"})).body
end

#enable_scheduleObject



45
46
47
# File 'lib/botvac/robot.rb', line 45

def enable_schedule
  connection.post("messages", JSON.dump({ reqId: "1", cmd: "enableSchedule" })).body
end

#get_robot_stateObject



41
42
43
# File 'lib/botvac/robot.rb', line 41

def get_robot_state
  connection.post("messages", JSON.dump({ reqId: "1", cmd: "getRobotState" })).body
end

#get_scheduleObject



53
54
55
# File 'lib/botvac/robot.rb', line 53

def get_schedule
  connection.post("messages", JSON.dump({ reqId: "1", cmd: "getSchedule" })).body
end

#pause_cleaningObject



29
30
31
# File 'lib/botvac/robot.rb', line 29

def pause_cleaning
  connection.post("messages", JSON.dump({ reqId: "1",cmd: "pauseCleaning" })).body
end

#send_to_baseObject



37
38
39
# File 'lib/botvac/robot.rb', line 37

def send_to_base
  connection.post("messages", JSON.dump({ reqId: "1",cmd: "sendToBase" })).body
end

#start_cleaningObject



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/botvac/robot.rb', line 15

def start_cleaning
  connection.post("messages", JSON.dump(
    {
      reqId: "1",
      cmd: "startCleaning",
      params: {
        category: 2,
        mode: 2,
        modifier: 2
      }
    }
  )).body
end

#stop_cleaningObject



33
34
35
# File 'lib/botvac/robot.rb', line 33

def stop_cleaning
  connection.post("messages", JSON.dump({ reqId: "1",cmd: "stopCleaning" })).body
end