rs232 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/rs232.rb +19 -4
  2. metadata +5 -5
@@ -8,10 +8,25 @@ class RS232
8
8
 
9
9
  # serial port object constructor
10
10
  # also sets the parameters and timeout properties through an hash argument
11
+ # hash arguments options:
12
+ # :mode
13
+ # :file
14
+ # :attr
15
+ # :dcblength
16
+ # :baudrate
17
+ # :bytesize
18
+ # :stopbits
19
+ # :parity
20
+ # :delimiter
21
+ # :read_interval_timeout
22
+ # :read_total_timeout_multiplier
23
+ # :read_total_timeout_constant
24
+ # :write_total_timeout_multiplier
25
+ # :write_total_timeout_constant
11
26
  def initialize address, params = {}
12
- mode = Win32::GENERIC_READ | Win32::GENERIC_WRITE
13
- type = Win32::OPEN_EXISTING
14
- attr = Win32::FILE_ATTRIBUTE_NORMAL
27
+ mode = param[:mode] || Win32::GENERIC_READ | Win32::GENERIC_WRITE
28
+ type = param[:file] || Win32::OPEN_EXISTING
29
+ attr = param[:attr] || Win32::FILE_ATTRIBUTE_NORMAL
15
30
  @serial = Win32::CreateFileA( address, mode, 0, nil, type, attr, nil)
16
31
  @error = Win32.error_check
17
32
  puts "RS232 >> got file handle 0x%.8x for com port %s" % [@serial, address]
@@ -141,4 +156,4 @@ class RS232
141
156
  :write_total_timeout_constant, :uint32
142
157
  end
143
158
 
144
- end
159
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rs232
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-10 00:00:00.000000000 Z
12
+ date: 2012-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
16
- requirement: &22219596 !ruby/object:Gem::Requirement
16
+ requirement: &20596020 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *22219596
24
+ version_requirements: *20596020
25
25
  description: Allows to script access to the serial port on Windows. Simple read and
26
26
  write commands
27
27
  email: hugo.benichi@m4x.org
@@ -53,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
53
  version: '0'
54
54
  requirements: []
55
55
  rubyforge_project:
56
- rubygems_version: 1.8.16
56
+ rubygems_version: 1.8.11
57
57
  signing_key:
58
58
  specification_version: 3
59
59
  summary: Ruby interface to Windows Serial Port API