Subversion Repositories Projects

Rev

Rev 245 | Rev 258 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 245 Rev 255
1
/***************************************************************
1
/***************************************************************
2
 *
2
 *
3
 * Settings related Part of DUBwise
3
 * Settings related Part of DUBwise
4
 *  ( e.g. saving to / reading from RMS )
4
 *  ( e.g. saving to / reading from RMS )
5
 *                                                          
5
 *                                                          
6
 * Author:        Marcus -LiGi- Bueschleb
6
 * Author:        Marcus -LiGi- Bueschleb
7
 * Mailto:        LiGi @at@ LiGi DOTT de                    
7
 * Mailto:        LiGi @at@ LiGi DOTT de                    
8
 *
8
 *
9
***************************************************************/
9
***************************************************************/
10
 
10
 
11
import javax.microedition.rms.*;
11
import javax.microedition.rms.*;
12
 
12
 
13
import java.io.*;
13
import java.io.*;
14
 
14
 
15
public class DUBwiseSettings
15
public class DUBwiseSettings
16
    extends org.ligi.ufo.ParamsClass
16
    extends org.ligi.ufo.ParamsClass
17
    implements org.ligi.ufo.DUBwiseDefinitions,DUBwiseUIDefinitions
17
    implements org.ligi.ufo.DUBwiseDefinitions,DUBwiseUIDefinitions,org.ligi.ufo.DUBwiseLangDefs
18
{
18
{
19
    // name/handle for the recordStore to memorize some stuff
19
    // name/handle for the recordStore to memorize some stuff
20
    private final static String RECORD_STORE_NAME="DUBSETT_V4";
20
    private final static String RECORD_STORE_NAME="DUBSETT_V4";
21
 
21
 
22
    /* all settings hold here */
22
    /* all settings hold here */
23
    //holds id of actual skin
23
    //holds id of actual skin
24
    public byte act_skin=SKINID_DARK;
24
    public byte act_skin=SKINID_DARK;
25
 
-
 
26
 
-
 
27
 
25
 
28
    public int key_back;
26
    public int key_back;
29
    public int key_fullscreen;
27
    public int key_fullscreen;
30
    public int key_clear;
28
    public int key_clear;
31
 
29
 
32
    public int voice_delay;
30
    public int voice_delay;
33
    public int voice_volume;
31
    public int voice_volume;
34
 
32
 
35
 
33
 
36
 
34
 
37
    public int remote_cam_stick;
35
    public int remote_cam_stick;
38
 
36
 
39
    public String connection_name="";
37
    public String connection_name="";
40
    public String connection_url="";
38
    public String connection_url="";
41
 
39
 
42
    public boolean do_vibra=true;
40
    public boolean do_vibra=true;
43
    public boolean do_sound=true;
41
    public boolean do_sound=true;
44
    public boolean fullscreen=false;
42
    public boolean fullscreen=false;
45
    public boolean do_scrollbg=false;
43
    public boolean do_scrollbg=false;
46
    public boolean expert_mode=false;
44
    public boolean expert_mode=false;
47
 
45
 
48
    public boolean reload_settings=false;
46
    public boolean reload_settings=false;
49
 
47
 
50
 
48
 
51
    public boolean graph_legend;
49
    public boolean graph_legend;
52
    public boolean graph_scale;
50
    public boolean graph_scale;
53
 
51
 
54
//#if devicecontrol=="on"
52
//#if devicecontrol=="on"
55
    public boolean keep_lighton=false;
53
    public boolean keep_lighton=false;
56
//#endif
54
//#endif
57
 
55
 
58
    int[] act_proxy_ip=default_ip; // { ip , ip , ip , ip , port }
56
    int[] act_proxy_ip=default_ip; // { ip , ip , ip , ip , port }
59
    int[] act_conn_ip=default_ip; // { ip , ip , ip , ip , port }
57
    int[] act_conn_ip=default_ip; // { ip , ip , ip , ip , port }
60
 
58
 
61
 
59
 
62
    public byte gps_format=GPS_FORMAT_DECIMAL;
60
    public byte gps_format=GPS_FORMAT_DECIMAL;
63
    public byte speed_format=SPEED_FORMAT_KMH;
61
    public byte speed_format=SPEED_FORMAT_KMH;
64
 
62
 
65
 
63
 
66
    int[] settings_field;
64
    int[] settings_field;
67
 
65
 
68
    public int get_field_from_act(int pos) { return settings_field[pos];}
66
    public int get_field_from_act(int pos) { return settings_field[pos];}
69
    public void set_field_from_act(int pos,int val){
67
    public void set_field_from_act(int pos,int val){
70
 
68
 
71
        settings_field[pos]=val;
69
        settings_field[pos]=val;
72
        field2setting(pos,val);
70
        field2setting(pos,val);
73
    }
71
    }
74
 
72
 
75
    public void toggle_fullscreen()
73
    public void toggle_fullscreen()
76
    {
74
    {
77
        //      fullscreen=!fullscreen;
75
        //      fullscreen=!fullscreen;
78
         set_field_from_act(1,settings_field[1]^1);
76
         set_field_from_act(1,settings_field[1]^1);
79
         //     if (fullscreen)canvas.setFullScreenMode(true);
77
         //     if (fullscreen)canvas.setFullScreenMode(true);
80
    }
78
    }
81
 
79
 
82
    public final static int SETTINGS_POS_SKIN=0;
80
    public final static int SETTINGS_POS_SKIN=0;
83
    public final static int SETTINGS_POS_BITFIELD1=1;
81
    public final static int SETTINGS_POS_BITFIELD1=1;
84
    public final static int SETTINGS_POS_GPS_FORMAT=2;
82
    public final static int SETTINGS_POS_GPS_FORMAT=2;
85
    public final static int SETTINGS_POS_SPEED_FORMAT=3;
83
    public final static int SETTINGS_POS_SPEED_FORMAT=3;
86
    public final static int SETTINGS_POS_EXTERN_NICK=4;
84
    public final static int SETTINGS_POS_EXTERN_NICK=4;
87
    public final static int SETTINGS_POS_EXTERN_ROLL=5;
85
    public final static int SETTINGS_POS_EXTERN_ROLL=5;
88
    public final static int SETTINGS_POS_EXTERN_GIER=6;
86
    public final static int SETTINGS_POS_EXTERN_GIER=6;
89
    public final static int SETTINGS_POS_EXTERN_GAS=7;
87
    public final static int SETTINGS_POS_EXTERN_GAS=7;
90
    public final static int SETTINGS_POS_EXTERN_HIGHT=8;
88
    public final static int SETTINGS_POS_EXTERN_HIGHT=8;
91
    public final static int SETTINGS_POS_KEY_BACK=9;
89
    public final static int SETTINGS_POS_KEY_BACK=9;
92
    public final static int SETTINGS_POS_KEY_FULL=10;
90
    public final static int SETTINGS_POS_KEY_FULL=10;
93
    public final static int SETTINGS_POS_KEY_CLEAR=11;
91
    public final static int SETTINGS_POS_KEY_CLEAR=11;
94
    public final static int SETTINGS_POS_VOICEVOLUME=12;
92
    public final static int SETTINGS_POS_VOICEVOLUME=12;
95
    public final static int SETTINGS_POS_VOICEDELAY=13;
93
    public final static int SETTINGS_POS_VOICEDELAY=13;
96
    public final static int SETTINGS_POS_BITFIELD2=14;
94
    public final static int SETTINGS_POS_BITFIELD2=14;
-
 
95
    public final static int SETTINGS_POS_LANG=15;
97
 
96
 
98
 
97
 
99
    public void field2setting(int pos,int val)
98
    public void field2setting(int pos,int val)
100
    {
99
    {
-
 
100
       
-
 
101
 
-
 
102
        if (pos==SETTINGS_POS_LANG)
-
 
103
            {
-
 
104
                canvas.act_lang=(byte)val;
-
 
105
                canvas.load_strings();
-
 
106
            }
-
 
107
 
101
       
108
 
102
        if (pos==SETTINGS_POS_SKIN)
109
        if (pos==SETTINGS_POS_SKIN)
103
            {
110
            {
104
                act_skin=(byte)val;
111
                act_skin=(byte)val;
105
                canvas.load_skin_images();
112
                canvas.load_skin_images();
106
            }
113
            }
107
 
114
 
108
        if ((pos==SETTINGS_POS_BITFIELD1)&&((val&1)==1)&&(!fullscreen))
115
        if ((pos==SETTINGS_POS_BITFIELD1)&&((val&1)==1)&&(!fullscreen))
109
            {
116
            {
110
                fullscreen=true;
117
                fullscreen=true;
111
                canvas.setFullScreenMode(fullscreen);
118
                canvas.setFullScreenMode(fullscreen);
112
            }
119
            }
113
 
120
 
114
        if ((pos==SETTINGS_POS_BITFIELD1)&&((val&1)==0)&&(fullscreen))
121
        if ((pos==SETTINGS_POS_BITFIELD1)&&((val&1)==0)&&(fullscreen))
115
            {
122
            {
116
                fullscreen=false;
123
                fullscreen=false;
117
                canvas.setFullScreenMode(fullscreen);
124
                canvas.setFullScreenMode(fullscreen);
118
            }
125
            }
119
 
126
 
120
        if ((pos==SETTINGS_POS_BITFIELD1)&&((val&2)==2)&&(!do_scrollbg))
127
        if ((pos==SETTINGS_POS_BITFIELD1)&&((val&2)==2)&&(!do_scrollbg))
121
            {
128
            {
122
                do_scrollbg=true;
129
                do_scrollbg=true;
123
                canvas.load_skin_images();
130
                canvas.load_skin_images();
124
            }
131
            }
125
 
132
 
126
        if ((pos==SETTINGS_POS_BITFIELD1)&&((val&2)==0)&&(do_scrollbg))
133
        if ((pos==SETTINGS_POS_BITFIELD1)&&((val&2)==0)&&(do_scrollbg))
127
            {
134
            {
128
                do_scrollbg=false;
135
                do_scrollbg=false;
129
                canvas.load_skin_images();
136
                canvas.load_skin_images();
130
            }
137
            }
131
 
138
 
132
                   
139
                   
133
        if (pos==SETTINGS_POS_BITFIELD1)
140
        if (pos==SETTINGS_POS_BITFIELD1)
134
            do_sound=((val&4)!=0);
141
            do_sound=((val&4)!=0);
135
 
142
 
136
        if (pos==SETTINGS_POS_BITFIELD1)
143
        if (pos==SETTINGS_POS_BITFIELD1)
137
            do_vibra=((val&8)!=0);
144
            do_vibra=((val&8)!=0);
138
 
145
 
139
        if (pos==SETTINGS_POS_BITFIELD1)
146
        if (pos==SETTINGS_POS_BITFIELD1)
140
            expert_mode=((val&16)!=0);
147
            expert_mode=((val&16)!=0);
141
 
148
 
142
        if (pos==SETTINGS_POS_BITFIELD1)
149
        if (pos==SETTINGS_POS_BITFIELD1)
143
            keep_lighton=((val&32)!=0);
150
            keep_lighton=((val&32)!=0);
144
 
151
 
145
        if (pos==SETTINGS_POS_BITFIELD1)
152
        if (pos==SETTINGS_POS_BITFIELD1)
146
            graph_legend=((val&64)!=0);
153
            graph_legend=((val&64)!=0);
147
 
154
 
148
        if (pos==SETTINGS_POS_BITFIELD1)
155
        if (pos==SETTINGS_POS_BITFIELD1)
149
            graph_scale=((val&128)!=0);
156
            graph_scale=((val&128)!=0);
150
 
157
 
151
 
158
 
152
 
159
 
153
        if (pos==SETTINGS_POS_GPS_FORMAT)
160
        if (pos==SETTINGS_POS_GPS_FORMAT)
154
            gps_format=(byte)val;
161
            gps_format=(byte)val;
155
 
162
 
156
        if (pos==SETTINGS_POS_SPEED_FORMAT)
163
        if (pos==SETTINGS_POS_SPEED_FORMAT)
157
            speed_format=(byte)val;
164
            speed_format=(byte)val;
158
 
165
 
159
        if (pos==SETTINGS_POS_EXTERN_NICK)
166
        if (pos==SETTINGS_POS_EXTERN_NICK)
160
            default_extern_control[EXTERN_CONTROL_NICK]=(byte)val;         
167
            default_extern_control[EXTERN_CONTROL_NICK]=(byte)val;         
161
 
168
 
162
        if (pos==SETTINGS_POS_EXTERN_ROLL)
169
        if (pos==SETTINGS_POS_EXTERN_ROLL)
163
            default_extern_control[EXTERN_CONTROL_ROLL]=(byte)val;         
170
            default_extern_control[EXTERN_CONTROL_ROLL]=(byte)val;         
164
 
171
 
165
        if (pos==SETTINGS_POS_EXTERN_GIER)
172
        if (pos==SETTINGS_POS_EXTERN_GIER)
166
            default_extern_control[EXTERN_CONTROL_GIER]=(byte)val;         
173
            default_extern_control[EXTERN_CONTROL_GIER]=(byte)val;         
167
 
174
 
168
        if (pos==SETTINGS_POS_EXTERN_GAS)
175
        if (pos==SETTINGS_POS_EXTERN_GAS)
169
            default_extern_control[EXTERN_CONTROL_GAS]=(byte)val;          
176
            default_extern_control[EXTERN_CONTROL_GAS]=(byte)val;          
170
 
177
 
171
        if (pos==SETTINGS_POS_EXTERN_HIGHT)
178
        if (pos==SETTINGS_POS_EXTERN_HIGHT)
172
            default_extern_control[EXTERN_CONTROL_HIGHT]=(byte)val;        
179
            default_extern_control[EXTERN_CONTROL_HIGHT]=(byte)val;        
173
 
180
 
174
 
181
 
175
        if (pos==SETTINGS_POS_KEY_BACK)
182
        if (pos==SETTINGS_POS_KEY_BACK)
176
            key_back=val;          
183
            key_back=val;          
177
 
184
 
178
        if (pos==SETTINGS_POS_KEY_FULL)
185
        if (pos==SETTINGS_POS_KEY_FULL)
179
            key_fullscreen=val;
186
            key_fullscreen=val;
180
 
187
 
181
        if (pos==SETTINGS_POS_KEY_CLEAR)
188
        if (pos==SETTINGS_POS_KEY_CLEAR)
182
            key_clear=val;
189
            key_clear=val;
183
 
190
 
184
        if (pos==12)
191
        if (pos==12)
185
            remote_cam_stick=val;
192
            remote_cam_stick=val;
186
 
193
 
187
 
194
 
188
        if(pos==SETTINGS_POS_VOICEVOLUME)
195
        if(pos==SETTINGS_POS_VOICEVOLUME)
189
            {
196
            {
190
            voice_volume=val;
197
            voice_volume=val;
191
//#if voice_mode!="no_voice"
198
//#if voice_mode!="no_voice"
192
            canvas.status_voice.volume=voice_volume;
199
            canvas.status_voice.volume=voice_volume;
193
               
200
               
194
//#endif
201
//#endif
195
            }
202
            }
196
        if(pos==SETTINGS_POS_VOICEDELAY)
203
        if(pos==SETTINGS_POS_VOICEDELAY)
197
            {
204
            {
198
            voice_delay=val;
205
            voice_delay=val;
199
//#if voice_mode!="no_voice"
206
//#if voice_mode!="no_voice"
200
            canvas.status_voice.delay=voice_delay;
207
            canvas.status_voice.delay=voice_delay;
201
               
208
               
202
//#endif
209
//#endif
203
            }
210
            }
204
 
211
 
205
        if (pos==SETTINGS_POS_BITFIELD2)
212
        if (pos==SETTINGS_POS_BITFIELD2)
206
            do_sound=((val&1)!=0);      // TODO: FIXME - extra var
213
            do_sound=((val&1)!=0);      // TODO: FIXME - extra var
207
 
214
 
208
        if (pos==SETTINGS_POS_BITFIELD2)
215
        if (pos==SETTINGS_POS_BITFIELD2)
209
            reload_settings=((val&2)!=0);    
216
            reload_settings=((val&2)!=0);    
210
    }
217
    }
211
 
218
 
212
 
219
 
213
    public byte[] default_extern_control;//=default_extern_keycontrol ;
220
    public byte[] default_extern_control;//=default_extern_keycontrol ;
214
 
221
 
215
 
222
 
216
    /* end of all settings hold here */
223
    /* end of all settings hold here */
217
 
224
 
-
 
225
    //    public String[] _tab_names={"User Interface","GPS","Keycontrol","Special Keys","Graph","Voice","Other" };
-
 
226
 
218
    public String[] _tab_names={"User Interface","GPS","Keycontrol","Special Keys","Graph","Voice","Other" };
227
 
219
 
228
    public int[] _tab_stringids={STRINGID_USERINTERFACE,STRINGID_GPS,STRINGID_KEYCONTROL,STRINGID_SPECIALKEYS,STRINGID_GRAPH,STRINGID_VOICE,STRINGID_OTHER};
220
    public String[][] _field_names={ { "Skin","Fullscreen","Scroll Background"
229
    public String[][] _field_names={ { "Language","Skin","Fullscreen","Scroll Background"
221
//#if devicecontrol=="on"
230
//#if devicecontrol=="on"
222
                                       ,"Permanent Light"
231
                                       ,"Permanent Light"
223
//#endif
232
//#endif
224
 } , {"GPS Format","Speed Format"},{"Nick","Roll","Gier","Gas Increase","Height Increase"},{"Back to Main-Menu","Fullscreen","Clear"},{"Legend","Scale-Grid"},{"Volts Output","Delay in Seconds","Volume"},{"Sound","Vibra","Remote Cam Stick","Always Reload Params","Expert-Mode"} };
233
 } , {"GPS Format","Speed Format"},{"Nick","Roll","Gier","Gas Increase","Height Increase"},{"Back to Main-Menu","Fullscreen","Clear"},{"Legend","Scale-Grid"},{"Volts Output","Delay in Seconds","Volume"},{"Sound","Vibra","Remote Cam Stick","Always Reload Params","Expert-Mode"} };
225
 
234
 
226
    public String[][] _choice_strings={ { "Dark","Light" } , {"km/h","mp/h","cm/s"},{"decimal","min sec"}} ;
235
    public String[][] _choice_strings={ { "Dark","Light" } , {"km/h","mp/h","cm/s"},{"decimal","min sec"},{"English","Deutsch"} } ;
227
    public int[][] _field_positions={ {SETTINGS_POS_SKIN,8,9
236
    public int[][] _field_positions={ {SETTINGS_POS_LANG,SETTINGS_POS_SKIN,8,9
228
//#if devicecontrol=="on"
237
//#if devicecontrol=="on"
229
                                       ,13
238
                                       ,13
230
//#endif
239
//#endif
231
} , {2,3} , {4,5,6,7,8} , {9,10,11},{SETTINGS_POS_BITFIELD1*8 +6,SETTINGS_POS_BITFIELD1*8 +7} ,{SETTINGS_POS_BITFIELD2*8+0,SETTINGS_POS_VOICEDELAY,SETTINGS_POS_VOICEVOLUME },  {10,11,12,SETTINGS_POS_BITFIELD2*8+1,12}};
240
} , {2,3} , {4,5,6,7,8} , {9,10,11},{SETTINGS_POS_BITFIELD1*8 +6,SETTINGS_POS_BITFIELD1*8 +7} ,{SETTINGS_POS_BITFIELD2*8+0,SETTINGS_POS_VOICEDELAY,SETTINGS_POS_VOICEVOLUME },  {10,11,12,SETTINGS_POS_BITFIELD2*8+1,12}};
232
    public int[][] _field_types={ {PARAMTYPE_CHOICE+0,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH
241
    public int[][] _field_types={ {PARAMTYPE_CHOICE+3,PARAMTYPE_CHOICE+0,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH
233
//#if devicecontrol=="on"
242
//#if devicecontrol=="on"
234
                                   ,PARAMTYPE_BITSWITCH
243
                                   ,PARAMTYPE_BITSWITCH
235
//#endif
244
//#endif
236
} , {PARAMTYPE_CHOICE+1,PARAMTYPE_CHOICE+2} , {PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE}, {PARAMTYPE_KEY,PARAMTYPE_KEY,PARAMTYPE_KEY} , {PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH}, {PARAMTYPE_BITSWITCH,PARAMTYPE_BYTE,PARAMTYPE_BYTE}, {PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_STICK,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH}};
245
} , {PARAMTYPE_CHOICE+1,PARAMTYPE_CHOICE+2} , {PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE,PARAMTYPE_BYTE}, {PARAMTYPE_KEY,PARAMTYPE_KEY,PARAMTYPE_KEY} , {PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH}, {PARAMTYPE_BITSWITCH,PARAMTYPE_BYTE,PARAMTYPE_BYTE}, {PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH,PARAMTYPE_STICK,PARAMTYPE_BITSWITCH,PARAMTYPE_BITSWITCH}};
237
    DUBwiseCanvas canvas;
246
    DUBwiseCanvas canvas;
238
 
247
 
239
 
248
 
240
 
249
 
241
    public final static int SETTINGS_FIELD_LENGTH=42;
250
    public final static int SETTINGS_FIELD_LENGTH=42;
242
    public DUBwiseSettings(DUBwiseCanvas _canvas)
251
    public DUBwiseSettings(DUBwiseCanvas _canvas)
243
    {
252
    {
244
        canvas= _canvas;
253
        canvas= _canvas;
245
        settings_field=new int[SETTINGS_FIELD_LENGTH];
254
        settings_field=new int[SETTINGS_FIELD_LENGTH];
246
        default_extern_control=new byte[11];
255
        default_extern_control=new byte[11];
247
        // set defaults
256
        // set defaults
248
        settings_field[4]=42; // nick
257
        settings_field[4]=42; // nick
249
        settings_field[5]=42; // roll
258
        settings_field[5]=42; // roll
250
        settings_field[6]=42; // gier
259
        settings_field[6]=42; // gier
251
        settings_field[7]=1; // gas
260
        settings_field[7]=1; // gas
252
        settings_field[8]=1; // hight
261
        settings_field[8]=1; // hight
253
 
262
 
254
        settings_field[9]=-4242; //  no key
263
        settings_field[9]=-4242; //  no key
255
        settings_field[10]=-4242; // no key
264
        settings_field[10]=-4242; // no key
256
        settings_field[11]=-4242; // no key
265
        settings_field[11]=-4242; // no key
257
 
266
 
258
    }
267
    }
259
       
268
       
260
    public void load()
269
    public void load()
261
    {
270
    {
-
 
271
        tab_stringids=_tab_stringids;
262
 
272
 
263
        tab_names=_tab_names;
273
        //      tab_names=_tab_names;
264
        field_names=_field_names;
274
        field_names=_field_names;
265
        field_positions=_field_positions;
275
        field_positions=_field_positions;
266
        field_types=_field_types;
276
        field_types=_field_types;
267
        choice_strings=_choice_strings;
277
        choice_strings=_choice_strings;
268
        try
278
        try
269
            {
279
            {
270
                RecordStore recStore = RecordStore.openRecordStore(RECORD_STORE_NAME , true );
280
                RecordStore recStore = RecordStore.openRecordStore(RECORD_STORE_NAME , true );
271
 
281
 
272
                if (recStore.getNumRecords()==1)
282
                if (recStore.getNumRecords()==1)
273
                    {
283
                    {
274
                        ByteArrayInputStream bin = new ByteArrayInputStream(recStore.getRecord(1));
284
                        ByteArrayInputStream bin = new ByteArrayInputStream(recStore.getRecord(1));
275
                        DataInputStream      din = new   DataInputStream( bin );
285
                        DataInputStream      din = new   DataInputStream( bin );
276
 
286
 
277
 
287
 
278
                        connection_url=din.readUTF();
288
                        connection_url=din.readUTF();
279
                        connection_name=din.readUTF();
289
                        connection_name=din.readUTF();
280
                        // reserve utf's
290
                        // reserve utf's
281
                        din.readUTF();
291
                        din.readUTF();
282
                        din.readUTF();
292
                        din.readUTF();
283
                        din.readUTF();
293
                        din.readUTF();
284
 
294
 
285
 
295
 
286
 
296
 
287
                        for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++)
297
                        for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++)
288
                            settings_field[i]=din.readInt();
298
                            settings_field[i]=din.readInt();
289
 
299
 
290
                        for ( int i=0;i<5;i++)
300
                        for ( int i=0;i<5;i++)
291
 
301
 
292
                            {
302
                            {
293
                                act_proxy_ip[i]=din.readInt();
303
                                act_proxy_ip[i]=din.readInt();
294
                                act_conn_ip[i]=din.readInt();
304
                                act_conn_ip[i]=din.readInt();
295
                            }
305
                            }
296
 
306
 
297
                    }
307
                    }
298
                recStore.closeRecordStore();
308
                recStore.closeRecordStore();
299
            }
309
            }
300
        catch (Exception e)
310
        catch (Exception e)
301
            {       }
311
            {       }
302
 
312
 
303
 
313
 
304
        for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++)
314
        for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++)
305
            field2setting(i,settings_field[i]);
315
            field2setting(i,settings_field[i]);
306
 
316
 
307
    }
317
    }
308
 
318
 
309
 
319
 
310
    public void save()
320
    public void save()
311
    {
321
    {
312
        try
322
        try
313
            {
323
            {
314
                RecordStore.deleteRecordStore(RECORD_STORE_NAME);
324
                RecordStore.deleteRecordStore(RECORD_STORE_NAME);
315
            }
325
            }
316
        catch (Exception e)
326
        catch (Exception e)
317
            { }
327
            { }
318
 
328
 
319
        try {
329
        try {
320
                RecordStore recStore = RecordStore.openRecordStore(RECORD_STORE_NAME, true );
330
                RecordStore recStore = RecordStore.openRecordStore(RECORD_STORE_NAME, true );
321
 
331
 
322
                ByteArrayOutputStream bout = new ByteArrayOutputStream();
332
                ByteArrayOutputStream bout = new ByteArrayOutputStream();
323
                DataOutputStream      dout = new   DataOutputStream( bout );
333
                DataOutputStream      dout = new   DataOutputStream( bout );
324
 
334
 
325
                dout.writeUTF(connection_url);
335
                dout.writeUTF(connection_url);
326
                dout.writeUTF(connection_name);
336
                dout.writeUTF(connection_name);
327
 
337
 
328
                dout.writeUTF("");
338
                dout.writeUTF("");
329
                dout.writeUTF("");
339
                dout.writeUTF("");
330
                dout.writeUTF("");
340
                dout.writeUTF("");
331
 
341
 
332
 
342
 
333
                for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++)
343
                for ( int i=0;i<SETTINGS_FIELD_LENGTH;i++)
334
                    dout.writeInt(settings_field[i]);
344
                    dout.writeInt(settings_field[i]);
335
                for ( int i=0;i<5;i++)
345
                for ( int i=0;i<5;i++)
336
                    {
346
                    {
337
                        dout.writeInt(act_proxy_ip[i]);
347
                        dout.writeInt(act_proxy_ip[i]);
338
                        dout.writeInt(act_conn_ip[i]);
348
                        dout.writeInt(act_conn_ip[i]);
339
                    }
349
                    }
340
                recStore.addRecord(bout.toByteArray(),0,bout.size());
350
                recStore.addRecord(bout.toByteArray(),0,bout.size());
341
 
351
 
342
                recStore.closeRecordStore();
352
                recStore.closeRecordStore();
343
 
353
 
344
 
354
 
345
            }
355
            }
346
        catch (Exception e)
356
        catch (Exception e)
347
            {       }
357
            {       }
348
 
358
 
349
    }
359
    }
350
 
360
 
351
}
361
}
352
 
362