turtleshell 1.0.4 → 1.0.5
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -2
- data/ext/librtlsdr/librtlsdr.c +21 -1
- data/lib/turtleshell/device.rb +5 -0
- data/turtleshell.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0866f748e24f3efdb6c4a1bb490f5664de5f97b1
|
4
|
+
data.tar.gz: 1882e6475159941b9cf423d3c54c8d30d2419d50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9647e4773ebabe4517600c124f06815ea3e1cb6029f35a7a63d5b314d2976072af8f9c435eb4346d9b69c40765b716fe6560453dfb491a2cae3120b6860b4183
|
7
|
+
data.tar.gz: 645b2dd39e02d7440996f41d8313a8cb6ff48f3953d2ad84b0bc6eda5d4a86cd325651be61409cca1bbc91b2a1dca7450b4871a3a4e90ae1d360cc82b7c929f6
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
|
+
### 1.0.5 (2014-12-29)
|
2
|
+
|
3
|
+
* Added `#get_available_gains` -- lists gain values the device allows
|
4
|
+
|
1
5
|
### 1.0.0 (2013-12-28)
|
2
6
|
|
3
7
|
* Added sample rate, gain, center frequency getters / setters
|
4
|
-
* Added
|
5
|
-
* Added
|
8
|
+
* Added `#read_samples` method to read syncronously from the device
|
9
|
+
* Added `#read_samples_async` to read asyncronously
|
data/ext/librtlsdr/librtlsdr.c
CHANGED
@@ -114,7 +114,7 @@ static void turtleshell_callback(unsigned char *buffer, uint32_t length, void *c
|
|
114
114
|
|
115
115
|
if (!unwrapped_context.callback || !unwrapped_context.device) {
|
116
116
|
printf("unexpected error: could not read callback / device from unwrapped context\n");
|
117
|
-
|
117
|
+
return;
|
118
118
|
}
|
119
119
|
|
120
120
|
device = unwrapped_context.device;
|
@@ -205,6 +205,25 @@ static VALUE turtleshell_set_gain(VALUE self, VALUE wrapped_device, VALUE value)
|
|
205
205
|
return Qnil;
|
206
206
|
}
|
207
207
|
|
208
|
+
static VALUE turtleshell_get_gains(VALUE self, VALUE wrapped_device) {
|
209
|
+
int *gains = NULL;
|
210
|
+
int length, i;
|
211
|
+
rtlsdr_dev_t *device;
|
212
|
+
VALUE buffer = rb_ary_new();
|
213
|
+
Data_Get_Struct(wrapped_device, rtlsdr_dev_t, device);
|
214
|
+
|
215
|
+
length = rtlsdr_get_tuner_gains(device, NULL);
|
216
|
+
gains = malloc(sizeof(int) * length);
|
217
|
+
rtlsdr_get_tuner_gains(device, gains);
|
218
|
+
|
219
|
+
for (i = 0; i < length; ++i) {
|
220
|
+
rb_ary_push(buffer, INT2NUM(gains[i]));
|
221
|
+
}
|
222
|
+
|
223
|
+
free(gains);
|
224
|
+
return buffer;
|
225
|
+
}
|
226
|
+
|
208
227
|
void Init_librtlsdr() {
|
209
228
|
m_turtleshell = rb_define_module("TurtleShell");
|
210
229
|
m_rtlsdr = rb_define_module_under(m_turtleshell, "RTLSDR");
|
@@ -230,4 +249,5 @@ void Init_librtlsdr() {
|
|
230
249
|
rb_define_module_function(m_rtlsdr, "set_center_freq", turtleshell_set_center_frequency, 2);
|
231
250
|
rb_define_module_function(m_rtlsdr, "get_gain", turtleshell_get_gain, 1);
|
232
251
|
rb_define_module_function(m_rtlsdr, "set_gain", turtleshell_set_gain, 2);
|
252
|
+
rb_define_module_function(m_rtlsdr, "get_tuner_gains", turtleshell_get_gains, 1);
|
233
253
|
}
|
data/lib/turtleshell/device.rb
CHANGED
@@ -48,6 +48,11 @@ module TurtleShell
|
|
48
48
|
TurtleShell::RTLSDR.set_gain(@device, gain)
|
49
49
|
end
|
50
50
|
|
51
|
+
# most devices only support a finite number of gain values
|
52
|
+
def get_available_gains
|
53
|
+
TurtleShell::RTLSDR.get_tuner_gains(@device)
|
54
|
+
end
|
55
|
+
|
51
56
|
# read specified number of complex samples from tuner
|
52
57
|
# real and imaginary parts are normalized between [-1, 1]
|
53
58
|
def read_samples(number_of_samples = 1024)
|
data/turtleshell.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'turtleshell'
|
3
|
-
s.version = '1.0.
|
3
|
+
s.version = '1.0.5'
|
4
4
|
s.date = '2013-11-05'
|
5
5
|
s.summary = 'A ruby wrapper for librtlsdr'
|
6
|
-
s.description = '
|
6
|
+
s.description = 'ruby bindings for librtlsdr -- realtek USB software defined radio devices'
|
7
7
|
s.authors = ['Tim Jarratt']
|
8
8
|
s.email = 'tjarratt@gmail.com'
|
9
9
|
s.files = ['lib/turtleshell.rb']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turtleshell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Jarratt
|
@@ -52,7 +52,7 @@ dependencies:
|
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.14'
|
55
|
-
description:
|
55
|
+
description: ruby bindings for librtlsdr -- realtek USB software defined radio devices
|
56
56
|
email: tjarratt@gmail.com
|
57
57
|
executables: []
|
58
58
|
extensions:
|