fldigi 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/fldigi.rb +81 -35
  3. metadata +7 -9
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 24dfadfe3ad0ceef6d30d8956d62ef8c171018bc
4
+ data.tar.gz: eae7838de788329b4e385440d4da5a995a2232c0
5
+ SHA512:
6
+ metadata.gz: c36b7242805366e1878fa079d7fbaeca55951740999eeaa39ee694eaf6662615cc199c9909a18d23c535e68c29bf5cb7b2bd6688ef52d73a3f413ed2a2eaadcc
7
+ data.tar.gz: 3612685cde709147fbb2738f994cd7aaeb305ef253048975ea54b57a9fb7e839b4e1c4638f84b7880c9cb26e8f8bfd259490bbab0f43de2260909f49d3dbe250
@@ -24,7 +24,7 @@ require 'xmlrpc/client'
24
24
  require 'thread'
25
25
 
26
26
  class Fldigi
27
- attr_accessor :rigctl, :dial_freq, :carrier, :call, :modem, :afc, :rsid, :sideband, :squelch, :slevel, :spot, :delay, :grid, :phg, :band, :offset, :start_wait, :char_wait
27
+ attr_accessor :rigctl, :dial_freq, :carrier, :call, :modem, :afc, :rsid, :sideband, :squelch, :slevel, :spot, :delay, :grid, :phg, :band, :offset, :start_wait, :char_wait, :debug
28
28
 
29
29
  # Do the initial setup. All arguments are optional, default is
30
30
  # rigctl, localhost, standard port. If you have no rig control,
@@ -64,6 +64,7 @@ class Fldigi
64
64
  @offset_old=0
65
65
  @start_wait=10
66
66
  @char_wait=2
67
+ @debug=false
67
68
 
68
69
  # Propnet stuff.
69
70
  @band=nil
@@ -81,9 +82,15 @@ class Fldigi
81
82
  # Send an XML-RPC command to FLDigi.
82
83
  def sendcmd(cmd, param=-1)
83
84
  if param==-1
84
- return @srvr.call(cmd)
85
+ puts "sendcmd(#{cmd})" if @debug
86
+ n=@srvr.call(cmd)
87
+ puts "result: #{n}" if @debug
88
+ return n
85
89
  else
86
- return @srvr.call(cmd,param)
90
+ puts "sendcmd(#{cmd} #{param})" if @debug
91
+ n=@srvr.call(cmd,param)
92
+ puts "result: #{n}" if @debug
93
+ return n
87
94
  end
88
95
  end
89
96
 
@@ -91,6 +98,8 @@ class Fldigi
91
98
  # changed is not pushed (to save time).
92
99
  def config
93
100
 
101
+ status=true
102
+
94
103
  # Set the audio carrier, but only if it's not false (so other
95
104
  # items can be updated without worrying about a little bit of
96
105
  # drift due to AFC).
@@ -102,10 +111,9 @@ class Fldigi
102
111
  end
103
112
 
104
113
  # Set the modem. Also, take a stab at setting the timeouts for
105
- # that modem.
114
+ # that modem. ToDo: Add to these as additional modems are checked
115
+ # out, and save the user some hassle.
106
116
  if @modem!=@modem_old
107
- @modem_old=@modem
108
-
109
117
  case @modem
110
118
  when "BPSK31"
111
119
  @start_wait=5
@@ -124,32 +132,49 @@ class Fldigi
124
132
  @char_wait=2
125
133
  end
126
134
 
127
- if @modem!=self.sendcmd("modem.get_name")
135
+ if @modem==self.sendcmd("modem.get_name")
136
+ @modem_old=@modem
137
+ else
128
138
  self.sendcmd("modem.set_by_name", @modem)
129
- if @modem!=self.sendcmd("modem.get_name")
130
- return false
139
+ if @modem==self.sendcmd("modem.get_name")
140
+ @modem_old=@modem
141
+ else
142
+ puts "modem.set_name failed <-----------------------" if @debug
143
+ status=false
131
144
  end
132
145
  end
133
146
  end
134
147
 
135
148
  # Turn spot on/off (true/false).
136
149
  if @spot!=@spot_old
137
- @spot_old=@spot
138
- if @spot!=self.sendcmd("spot.get_auto")
150
+ ret=self.sendcmd("spot.get_auto")
151
+ if (ret==1 and @spot==true) or (ret==0 and @spot==false)
152
+ @spot_old=@spot
153
+ else
139
154
  self.sendcmd("spot.set_auto", @spot)
140
- if @spot!=self.sendcmd("spot.get_auto")
141
- return false
155
+ ret=self.sendcmd("spot.get_auto")
156
+ if (ret==1 and @spot==true) or (ret==0 and @spot==false)
157
+ @spot_old=@spot
158
+ else
159
+ puts "spot.set_auto failed <-----------------------" if @debug
160
+ status=false
142
161
  end
143
162
  end
144
163
  end
145
164
 
146
165
  # Turn AFC on/off (true/false).
147
166
  if @afc!=@afc_old
148
- @afc_old=@afc
149
- if @afc!=self.sendcmd("main.get_afc")
167
+ ret=self.sendcmd("main.get_afc")
168
+ if (ret==1 and @afc==true) or (ret==0 and @afc==false)
169
+ @afc_old=@afc
170
+ else
150
171
  self.sendcmd("main.set_afc", @afc)
151
- if @afc!=self.sendcmd("main.get_afc")
152
- return false
172
+ ret=self.sendcmd("main.get_afc")
173
+ if (ret==1 and @afc==true) or (ret==0 and @afc==false)
174
+ @afc_old=@afc
175
+ else
176
+ puts "main.set_afc failed <-----------------------" if @debug
177
+ status=false
153
178
  end
154
179
  end
155
180
  end
@@ -157,45 +182,65 @@ class Fldigi
157
182
  # Set the sideband ("USB"/"LSB"). ToDo: make sure this is
158
183
  # correct.
159
184
  if @sideband!=@sideband_old
160
- @sideband_old=@sideband
161
- if @sideband!=self.sendcmd("main.get_sideband")
185
+ if @sideband==self.sendcmd("main.get_sideband")
186
+ @sideband_old=@sideband
187
+ else
162
188
  self.sendcmd("main.set_sideband", @sideband)
163
- if @sideband!=self.sendcmd("main.get_sideband")
164
- return false
189
+ if @sideband==self.sendcmd("main.get_sideband")
190
+ @sideband_old=@sideband
191
+ else
192
+ puts "main.set_sideband failed <-----------------------" if @debug
193
+ status=false
165
194
  end
166
195
  end
167
196
  end
168
197
 
169
198
  # Turn RSID receive on/off (true/false).
170
199
  if @rsid!=@rsid_old
171
- @rsid_old=@rsid
172
- if @rsid!=self.sendcmd("main.get_rsid")
200
+ ret=self.sendcmd("main.get_rsid")
201
+ if (ret==1 and @rsid==true) or (ret==0 and @rsid==false)
202
+ @rsid_old=@rsid
203
+ else
173
204
  self.sendcmd("main.set_rsid", @rsid)
174
- if @rsid!=self.sendcmd("main.get_rsid")
175
- return false
205
+ ret=self.sendcmd("main.get_rsid")
206
+ if (ret==1 and @rsid==true) or (ret==0 and @rsid==false)
207
+ @rsid_old=@rsid
208
+ else
209
+ puts "main.set_rsid failed <-----------------------" if @debug
210
+ status=false
176
211
  end
177
212
  end
178
213
  end
179
214
 
180
215
  # Turn squelch on/off (true/false).
181
216
  if @squelch!=@squelch_old
182
- @squelch_old=@squelch
183
- if @squelch!=self.sendcmd("main.get_squelch")
217
+ ret=self.sendcmd("main.get_squelch")
218
+ if (ret==1 and @squelch==true) or (ret==0 and @squelch==false)
219
+ @squelch_old=@squelch
220
+ else
184
221
  self.sendcmd("main.set_squelch", @squelch)
185
- if @squelch!=self.sendcmd("main.get_squelch")
186
- return false
222
+ ret=self.sendcmd("main.get_squelch")
223
+ if (ret==1 and @squelch==true) or (ret==0 and @squelch==false)
224
+ @squelch_old=@squelch
225
+ else
226
+ puts "main.set_squelch failed <-----------------------" if @debug
227
+ status=false
187
228
  end
188
229
  end
189
230
  end
190
231
 
191
232
  # Set the squelch value (3.0 seems to work well).
192
- @slevel=@slevel.to_f
193
233
  if @slevel!=@slevel_old
194
234
  @slevel_old=@slevel
195
- if @slevel!=self.sendcmd("main.get_squelch_level")
235
+ if @slevel.to_f==self.sendcmd("main.get_squelch_level").to_f
236
+ @slevel=@slevel.to_f
237
+ else
196
238
  self.sendcmd("main.set_squelch_level", @slevel)
197
- if @slevel!=self.sendcmd("main.get_squelch_level")
198
- return false
239
+ if @slevel==self.sendcmd("main.get_squelch_level")
240
+ @slevel=@slevel.to_f
241
+ else
242
+ puts "main.set_squelch_level failed <-----------------------" if @debug
243
+ status=false
199
244
  end
200
245
  end
201
246
  end
@@ -235,12 +280,13 @@ class Fldigi
235
280
  self.sendcmd("main.set_frequency", @dial_freq+@offset.to_f)
236
281
  sleep 0.5
237
282
  if @dial_freq+@offset.to_i!=self.sendcmd("main.get_frequency").to_f
238
- return false
283
+ puts "main.set_frequency failed <-----------------------" if @debug
284
+ status=false
239
285
  end
240
286
  end
241
287
  end
242
288
 
243
- return true
289
+ return status
244
290
  end
245
291
 
246
292
  # Set FLDigi to receive (immediate).
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fldigi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
5
- prerelease:
4
+ version: 0.1.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Jeff Francis, N0GQ
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-07-16 00:00:00.000000000 Z
11
+ date: 2014-07-28 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: A library for talking to FLDigi.
15
14
  email: jeff@gritch.org
@@ -21,26 +20,25 @@ files:
21
20
  homepage: http://fldigi.gritch.org/
22
21
  licenses:
23
22
  - MIT
23
+ metadata: {}
24
24
  post_install_message:
25
25
  rdoc_options: []
26
26
  require_paths:
27
27
  - lib
28
28
  required_ruby_version: !ruby/object:Gem::Requirement
29
- none: false
30
29
  requirements:
31
- - - ! '>='
30
+ - - '>='
32
31
  - !ruby/object:Gem::Version
33
32
  version: '0'
34
33
  required_rubygems_version: !ruby/object:Gem::Requirement
35
- none: false
36
34
  requirements:
37
- - - ! '>='
35
+ - - '>='
38
36
  - !ruby/object:Gem::Version
39
37
  version: '0'
40
38
  requirements: []
41
39
  rubyforge_project:
42
- rubygems_version: 1.8.23
40
+ rubygems_version: 2.0.14
43
41
  signing_key:
44
- specification_version: 3
42
+ specification_version: 4
45
43
  summary: A library for talking to FLDigi.
46
44
  test_files: []