mitchellh / virtualbox

[ABANDONED] Create and modify virtual machines in VirtualBox using pure ruby.
http://mitchellh.github.com/virtualbox/
MIT License
244 stars 45 forks source link

monitorGuest / EventSource support #66

Open hh opened 13 years ago

hh commented 13 years ago

This looks nice:

def monitorSource(ctx, es, active, dur):
  def handleEventImpl(ev):
    type = ev.type
    print "got event: %s %s" %(str(type), asEnumElem(ctx, 'VBoxEventType', type))
    if type == ctx['global'].constants.VBoxEventType_OnMachineStateChanged:

http://www.virtualbox.org/browser/trunk/src/VBox/Frontends/VBoxShell/vboxshell.py#L312

And would allow for monitorGuestCmd, monitorGuestKbdCmd, monitorGuestMouseCmd, monitorVBoxCmd, and probably recordDemo.

def monitorGuestCmd(ctx, args):
def monitorGuestKbdCmd(ctx, args):
def monitorVBoxCmd(ctx, args):
def recordDemo(ctx, console, file, dur):
def playbackDemo(ctx, console, file, dur):

http://www.virtualbox.org/browser/trunk/src/VBox/Frontends/VBoxShell/vboxshell.py#L383

I suspect it means implementing an event listener, but I still haven't wrapped my head how the current code works.

hh commented 13 years ago

Looks like we need Support for EventSource:

https://github.com/mitchellh/virtualbox/blob/master/lib/virtualbox/com/interface/4.1.x/EventSource.rb#L6

http://www.virtualbox.org/sdkref/interface_i_event_source.html