Created
November 1, 2010 21:55
-
-
Save anonymous/658942 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The class to parse all of the BNCS packets | |
class BncsHandler | |
def initialize(client, packet) | |
@client, @packet, @unpacked = client, packet, packet.unpack("C*") | |
end | |
def handle | |
command = @unpacked[1] | |
log "S->C packet 0x#{"%02X" % command}" | |
log @packet.hexdump | |
case command | |
when 0x25 then pong(@packet) | |
when 0x50 then check_revision(@packet) | |
end | |
end | |
protected | |
def log(text) | |
puts "#{text}" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment