Class: RubDev::Monitor

Inherits:
Object
  • Object
show all
Defined in:
lib/rubdev/monitor.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



45
46
47
48
49
# File 'lib/rubdev/monitor.rb', line 45

def from_netlink (context, name)
  self.allocate.tap {|i|
    i.instance_variable_set(:@pointer, RubDev::C.udev_monitor_new_from_netlink(context.to_c, name))
  }
end

.from_socket(context, path) ⇒ Object



51
52
53
54
55
# File 'lib/rubdev/monitor.rb', line 51

def from_socket (context, path)
  self.allocate.tap {|i|
    i.instance_variable_set(:@pointer, RubDev::C.udev_monitor_new_from_socket(context.to_c, path))
  }
end

Instance Method Details

#buffer_size=(size) ⇒ Object



62
63
64
65
# File 'lib/rubdev/monitor.rb', line 62

def buffer_size= (size)
  return false unless size.is_a?(Integer)
  RubDev::C.udev_monitor_set_receive_buffer_size(@pointer, size)
end

#contextObject



36
37
38
39
40
# File 'lib/rubdev/monitor.rb', line 36

def context
  Context.allocate.tap {|i|
    i.instance_variable_set(:@pointer, RubDev::C.udev_monitor_get_udev(@pointer))
  }
end

#enable_receivingObject



58
59
60
# File 'lib/rubdev/monitor.rb', line 58

def enable_receiving
  RubDev::C.udev_monitor_enable_receiving(@pointer)
end

#fdObject



67
68
69
# File 'lib/rubdev/monitor.rb', line 67

def fd
  RubDev::C.udev_monitor_get_fd(@pointer)
end

#filter_add_match_subsystem_devtype(subsystem, devtype = nil) ⇒ Object



77
78
79
# File 'lib/rubdev/monitor.rb', line 77

def filter_add_match_subsystem_devtype (subsystem, devtype=nil)
  RubDev::C.udev_monitor_filter_add_match_subsystem_devtype(@pointer, subsystem, devtype)
end

#filter_add_match_tag(tag) ⇒ Object



81
82
83
# File 'lib/rubdev/monitor.rb', line 81

def filter_add_match_tag (tag)
  RubDev::C.udev_monitor_filter_add_match_tag(@pointer, tag)
end

#filter_removeObject



89
90
91
# File 'lib/rubdev/monitor.rb', line 89

def filter_remove
  RubDev::C.udev_monitor_filter_remove(@pointer)
end

#filter_updateObject



85
86
87
# File 'lib/rubdev/monitor.rb', line 85

def filter_update
  RubDev::C.udev_monitor_filter_update(@pointer)
end

#receive_deviceObject



71
72
73
74
75
# File 'lib/rubdev/monitor.rb', line 71

def receive_device
  Device.allocate.tap {|i|
    i.instance_variable_set(:@pointer, RubDev::C.udev_monitor_receive_device(@pointer))
  }
end

#refObject



26
27
28
29
# File 'lib/rubdev/monitor.rb', line 26

def ref
  RubDev::C.udev_monitor_ref(@pointer)
  self
end

#to_ioObject



93
94
95
# File 'lib/rubdev/monitor.rb', line 93

def to_io
  IO.for_fd(fd)
end

#unrefObject



31
32
33
34
# File 'lib/rubdev/monitor.rb', line 31

def unref
  RubDev::C.udev_monitor_unref(@pointer)
  self
end