Rev 267 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
206 | ligi | 1 | /*************************************************************** |
2 | * |
||
3 | * Settings related Part of DUBwise |
||
4 | * ( e.g. saving to / reading from RMS ) |
||
5 | * |
||
6 | * Author: Marcus -LiGi- Bueschleb |
||
7 | * Mailto: LiGi @at@ LiGi DOTT de |
||
8 | * |
||
9 | ***************************************************************/ |
||
10 | |||
11 | import javax.microedition.rms.*; |
||
12 | |||
13 | import java.io.*; |
||
14 | |||
220 | ligi | 15 | public class DUBwiseSettings |
16 | extends org.ligi.ufo.ParamsClass |
||
255 | ligi | 17 | implements org.ligi.ufo.DUBwiseDefinitions,DUBwiseUIDefinitions,org.ligi.ufo.DUBwiseLangDefs |
206 | ligi | 18 | { |
19 | // name/handle for the recordStore to memorize some stuff |
||
220 | ligi | 20 | private final static String RECORD_STORE_NAME="DUBSETT_V4"; |
206 | ligi | 21 | |
22 | /* all settings hold here */ |
||
23 | //holds id of actual skin |
||
24 | public byte act_skin=SKINID_DARK; |
||
25 | |||
221 | ligi | 26 | public int key_back; |
27 | public int key_fullscreen; |
||
28 | public int key_clear; |
||
29 | |||
229 | ligi | 30 | public int voice_delay; |
31 | public int voice_volume; |
||
32 | |||
33 | |||
262 | ligi | 34 | public byte graph_interval=1; |
229 | ligi | 35 | |
262 | ligi | 36 | |
221 | ligi | 37 | public int remote_cam_stick; |
38 | |||
206 | ligi | 39 | public String connection_name=""; |
40 | public String connection_url=""; |
||
41 | |||
42 | public boolean do_vibra=true; |
||
43 | public boolean do_sound=true; |
||
265 | ligi | 44 | public boolean do_volts_sound=true; |
45 | public boolean do_altimeter_sound=true; |
||
46 | |||
47 | |||
269 | ligi | 48 | public byte altsteps; |
49 | |||
266 | ligi | 50 | public boolean horizon_invert_nick=true; |
51 | public boolean horizon_invert_roll=true; |
||
52 | public boolean horizon_display_altitude=true; |
||
53 | public boolean horizon_display_flytime=true; |
||
54 | |||
206 | ligi | 55 | public boolean fullscreen=false; |
56 | public boolean do_scrollbg=false; |
||
214 | ligi | 57 | public boolean expert_mode=false; |
266 | ligi | 58 | public boolean dev_mode=false; |
206 | ligi | 59 | |
269 | ligi | 60 | |
61 | |||
229 | ligi | 62 | public boolean reload_settings=false; |
267 | ligi | 63 | public boolean instant_error_show=false; |
229 | ligi | 64 | |
65 | public boolean graph_legend; |
||
66 | public boolean graph_scale; |
||
67 | |||
222 | ligi | 68 | //#if devicecontrol=="on" |
69 | public boolean keep_lighton=false; |
||
70 | //#endif |
||
206 | ligi | 71 | |
222 | ligi | 72 | int[] act_proxy_ip=default_ip; // { ip , ip , ip , ip , port } |
73 | int[] act_conn_ip=default_ip; // { ip , ip , ip , ip , port } |
||
74 | |||
75 | |||
266 | ligi | 76 | // public byte gps_format=GPS_FORMAT_DECIMAL; |
77 | // public byte speed_format=SPEED_FORMAT_KMH; |
||
211 | ligi | 78 | |
79 | |||
220 | ligi | 80 | int[] settings_field; |
211 | ligi | 81 | |
220 | ligi | 82 | public int get_field_from_act(int pos) { return settings_field[pos];} |
83 | public void set_field_from_act(int pos,int val){ |
||
84 | |||
85 | settings_field[pos]=val; |
||
86 | field2setting(pos,val); |
||
87 | } |
||
88 | |||
89 | public void toggle_fullscreen() |
||
90 | { |
||
91 | // fullscreen=!fullscreen; |
||
92 | set_field_from_act(1,settings_field[1]^1); |
||
93 | // if (fullscreen)canvas.setFullScreenMode(true); |
||
94 | } |
||
222 | ligi | 95 | |
269 | ligi | 96 | public final static int SETTINGS_POS_SKIN =0; |
97 | public final static int SETTINGS_POS_BITFIELD1 =1; |
||
98 | public final static int SETTINGS_POS_GPS_FORMAT =2; |
||
99 | public final static int SETTINGS_POS_SPEED_FORMAT =3; |
||
100 | public final static int SETTINGS_POS_EXTERN_NICK =4; |
||
101 | public final static int SETTINGS_POS_EXTERN_ROLL =5; |
||
102 | public final static int SETTINGS_POS_EXTERN_GIER =6; |
||
103 | public final static int SETTINGS_POS_EXTERN_GAS =7; |
||
104 | public final static int SETTINGS_POS_EXTERN_HIGHT =8; |
||
105 | public final static int SETTINGS_POS_KEY_BACK =9; |
||
106 | public final static int SETTINGS_POS_KEY_FULL =10; |
||
107 | public final static int SETTINGS_POS_KEY_CLEAR =11; |
||
108 | public final static int SETTINGS_POS_VOICEVOLUME =12; |
||
109 | public final static int SETTINGS_POS_VOICEDELAY =13; |
||
110 | public final static int SETTINGS_POS_BITFIELD2 =14; |
||
111 | public final static int SETTINGS_POS_LANG =15; |
||
112 | public final static int SETTINGS_POS_GRAPHINTERVAL =16; |
||
113 | public final static int SETTINGS_POS_BITFIELD3 =17; |
||
114 | public final static int SETTINGS_POS_ALTSTEPS =18; |
||
222 | ligi | 115 | |
220 | ligi | 116 | public void field2setting(int pos,int val) |
117 | { |
||
269 | ligi | 118 | switch (pos) |
262 | ligi | 119 | { |
269 | ligi | 120 | case SETTINGS_POS_ALTSTEPS: |
121 | altsteps=(byte)val; |
||
122 | break; |
||
123 | case SETTINGS_POS_GRAPHINTERVAL: |
||
262 | ligi | 124 | if (val<1) |
125 | graph_interval=1; |
||
126 | else |
||
127 | graph_interval=(byte)val; |
||
269 | ligi | 128 | break; |
129 | |||
262 | ligi | 130 | } |
255 | ligi | 131 | |
132 | if (pos==SETTINGS_POS_LANG) |
||
133 | { |
||
134 | canvas.act_lang=(byte)val; |
||
135 | canvas.load_strings(); |
||
136 | } |
||
137 | |||
138 | |||
222 | ligi | 139 | if (pos==SETTINGS_POS_SKIN) |
220 | ligi | 140 | { |
141 | act_skin=(byte)val; |
||
221 | ligi | 142 | canvas.load_skin_images(); |
220 | ligi | 143 | } |
144 | |||
222 | ligi | 145 | if ((pos==SETTINGS_POS_BITFIELD1)&&((val&1)==1)&&(!fullscreen)) |
220 | ligi | 146 | { |
147 | fullscreen=true; |
||
148 | canvas.setFullScreenMode(fullscreen); |
||
149 | } |
||
150 | |||
222 | ligi | 151 | if ((pos==SETTINGS_POS_BITFIELD1)&&((val&1)==0)&&(fullscreen)) |
220 | ligi | 152 | { |
153 | fullscreen=false; |
||
154 | canvas.setFullScreenMode(fullscreen); |
||
155 | } |
||
156 | |||
222 | ligi | 157 | if ((pos==SETTINGS_POS_BITFIELD1)&&((val&2)==2)&&(!do_scrollbg)) |
220 | ligi | 158 | { |
159 | do_scrollbg=true; |
||
221 | ligi | 160 | canvas.load_skin_images(); |
220 | ligi | 161 | } |
162 | |||
222 | ligi | 163 | if ((pos==SETTINGS_POS_BITFIELD1)&&((val&2)==0)&&(do_scrollbg)) |
220 | ligi | 164 | { |
165 | do_scrollbg=false; |
||
221 | ligi | 166 | canvas.load_skin_images(); |
220 | ligi | 167 | } |
229 | ligi | 168 | |
220 | ligi | 169 | |
222 | ligi | 170 | if (pos==SETTINGS_POS_BITFIELD1) |
220 | ligi | 171 | do_sound=((val&4)!=0); |
172 | |||
222 | ligi | 173 | if (pos==SETTINGS_POS_BITFIELD1) |
220 | ligi | 174 | do_vibra=((val&8)!=0); |
175 | |||
222 | ligi | 176 | if (pos==SETTINGS_POS_BITFIELD1) |
220 | ligi | 177 | expert_mode=((val&16)!=0); |
178 | |||
222 | ligi | 179 | if (pos==SETTINGS_POS_BITFIELD1) |
180 | keep_lighton=((val&32)!=0); |
||
181 | |||
229 | ligi | 182 | if (pos==SETTINGS_POS_BITFIELD1) |
183 | graph_legend=((val&64)!=0); |
||
184 | |||
185 | if (pos==SETTINGS_POS_BITFIELD1) |
||
186 | graph_scale=((val&128)!=0); |
||
187 | |||
188 | |||
189 | |||
222 | ligi | 190 | if (pos==SETTINGS_POS_GPS_FORMAT) |
266 | ligi | 191 | canvas.mk.gps_position.act_gps_format=(byte)val; |
220 | ligi | 192 | |
222 | ligi | 193 | if (pos==SETTINGS_POS_SPEED_FORMAT) |
266 | ligi | 194 | canvas.mk.gps_position.act_speed_format=(byte)val; |
220 | ligi | 195 | |
222 | ligi | 196 | if (pos==SETTINGS_POS_EXTERN_NICK) |
220 | ligi | 197 | default_extern_control[EXTERN_CONTROL_NICK]=(byte)val; |
198 | |||
222 | ligi | 199 | if (pos==SETTINGS_POS_EXTERN_ROLL) |
220 | ligi | 200 | default_extern_control[EXTERN_CONTROL_ROLL]=(byte)val; |
201 | |||
222 | ligi | 202 | if (pos==SETTINGS_POS_EXTERN_GIER) |
220 | ligi | 203 | default_extern_control[EXTERN_CONTROL_GIER]=(byte)val; |
204 | |||
222 | ligi | 205 | if (pos==SETTINGS_POS_EXTERN_GAS) |
220 | ligi | 206 | default_extern_control[EXTERN_CONTROL_GAS]=(byte)val; |
207 | |||
222 | ligi | 208 | if (pos==SETTINGS_POS_EXTERN_HIGHT) |
220 | ligi | 209 | default_extern_control[EXTERN_CONTROL_HIGHT]=(byte)val; |
221 | ligi | 210 | |
211 | |||
222 | ligi | 212 | if (pos==SETTINGS_POS_KEY_BACK) |
221 | ligi | 213 | key_back=val; |
214 | |||
222 | ligi | 215 | if (pos==SETTINGS_POS_KEY_FULL) |
221 | ligi | 216 | key_fullscreen=val; |
217 | |||
222 | ligi | 218 | if (pos==SETTINGS_POS_KEY_CLEAR) |
221 | ligi | 219 | key_clear=val; |
220 | |||
266 | ligi | 221 | if (pos==12) |
221 | ligi | 222 | remote_cam_stick=val; |
229 | ligi | 223 | |
224 | |||
225 | if(pos==SETTINGS_POS_VOICEVOLUME) |
||
226 | { |
||
227 | voice_volume=val; |
||
228 | //#if voice_mode!="no_voice" |
||
229 | canvas.status_voice.volume=voice_volume; |
||
230 | |||
231 | //#endif |
||
232 | } |
||
233 | if(pos==SETTINGS_POS_VOICEDELAY) |
||
234 | { |
||
235 | voice_delay=val; |
||
236 | //#if voice_mode!="no_voice" |
||
237 | canvas.status_voice.delay=voice_delay; |
||
238 | |||
239 | //#endif |
||
240 | } |
||
241 | |||
242 | if (pos==SETTINGS_POS_BITFIELD2) |
||
265 | ligi | 243 | do_volts_sound=((val&1)!=0); |
229 | ligi | 244 | |
266 | ligi | 245 | if (pos==SETTINGS_POS_BITFIELD2) |
229 | ligi | 246 | reload_settings=((val&2)!=0); |
265 | ligi | 247 | |
266 | ligi | 248 | if (pos==SETTINGS_POS_BITFIELD2) |
249 | do_altimeter_sound=((val&4)!=0); |
||
250 | |||
251 | |||
252 | if (pos==SETTINGS_POS_BITFIELD2) |
||
253 | horizon_invert_roll=((val&8)!=0); |
||
254 | |||
255 | if (pos==SETTINGS_POS_BITFIELD2) |
||
256 | horizon_invert_nick=((val&16)!=0); |
||
257 | |||
258 | if (pos==SETTINGS_POS_BITFIELD2) |
||
259 | horizon_display_flytime=((val&32)!=0); |
||
260 | |||
261 | if (pos==SETTINGS_POS_BITFIELD2) |
||
262 | horizon_display_altitude=((val&64)!=0); |
||
263 | |||
264 | if (pos==SETTINGS_POS_BITFIELD2) |
||
265 | dev_mode=((val&128)!=0); |
||
267 | ligi | 266 | |
267 | |||
268 | if (pos==SETTINGS_POS_BITFIELD3) |
||
269 | instant_error_show=((val&1)!=0); |
||
269 | ligi | 270 | |
271 | /* |
||
272 | String ts=""; |
||
273 | for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++) |
||
274 | ts+=","+settings_field[i]; |
||
275 | |||
276 | System.out.println(ts); |
||
277 | */ |
||
278 | |||
279 | |||
220 | ligi | 280 | } |
281 | |||
269 | ligi | 282 | public int[] plain_defaults={0,0,0,0,42,42,42,1,1,-4242,-4242,-4242,0,10,0,0,7,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; |
283 | public int[] fancy_defaults={0,255,0,0,42,42,42,1,1,-4242,-4242,-4242,150,10,5,0,7,1,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; |
||
220 | ligi | 284 | |
269 | ligi | 285 | |
286 | |||
287 | public void process_all_settings() |
||
288 | { |
||
289 | for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++) |
||
290 | field2setting(i,settings_field[i]); |
||
291 | } |
||
292 | |||
293 | public void load_plain_defaults() |
||
294 | { |
||
295 | settings_field=plain_defaults; |
||
296 | process_all_settings(); |
||
297 | } |
||
298 | |||
299 | public void load_fancy_defaults() |
||
300 | { |
||
301 | settings_field=fancy_defaults; |
||
302 | process_all_settings(); |
||
303 | } |
||
304 | |||
220 | ligi | 305 | public byte[] default_extern_control;//=default_extern_keycontrol ; |
306 | |||
206 | ligi | 307 | |
308 | /* end of all settings hold here */ |
||
309 | |||
255 | ligi | 310 | // public String[] _tab_names={"User Interface","GPS","Keycontrol","Special Keys","Graph","Voice","Other" }; |
220 | ligi | 311 | |
255 | ligi | 312 | |
266 | ligi | 313 | public int[] _tab_stringids={STRINGID_USERINTERFACE,STRINGID_UNITS,STRINGID_KEYCONTROL,STRINGID_SPECIALKEYS,STRINGID_GRAPH,STRINGID_SOUND,STRINGID_COCKPIT,STRINGID_OTHER}; |
220 | ligi | 314 | |
258 | ligi | 315 | |
316 | public int[][] _field_stringids ={ |
||
317 | { |
||
318 | STRINGID_LANGUAGE, |
||
319 | STRINGID_SKIN, |
||
320 | STRINGID_FULLSCREEN, |
||
321 | STRINGID_SCROLLBG |
||
322 | //#if devicecontrol=="on" |
||
323 | ,STRINGID_PERMALIGHT |
||
324 | //#endif |
||
325 | }, |
||
266 | ligi | 326 | {STRINGID_SPEEDFORMAT,STRINGID_GPSFORMAT}, |
327 | {STRINGID_NICK ,STRINGID_ROLL,STRINGID_GIER,STRINGID_GASINCREASE,STRINGID_HEIGHTINCREASE }, |
||
258 | ligi | 328 | {STRINGID_BACKTOMAINMENU,STRINGID_FULLSCREEN,STRINGID_CLEAR }, |
262 | ligi | 329 | {STRINGID_LEGEND,STRINGID_SCALEGRID,STRINGID_GRAPHINTERVAL}, |
269 | ligi | 330 | {STRINGID_SOUND,STRINGID_VOLTS,STRINGID_DELAYINS,STRINGID_ALTIMETER,STRINGID_ALTSTEPS,STRINGID_VOLUME}, |
266 | ligi | 331 | {STRINGID_SHOWALTITUDE,STRINGID_SHOWFLIGHTTIME,STRINGID_INVERTROLL,STRINGID_INVERTNICK}, |
267 | ligi | 332 | {STRINGID_INSTANTERRORSHOW,STRINGID_VIBRA,STRINGID_REMOTECAMSTICK,STRINGID_ALWAYSRELOADPARAMS,STRINGID_EXPERTMODE,STRINGID_DEVMODE}}; |
258 | ligi | 333 | |
334 | |||
335 | |||
336 | |||
337 | public int[][] _choice_stringids={ {STRINGID_LANG0,STRINGID_LANG1}, /* FIXME - make dynamic */{ STRINGID_DARK,STRINGID_LIGHT } , {STRINGID_KMH,STRINGID_MPH,STRINGID_CMS},{STRINGID_DECIMAL,STRINGID_MINSEC} } ; |
||
338 | |||
339 | |||
340 | |||
266 | ligi | 341 | public int[][] _field_positions= { |
342 | {SETTINGS_POS_LANG,SETTINGS_POS_SKIN,8,9 |
||
222 | ligi | 343 | //#if devicecontrol=="on" |
262 | ligi | 344 | |
266 | ligi | 345 | ,13 |
222 | ligi | 346 | //#endif |
266 | ligi | 347 | } , {2,3 } , {4,5,6,7,8} , {9,10,11},{SETTINGS_POS_BITFIELD1*8 +6,SETTINGS_POS_BITFIELD1*8 +7, SETTINGS_POS_GRAPHINTERVAL} , |
269 | ligi | 348 | {10,SETTINGS_POS_BITFIELD2*8+0,SETTINGS_POS_VOICEDELAY,SETTINGS_POS_BITFIELD2*8+2,SETTINGS_POS_ALTSTEPS,SETTINGS_POS_VOICEVOLUME }, |
266 | ligi | 349 | {SETTINGS_POS_BITFIELD2*8+6,SETTINGS_POS_BITFIELD2*8+5,SETTINGS_POS_BITFIELD2*8+3,SETTINGS_POS_BITFIELD2*8+4}, |
267 | ligi | 350 | {SETTINGS_POS_BITFIELD3*8+0,SETTINGS_POS_BITFIELD1*8+3,12,SETTINGS_POS_BITFIELD2*8+1,SETTINGS_POS_BITFIELD1*8+4,SETTINGS_POS_BITFIELD2*8+7} |
266 | ligi | 351 | }; |
258 | ligi | 352 | public int[][] _field_types={ {PARAMTYPE_CHOICE+0,PARAMTYPE_CHOICE+1,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH |
222 | ligi | 353 | //#if devicecontrol=="on" |
266 | ligi | 354 | ,PARAMTYPE_BITSWITCH |
222 | ligi | 355 | //#endif |
266 | ligi | 356 | } , {PARAMTYPE_CHOICE+2,PARAMTYPE_CHOICE+3} , {PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE}, {PARAMTYPE_KEY,PARAMTYPE_KEY,PARAMTYPE_KEY} , {PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BYTE}, |
269 | ligi | 357 | {PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BYTE,PARAMTYPE_BITSWITCH,PARAMTYPE_BYTE,PARAMTYPE_BYTE} , |
266 | ligi | 358 | {PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH}, |
267 | ligi | 359 | {PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_STICK,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH} |
266 | ligi | 360 | }; |
220 | ligi | 361 | DUBwiseCanvas canvas; |
362 | |||
363 | |||
229 | ligi | 364 | |
220 | ligi | 365 | public final static int SETTINGS_FIELD_LENGTH=42; |
366 | public DUBwiseSettings(DUBwiseCanvas _canvas) |
||
206 | ligi | 367 | { |
220 | ligi | 368 | canvas= _canvas; |
369 | settings_field=new int[SETTINGS_FIELD_LENGTH]; |
||
370 | default_extern_control=new byte[11]; |
||
371 | // set defaults |
||
372 | settings_field[4]=42; // nick |
||
373 | settings_field[5]=42; // roll |
||
374 | settings_field[6]=42; // gier |
||
245 | ligi | 375 | settings_field[7]=1; // gas |
220 | ligi | 376 | settings_field[8]=1; // hight |
377 | |||
221 | ligi | 378 | settings_field[9]=-4242; // no key |
379 | settings_field[10]=-4242; // no key |
||
380 | settings_field[11]=-4242; // no key |
||
381 | |||
220 | ligi | 382 | } |
383 | |||
384 | public void load() |
||
385 | { |
||
255 | ligi | 386 | tab_stringids=_tab_stringids; |
220 | ligi | 387 | |
255 | ligi | 388 | // tab_names=_tab_names; |
258 | ligi | 389 | |
220 | ligi | 390 | field_positions=_field_positions; |
391 | field_types=_field_types; |
||
258 | ligi | 392 | |
393 | choice_stringids=_choice_stringids; |
||
394 | |||
395 | field_stringids=_field_stringids; |
||
396 | //choice_strings=new String[_choice_strings.length+1][]; |
||
397 | /* |
||
398 | // FIXME |
||
399 | choice_strings[0]=new String[2]; |
||
400 | choice_strings[0][0]="English"; |
||
401 | choice_strings[0][1]="Deutsch"; |
||
402 | for ( int i=1; i<_choice_strings.length+1;i++) |
||
403 | { |
||
404 | choice_strings[i]=new String[_choice_strings[i-1].length+1]; |
||
405 | for ( int ii=0; ii<_choice_strings[i-1].length;ii++) |
||
406 | choice_strings[i][ii]=canvas.l(_choice_strings[i-1][ii]); |
||
407 | } |
||
408 | */ |
||
409 | // choice_strings=_choice_strings; |
||
206 | ligi | 410 | try |
411 | { |
||
412 | RecordStore recStore = RecordStore.openRecordStore(RECORD_STORE_NAME , true ); |
||
413 | |||
414 | if (recStore.getNumRecords()==1) |
||
415 | { |
||
416 | ByteArrayInputStream bin = new ByteArrayInputStream(recStore.getRecord(1)); |
||
417 | DataInputStream din = new DataInputStream( bin ); |
||
418 | |||
419 | |||
420 | connection_url=din.readUTF(); |
||
421 | connection_name=din.readUTF(); |
||
220 | ligi | 422 | // reserve utf's |
423 | din.readUTF(); |
||
424 | din.readUTF(); |
||
425 | din.readUTF(); |
||
206 | ligi | 426 | |
427 | |||
428 | |||
220 | ligi | 429 | for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++) |
430 | settings_field[i]=din.readInt(); |
||
211 | ligi | 431 | |
220 | ligi | 432 | for ( int i=0;i<5;i++) |
214 | ligi | 433 | |
206 | ligi | 434 | { |
435 | act_proxy_ip[i]=din.readInt(); |
||
436 | act_conn_ip[i]=din.readInt(); |
||
437 | } |
||
438 | |||
439 | } |
||
440 | recStore.closeRecordStore(); |
||
441 | } |
||
442 | catch (Exception e) |
||
443 | { } |
||
444 | |||
220 | ligi | 445 | |
269 | ligi | 446 | process_all_settings(); |
220 | ligi | 447 | |
269 | ligi | 448 | |
206 | ligi | 449 | } |
450 | |||
451 | |||
452 | public void save() |
||
453 | { |
||
454 | try |
||
455 | { |
||
456 | RecordStore.deleteRecordStore(RECORD_STORE_NAME); |
||
457 | } |
||
458 | catch (Exception e) |
||
459 | { } |
||
460 | |||
461 | try { |
||
462 | RecordStore recStore = RecordStore.openRecordStore(RECORD_STORE_NAME, true ); |
||
463 | |||
464 | ByteArrayOutputStream bout = new ByteArrayOutputStream(); |
||
465 | DataOutputStream dout = new DataOutputStream( bout ); |
||
466 | |||
467 | dout.writeUTF(connection_url); |
||
468 | dout.writeUTF(connection_name); |
||
469 | |||
211 | ligi | 470 | dout.writeUTF(""); |
471 | dout.writeUTF(""); |
||
472 | dout.writeUTF(""); |
||
473 | |||
474 | |||
220 | ligi | 475 | for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++) |
476 | dout.writeInt(settings_field[i]); |
||
206 | ligi | 477 | for ( int i=0;i<5;i++) |
478 | { |
||
479 | dout.writeInt(act_proxy_ip[i]); |
||
480 | dout.writeInt(act_conn_ip[i]); |
||
481 | } |
||
482 | recStore.addRecord(bout.toByteArray(),0,bout.size()); |
||
483 | |||
484 | recStore.closeRecordStore(); |
||
485 | |||
486 | |||
487 | } |
||
488 | catch (Exception e) |
||
489 | { } |
||
490 | |||
491 | } |
||
492 | |||
493 | } |