00001 package ;
00002
00003
00011
00012
00013 import config.*;
00014
00015
00016 class SCT_Chip_Impl implements SCT_Chip {
00017
00018
00019
00020 private config.Configuration p_db;
00021 private config.ConfigObject p_obj;
00022 private boolean p_was_read;
00023 private boolean p_is_valid;
00024 private String p_uid;
00025 private String p_class_name;
00026
00027
00028
00029
00030 private short m_id;
00031 private short m_address;
00032 private boolean m_active;
00033 private short m_vthr;
00034 private short m_vcal;
00035 private short m_delay;
00036 private short m_preamp;
00037 private short m_shaper;
00038 private String m_rc_function;
00039 private short m_rc_function_type;
00040 private short[] m_config;
00041 private float m_c_factor;
00042 private float m_target;
00043 private int[] m_trims;
00044 private int[] m_mask;
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 public SCT_Chip_Impl() {
00055 p_is_valid = false;
00056 }
00057
00058 public SCT_Chip_Impl(config.Configuration db, config.ConfigObject obj) {
00059 init_config_params(db, obj);
00060 }
00061
00062 public void init_config_params(config.Configuration db, config.ConfigObject obj) {
00063 p_db = db;
00064 p_obj = obj;
00065 p_was_read = false;
00066 p_is_valid = true;
00067 p_uid = p_obj.UID();
00068 p_class_name = p_obj.class_name();
00069 }
00070
00071 public String UID() {
00072 return p_uid;
00073 }
00074
00075 public String class_name() {
00076 return p_class_name;
00077 }
00078
00079 public void update(boolean set_non_valid) {
00080 if(set_non_valid == true) {
00081 p_is_valid = false;
00082 }
00083 else {
00084 p_was_read = false;
00085 p_obj.clean();
00086 init();
00087 }
00088 }
00089
00090 public void unread() {
00091 p_was_read = false;
00092 }
00093
00094 public boolean is_valid() {
00095 return p_is_valid;
00096 }
00097
00098
00099
00100 private void init() throws config.NotFoundException, config.NotValidException, config.SystemException {
00101 if(p_was_read == true) {return;}
00102
00103 if(p_is_valid == false) {
00104 String text = "ERROR [.SCT_Chip_Impl.init()]: object " + p_uid + "@" + p_class_name + " is not valid";
00105 System.err.println(text);
00106 throw new config.NotValidException(text);
00107 }
00108
00109 m_id = p_obj.get_short("id");
00110
00111 m_address = p_obj.get_short("address");
00112
00113 m_active = p_obj.get_bool("active");
00114
00115 m_vthr = p_obj.get_short("vthr");
00116
00117 m_vcal = p_obj.get_short("vcal");
00118
00119 m_delay = p_obj.get_short("delay");
00120
00121 m_preamp = p_obj.get_short("preamp");
00122
00123 m_shaper = p_obj.get_short("shaper");
00124
00125 m_rc_function = p_obj.get_string("rc_function");
00126 m_rc_function = (String)p_db.convert((Object)m_rc_function, p_obj, "rc_function");
00127
00128 m_rc_function_type = p_obj.get_short("rc_function_type");
00129
00130 m_config = p_obj.get_shorts("config");
00131
00132 m_c_factor = p_obj.get_float("c_factor");
00133
00134 m_target = p_obj.get_float("target");
00135
00136 m_trims = p_obj.get_ints("trims");
00137
00138 m_mask = p_obj.get_ints("mask");
00139
00140
00141 p_was_read = true;
00142
00143 }
00144
00145 public short get_id() {
00146 if(p_was_read == false) {init();}
00147 return m_id;
00148 }
00149
00150 public void set_id(short value) {
00151 p_obj.clean();
00152 p_obj.set_short("id", value);
00153 }
00154
00155 public short get_address() {
00156 if(p_was_read == false) {init();}
00157 return m_address;
00158 }
00159
00160 public void set_address(short value) {
00161 p_obj.clean();
00162 p_obj.set_short("address", value);
00163 }
00164
00165 public boolean get_active() {
00166 if(p_was_read == false) {init();}
00167 return m_active;
00168 }
00169
00170 public void set_active(boolean value) {
00171 p_obj.clean();
00172 p_obj.set_bool("active", value);
00173 }
00174
00175 public short get_vthr() {
00176 if(p_was_read == false) {init();}
00177 return m_vthr;
00178 }
00179
00180 public void set_vthr(short value) {
00181 p_obj.clean();
00182 p_obj.set_short("vthr", value);
00183 }
00184
00185 public short get_vcal() {
00186 if(p_was_read == false) {init();}
00187 return m_vcal;
00188 }
00189
00190 public void set_vcal(short value) {
00191 p_obj.clean();
00192 p_obj.set_short("vcal", value);
00193 }
00194
00195 public short get_delay() {
00196 if(p_was_read == false) {init();}
00197 return m_delay;
00198 }
00199
00200 public void set_delay(short value) {
00201 p_obj.clean();
00202 p_obj.set_short("delay", value);
00203 }
00204
00205 public short get_preamp() {
00206 if(p_was_read == false) {init();}
00207 return m_preamp;
00208 }
00209
00210 public void set_preamp(short value) {
00211 p_obj.clean();
00212 p_obj.set_short("preamp", value);
00213 }
00214
00215 public short get_shaper() {
00216 if(p_was_read == false) {init();}
00217 return m_shaper;
00218 }
00219
00220 public void set_shaper(short value) {
00221 p_obj.clean();
00222 p_obj.set_short("shaper", value);
00223 }
00224
00225 public String get_rc_function() {
00226 if(p_was_read == false) {init();}
00227 return m_rc_function;
00228 }
00229
00230 public void set_rc_function(String value) {
00231 p_obj.clean();
00232 p_obj.set_string("rc_function", value);
00233 }
00234
00235 public short get_rc_function_type() {
00236 if(p_was_read == false) {init();}
00237 return m_rc_function_type;
00238 }
00239
00240 public void set_rc_function_type(short value) {
00241 p_obj.clean();
00242 p_obj.set_short("rc_function_type", value);
00243 }
00244
00245 public short[] get_config() {
00246 if(p_was_read == false) {init();}
00247 return m_config;
00248 }
00249
00250 public void set_config(short[] value) {
00251 p_obj.clean();
00252 p_obj.set_shorts("config", value);
00253 }
00254
00255 public float get_c_factor() {
00256 if(p_was_read == false) {init();}
00257 return m_c_factor;
00258 }
00259
00260 public void set_c_factor(float value) {
00261 p_obj.clean();
00262 p_obj.set_float("c_factor", value);
00263 }
00264
00265 public float get_target() {
00266 if(p_was_read == false) {init();}
00267 return m_target;
00268 }
00269
00270 public void set_target(float value) {
00271 p_obj.clean();
00272 p_obj.set_float("target", value);
00273 }
00274
00275 public int[] get_trims() {
00276 if(p_was_read == false) {init();}
00277 return m_trims;
00278 }
00279
00280 public void set_trims(int[] value) {
00281 p_obj.clean();
00282 p_obj.set_ints("trims", value);
00283 }
00284
00285 public int[] get_mask() {
00286 if(p_was_read == false) {init();}
00287 return m_mask;
00288 }
00289
00290 public void set_mask(int[] value) {
00291 p_obj.clean();
00292 p_obj.set_ints("mask", value);
00293 }
00294
00295 public config.ConfigObject config_object() {
00296 return p_obj;
00297 }
00298
00299 public void print(String dx) {
00300 System.out.println(dx + "SCT_Chip object:" );
00301 System.out.println(dx + " id: \'" + UID() + "\', class name: \'" + class_name() + "\'");
00302
00303
00304
00305
00306 System.out.println(dx + " id: " + get_id());
00307 System.out.println(dx + " address: " + Long.toHexString((long)get_address()));
00308 System.out.println(dx + " active: " + get_active());
00309 System.out.println(dx + " vthr: " + Long.toHexString((long)get_vthr()));
00310 System.out.println(dx + " vcal: " + Long.toHexString((long)get_vcal()));
00311 System.out.println(dx + " delay: " + Long.toHexString((long)get_delay()));
00312 System.out.println(dx + " preamp: " + Long.toHexString((long)get_preamp()));
00313 System.out.println(dx + " shaper: " + Long.toHexString((long)get_shaper()));
00314 System.out.println(dx + " rc_function: " + get_rc_function());
00315 System.out.println(dx + " rc_function_type: " + get_rc_function_type());
00316 if(get_config().length > 0) {
00317 System.out.print(dx + " " + get_config().length + " value(s) in config : ");
00318
00319 for(int i = 0; i < get_config().length; i++) {
00320 if(i != 0) {System.out.print(", ");}
00321 System.out.print(get_config()[i]);
00322 }
00323
00324 System.out.println("");
00325 }
00326 else {
00327 System.out.println(dx + " config value is empty");
00328 }
00329 System.out.println(dx + " c_factor: " + get_c_factor());
00330 System.out.println(dx + " target: " + get_target());
00331 if(get_trims().length > 0) {
00332 System.out.print(dx + " " + get_trims().length + " value(s) in trims : ");
00333
00334 for(int i = 0; i < get_trims().length; i++) {
00335 if(i != 0) {System.out.print(", ");}
00336 System.out.print(Long.toHexString(get_trims()[i]));
00337 }
00338
00339 System.out.println("");
00340 }
00341 else {
00342 System.out.println(dx + " trims value is empty");
00343 }
00344 if(get_mask().length > 0) {
00345 System.out.print(dx + " " + get_mask().length + " value(s) in mask : ");
00346
00347 for(int i = 0; i < get_mask().length; i++) {
00348 if(i != 0) {System.out.print(", ");}
00349 System.out.print(Long.toHexString(get_mask()[i]));
00350 }
00351
00352 System.out.println("");
00353 }
00354 else {
00355 System.out.println(dx + " mask value is empty");
00356 }
00357
00358
00359
00360
00361 }
00362
00368 public void destroy(config.Configuration db) {
00369 db.destroy(config_object());
00370 }
00371 }