hybridgroup-mindset 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mindset.rb +7 -14
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8c10cbded9460ae81e362a1c41d7e2a879f05b0
|
4
|
+
data.tar.gz: 4e007392957355e50e3de8e9e56fccbf6774f85a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 39d3cc7209b67b4e8172ae07e20cc387985f77a4537a1666953e2f0ce6566120dae7945d0d03f6f89208f3606d87b96e07fccf1ba5dae70e054f38e151ff0b47
|
7
|
+
data.tar.gz: 1b58c80d436edd8b46721e392d02cf8b5e96525af6f6aba04ae7548d077dc0f785ea9d45f3d5ef7e427dd5ebf4eebd721c33e7384caad38da39d92c68b1ee237
|
data/lib/mindset.rb
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# Ruby module for reading data from a Neurosky Mindset.
|
3
|
-
# (c) Copyright 2013 mkfs@github http://github.com/mkfs/mindset
|
3
|
+
# (c) Copyright 2013 mkfs@github http://github.com/mkfs/mindset
|
4
4
|
# License: BSD http://www.freebsd.org/copyright/freebsd-license.html
|
5
5
|
|
6
|
-
require 'rubygems'
|
6
|
+
require 'rubygems'
|
7
7
|
require 'json/ext'
|
8
|
+
require 'rubyserial'
|
8
9
|
|
9
10
|
# ----------------------------------------------------------------------
|
10
11
|
module Mindset
|
11
12
|
|
12
13
|
=begin rdoc
|
13
|
-
Collection of captured Packet objects. Packets are collected by type. The
|
14
|
+
Collection of captured Packet objects. Packets are collected by type. The
|
14
15
|
start and end timestamps are saved.
|
15
16
|
=end
|
16
17
|
class PacketStore < Hash
|
@@ -141,7 +142,7 @@ packet.
|
|
141
142
|
|
142
143
|
# ----------------------------------------------------------------------
|
143
144
|
=begin rdoc
|
144
|
-
A connection to a Mindset device. This wraps the
|
145
|
+
A connection to a Mindset device. This wraps the Serial connection to the
|
145
146
|
device. Device must already be paired and have a serial bluetooth connection
|
146
147
|
established.
|
147
148
|
=end
|
@@ -156,7 +157,7 @@ established.
|
|
156
157
|
if device.is_a?(String)
|
157
158
|
initialize_serialport device
|
158
159
|
elsif device.nil?
|
159
|
-
initialize_serialport SERIAL_PORT
|
160
|
+
initialize_serialport SERIAL_PORT
|
160
161
|
else
|
161
162
|
@sp = device
|
162
163
|
end
|
@@ -166,15 +167,7 @@ established.
|
|
166
167
|
|
167
168
|
|
168
169
|
def initialize_serialport dev
|
169
|
-
|
170
|
-
@sp = SerialPort.new dev, BAUD_RATE, 8, 1, SerialPort::NONE
|
171
|
-
if is_windows?
|
172
|
-
@sp.read_timeout=1000
|
173
|
-
@sp.write_timeout=0
|
174
|
-
@sp.initial_byte_offset=5
|
175
|
-
end
|
176
|
-
rescue LoadError
|
177
|
-
puts "Please 'gem install hybridgroup-serialport' for serial port support."
|
170
|
+
@sp = Serial.new dev, BAUD_RATE
|
178
171
|
end
|
179
172
|
|
180
173
|
=begin rdoc
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hybridgroup-mindset
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mkfs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04
|
12
|
-
dependencies:
|
11
|
+
date: 2014-07-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubyserial
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.1'
|
13
27
|
description: "This module reads all data transmitted by a Neurosky\nMindset, which
|
14
28
|
must already be paired in Bluetooth and have a Bluetooth serial\n(SPP) socket open.
|
15
29
|
The gem provides the module and a command line utility for\nreading packets and
|