Last active
May 17, 2016 11:40
-
-
Save gucchan22/84e4283eb184183bd94a3bb16bfb70fb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#-*- 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