Module: Guide
- Defined in:
- guides/sample_socket.rb,
guides/sample_transaction.rb,
guides/sample_input_output.rb,
guides/sample_network_gprs.rb,
guides/sample_message_iso8583.rb,
guides/sample_read_magnect_card.rb,
guides/sample_transaction_iso8583.rb,
guides/sample_transaction_download_file.rb,
guides/sample_transaction_download_application.rb,
guides/sample_transaction_download_parameter_file.rb
Defined Under Namespace
Classes: TransactMessage
Instance Method Summary collapse
-
#test_input_output ⇒ Object
Input Output Test.
- #test_message_iso ⇒ Object
- #test_read_magnect_card ⇒ Object
-
#test_sample_network_attach ⇒ Object
Sample Device::Network Attach on GPRS.
- #test_sample_network_disconnect ⇒ Object
- #test_sample_network_ping ⇒ Object
-
#test_sample_socket ⇒ Object
Sample Socket Create socket, same syntax as default ruby standard library.
- #test_sample_transaction_download_application ⇒ Object
- #test_sample_walk_socket ⇒ Object
- #test_transaction_data ⇒ Object
- #test_transaction_download_and_parse_parameter_file ⇒ Object
- #test_transaction_download_file ⇒ Object
- #test_transaction_download_parameter_file ⇒ Object
- #test_transaction_emv ⇒ Object
- #test_transaction_iso8583 ⇒ Object
Instance Method Details
#test_input_output ⇒ Object
Input Output Test
3 4 5 6 7 8 9 10 11 12 13 |
# File 'guides/sample_input_output.rb', line 3 def test_input_output # Behaviour similar as c ruby # Device::IO.puts same as Kerne.puts(string, row=nil, column=nil) # puts is like a print + "\n" Device::IO.puts "Display at row 0 column 0", 0, 0 puts "Pressed any key: ", 1 # Wait for some key key = Device::IO.getc # Print key pressed print "key Pressed #{key}" end |
#test_message_iso ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'guides/sample_message_iso8583.rb', line 2 def = Device::Transaction::Iso.new .mti = 1110 [2] = 474747474747 ["Processing Code"] = "123456" pan = ["Primary Account Number (PAN)"] puts .pan puts .to_b puts .to_s end |
#test_read_magnect_card ⇒ Object
2 3 4 5 6 |
# File 'guides/sample_read_magnect_card.rb', line 2 def test_read_magnect_card puts "Pass Card..." card = Device::IO.read_card(5000) puts "Track1 #{card[:track1]} Track2:#{card[:track2]} Track3:#{card[:track2]}" end |
#test_sample_network_attach ⇒ Object
Sample Device::Network Attach on GPRS
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'guides/sample_network_gprs.rb', line 4 def test_sample_network_attach # Initialize hardware with configurations Device::Network.init(:gprs, apn: 'claro.com.br', user: 'claro.com.br', pass: 'claro.com.br') # Start Attaching process Device::Network.connect # Attaching process is unblocking, for this sample let's wait until return something iRet = 1 while(iRet == 1) iRet = Device::Network.connected? end end |
#test_sample_network_disconnect ⇒ Object
22 23 24 25 |
# File 'guides/sample_network_gprs.rb', line 22 def test_sample_network_disconnect test_sample_network_attach puts "Disconnect #{Device::Network.disconnect}" end |
#test_sample_network_ping ⇒ Object
17 18 19 20 |
# File 'guides/sample_network_gprs.rb', line 17 def test_sample_network_ping test_sample_network_attach Device::Network.ping("cloudwalk.io", 8000) end |
#test_sample_socket ⇒ Object
Sample Socket Create socket, same syntax as default ruby standard library
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'guides/sample_socket.rb', line 4 def test_sample_socket # Call test_sample_network to attach on GPRS test_sample_network_attach # Create TCPSocket tcp = TCPSocket.new('cloudwalk.io', 80) # print TCPSocket object puts tcp.inspect # Send and Recv some data puts tcp.send('303132', 0) puts "Recv #{tcp.recv(10)} " puts "Closed? #{tcp.closed?}" puts "Close #{tcp.close} " puts "Closed? #{tcp.closed?}" end |
#test_sample_transaction_download_application ⇒ Object
2 3 4 5 6 7 |
# File 'guides/sample_transaction_download_application.rb', line 2 def test_sample_transaction_download_application tcp = test_sample_walk_socket if Device::Transaction::Download.request_file("show.rb", "show.mrb") load "show.mrb" end end |
#test_sample_walk_socket ⇒ Object
21 22 23 24 25 26 27 |
# File 'guides/sample_socket.rb', line 21 def test_sample_walk_socket # Call test_sample_network to attach on GPRS test_sample_network_attach # Specific Walk Socket to transact in CloudWalk structure Device::Network.walk_socket end |
#test_transaction_data ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'guides/sample_transaction.rb', line 2 def test_transaction_data # Open CloudWalk socket socket = test_sample_walk_socket # Send any data for registered server in that app socket.send("data\n") # Receive some data from server puts "Recv Registered Server for this app: #{socket.recv(10).unpack("H*")}" socket.close Device::Network.disconnect end |
#test_transaction_download_and_parse_parameter_file ⇒ Object
11 12 13 14 15 16 17 |
# File 'guides/sample_transaction_download_parameter_file.rb', line 11 def test_transaction_download_and_parse_parameter_file apps = test_transaction_download_parameter_file apps.split(";").each do |line| app = line.split(",") puts "Name: #{app[0]}, Ruby File: #{app[1]} Aparece no menu: #{app[2]} CRC: #{app[3]}" end end |
#test_transaction_download_file ⇒ Object
2 3 4 5 |
# File 'guides/sample_transaction_download_file.rb', line 2 def test_transaction_download_file test_sample_network_attach Device::Transaction::Download.request_file("remote_image_path.jpg", "local_image_path.jpg") end |
#test_transaction_download_parameter_file ⇒ Object
2 3 4 5 6 7 8 9 |
# File 'guides/sample_transaction_download_parameter_file.rb', line 2 def test_transaction_download_parameter_file tcp = test_sample_walk_socket if Device::Transaction::Download.request_param_file file = FileDb.open("params.dat") puts file.keys file.apps_list end end |
#test_transaction_emv ⇒ Object
20 21 22 |
# File 'guides/sample_transaction.rb', line 20 def test_transaction_emv # peding test sample end |
#test_transaction_iso8583 ⇒ Object
16 17 18 |
# File 'guides/sample_transaction.rb', line 16 def test_transaction_iso8583 # peding test sample end |