Skip to content

Instantly share code, notes, and snippets.

@gucchan22
Last active May 17, 2016 11:40
Show Gist options
  • Save gucchan22/84e4283eb184183bd94a3bb16bfb70fb to your computer and use it in GitHub Desktop.
Save gucchan22/84e4283eb184183bd94a3bb16bfb70fb to your computer and use it in GitHub Desktop.
#-*- coding:utf-8 -*-
require "pasori"
def getStudentNo(pasori)
begin
sleep(2)
timeout(5, ReadTimeout) do
pasori.felica_polling(-31279) {|felica|
felica_area = felica.service[9]
stNo = felica.read(felica_area, 1, 0)[0..7]
return stNo
}
end
end
end
Pasori.open {|pasori|
loop do
student_id = getStudentNo(pasori).chomp.encode("utf-8")
puts "STUDENT ID: #{student_id}"
end
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment