mfrc522uidread 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/mfrc522uidread.rb +35 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4d7c032d886fcc677aeb6d039b00e9d524c0983974a7a3a2c705c0b1a909bb77
4
+ data.tar.gz: d438a831297dda0577d645202f6e39ec0aef461eb8a9ed9b95082552782c5bb0
5
+ SHA512:
6
+ metadata.gz: f471d6e371ccc00206dc0fe22b6f4049a0dfe101d86236ea7579fd48dd6e126e78fa34e26ebd83e047b39cc1756784a9e21a48893f165984555465f1918a56d2
7
+ data.tar.gz: 9c4c9b913ffb4e89dc4af17ca0a21ca8744d0a1b93e5549a1eec143487e6b9d11dd3f85f834b284ca1e5837af100641a3bbe48c8f81a345febb86ffe9c25104c
@@ -0,0 +1,35 @@
1
+ # Archivo nueva_gema/lib/mfrc522uidread.rb
2
+ #!/usr/bin/env ruby
3
+ require 'mfrc522'
4
+ class Mfrc522uidread
5
+ #return uid in hexa str
6
+ def search_for_uid #funcion que establece comunicacion
7
+ boolTest = false
8
+ r = MFRC522.new
9
+ until boolTest == true
10
+ begin
11
+ r.picc_request(MFRC522::PICC_REQA)
12
+ uid , sak = r.picc_select #temporizador 2 segundos
13
+ return uid
14
+ boolTest = true
15
+
16
+ rescue CommunicationError => e
17
+ boolTest = false #aun no lo he leido
18
+
19
+ end
20
+ end
21
+ end
22
+ def to_hexa(uid) #transformacion del uid a hexadecimal
23
+ s = String.new
24
+ for i in 0..uid.size-1
25
+ s = s + uid[i].to_bytehex
26
+ end
27
+ return s
28
+ end
29
+ def print_uid_hexa (uid) #esta funcion printea un uid por pantalla
30
+ uidHexa = to_hexa(uid);
31
+ puts "UID (HEXADECIMAL): #{uidHexa}"
32
+
33
+ end
34
+
35
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mfrc522uidread
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Guille Cobo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-10-26 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Provide uid in hexadecimal
14
+ email:
15
+ - gucobo.cm@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/mfrc522uidread.rb
21
+ homepage:
22
+ licenses: []
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.7.3
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Library provided to read uid hexadecimal
44
+ test_files: []