private void btn_Add_Click(object sender, EventArgs e) { string s1 = tb_DeviceName.Text.Trim(); string s2 = cmb_Model.Text.Trim(); string s3 = tb_CommAddr.Text.Trim(); if (s1 == "") { MessageBox.Show("请输入设备名称!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else if (s2 == "") { MessageBox.Show("请选择模板!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else if (s3 == "") { MessageBox.Show("请输入设备通信地址!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } CDevice obj = new CDevice(); obj.Id = CDevice.Accu; CDevice.Accu += 1; obj.DeviceName = s1; obj.ModelName = s2; obj.CommAddr = Convert.ToInt32(s3); pParent.formInfo.LogMessage(string.Format("新增设备[编号:{0},设备名称:{1},模板名称:{2},通信地址:{3}]", obj.Id, obj.DeviceName, obj.ModelName, obj.CommAddr)); DeviceTable.lst_Device.Add(obj.Id, obj); pParent.addNode_Device(DeviceTable, obj); this.Close(); }
public void DownloadToFile(string filename) { CDevice _device = d_connection_device; if (_device != null && _device.Connect()) { using (FileStream _fs = new FileStream(filename, FileMode.Create)) { byte[] _bytes_sector_zero = _device.RequestSector(0); if (_bytes_sector_zero != null) { if (BitConverter.ToUInt32(_bytes_sector_zero, 0) == 0x3CF18EDA) { _fs.Write(_bytes_sector_zero, 0, 512); uint _last_sector = BitConverter.ToUInt32(_bytes_sector_zero, 4); uint _current_sector = 0; while (_current_sector < _last_sector) { byte[] _bytes_sector = _device.RequestSector(_current_sector + 1); _current_sector++; if (_bytes_sector != null) { _fs.Write(_bytes_sector, 0, 512); } } } } } } }
private void dgv_Device_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex < 0) { return; } ; if (e.ColumnIndex >= 1 && e.ColumnIndex <= 3)//设备名称 { CDevice d = (CDevice)dgv_Device.Rows[e.RowIndex].Tag; if (d == null) { return; } ; if (e.ColumnIndex == 1) { d.DeviceName = Convert.ToString(dgv_Device.Rows[e.RowIndex].Cells[e.ColumnIndex].Value); Form_CfgTool.pMainForm.refresh_TreeNode_DeviceName(DeviceTable, d); } else if (e.ColumnIndex == 2)//设备地址 { d.CommAddr = Convert.ToInt32(dgv_Device.Rows[e.RowIndex].Cells[e.ColumnIndex].Value); } else if (e.ColumnIndex == 3)//模板名称 { string modelname = Convert.ToString(dgv_Device.Rows[e.RowIndex].Cells[e.ColumnIndex].Value); CDevice p = (CDevice)dgv_Device.Rows[e.RowIndex].Tag; if (p != null) { p.ModelName = modelname; } } } }
public void FillChannels(IReadOnlyList <CChannel> channels, long time, CDevice device) { for (int i = 0; i < channels.Count; i++) { channels[i].SetValue(ChannelSampleValues[i + 1]); } }
public void OnDeviceConnectState(int state, CDevice device) { Debug.Log("NxrPlayerCtrl.onDeviceConnectState:" + (state == 0 ? " Connect " : " Disconnect ")); if (state == 0) { // NibiruRemindBox.Instance.CalibrationDelay(); NxrViewer.Instance.HideHeadControl(); NxrViewer.Instance.SwitchControllerMode(true); } }
private int _ReloadList_Get16(CDevice device, ref uint current_sector, ref byte[] bytes_sector, ref int offset) { int _v1 = _ReloadList_Get8(device, ref current_sector, ref bytes_sector, ref offset); if (_v1 == -1) { return(-1); } int _v2 = _ReloadList_Get8(device, ref current_sector, ref bytes_sector, ref offset); if (_v2 == -1) { return(-1); } return((_v2 << 8) | _v1); }
public void FillChannels(IReadOnlyList <CChannel> channels, long time, CDevice device) { for (int i = 0; i < channels.Count; i++) { if (_testingCounter >= 255) { _testingCounter = 1; } channels[i].SetValue(_testingCounter / 255.0f); _testingCounter++; } }
private bool SetDeviceOutput(CDevice device, int devicenr) { string line, strvalue; int linenr = GetLineWithKey("output", m_devicelines[devicenr].lines, out line); if (linenr == -1) { Util.LogError($"{m_filename}: device {device.Name} has no output"); return(false); } Util.GetWord(ref line, out strvalue); device.Output = (strvalue + line); return(true); }
private void SetDeviceAllowSync(CDevice device, int devicenr) { string line, strvalue; int linenr = GetLineWithKey("allowsync", m_devicelines[devicenr].lines, out line); if (linenr == -1) { return; } Util.GetWord(ref line, out strvalue); Util.StrToBool(strvalue, out bool allowsync); device.AllowSync = allowsync; }
private void SetDeviceDebug(CDevice device, int devicenr) { string line, strvalue; int linenr = GetLineWithKey("debug", m_devicelines[devicenr].lines, out line); if (linenr == -1) { return; } Util.GetWord(ref line, out strvalue); Util.StrToBool(strvalue, out bool debug); device.Debug = debug; }
internal void ClearUser(CDevice device) { //clear CDevice* from users if (m_users.ContainsKey(device)) { m_users.Remove(device); } //for (vector<pair<CDevice*, float>>::iterator it = m_users.begin(); it != m_users.end(); it++) //{ // if ((*it).first == device) // { // m_users.erase(it); // return; // } //} }
internal float GetSingleChange(CDevice device) { foreach (CDevice userDevice in m_users.Keys) { if (userDevice == device) { return(m_users[userDevice]); } } //for (int i = 0; i < m_users.Count; i++) //{ // if (m_users.Keys[i] == device) // return m_users[i].second; //} return(0.0f); }
public CLogEntry(EtaLoggingChargerControl logging_charger_control, CDevice device, uint start_sector, string name, CSample[] samples, ECellType cell_type, bool is_discharging) { LoggingChargerControl = logging_charger_control; Device = device; StartSector = start_sector; Name = name; Samples = samples; IsDischarging = is_discharging; CellType = cell_type; ProcessingTime = new TimeSpan(0, 0, Samples.Length / 2); double _avarage_current = 0, _midpoint_voltage = 0, _amp_hour = 0, _watt = 0; foreach (CSample _sample in Samples) { _amp_hour += _sample.CellCurrent; _midpoint_voltage += _sample.CellVoltage; _watt += (_sample.CellVoltage * _sample.CellCurrent); } AvarageCurrent = _amp_hour / Samples.Length; MidpointVoltage = _midpoint_voltage / Samples.Length; AmpHour = _amp_hour / 7200; Wattage = _watt / 7200; }
private void SetDeviceThreadPriority(CDevice device, int devicenr) { string line, strvalue; int linenr = GetLineWithKey("threadpriority", m_devicelines[devicenr].lines, out line); if (linenr == -1) { return; } Util.GetWord(ref line, out strvalue); int priority; priority = int.Parse(strvalue); // TODO: windows priority vs unix priority? do old configs line up??? device.ThreadPriority = (ThreadPriority)priority; }
private void SetDeviceDelayAfterOpen(CDevice device, int devicenr) { string line, strvalue; int linenr = GetLineWithKey("delayafteropen", m_devicelines[devicenr].lines, out line); if (linenr == -1) { return; } Util.GetWord(ref line, out strvalue); int delayafteropen; delayafteropen = int.Parse(strvalue); device.DelayAfterOpen = delayafteropen; }
public void loadSettings() { settings = AppSettings.LoadFromFile(settingsPath + "/settings.xml"); toolboxVisible = settings.toolboxVisible; devices.Clear(); foreach (DeviceSetting devsettings in settings.deviceSettings) { CDevice device = new CDevice(); device.DeviceName = devsettings.DeviceName; Console.WriteLine("Load settings for: " + devsettings.DeviceName); device.driver = createDriverFromName(devsettings.DriverName); if (device.driver == null) { device.driver = new EmptyDriver(); } device.driver.device = device; device.driver.URI = devsettings.DeviceURI; device.driver.Login = devsettings.DeviceLogin; device.driver.Password = devsettings.DevicePassword; devices.Add(device); device.Connect(); } refreshDeviceListInViewWindow(); IDevice dev = null; CameraView view = null; int i = 0; if (settings.viewSettings != null) { foreach (ViewSetting viewsettings in settings.viewSettings) { view = getViewFromID(i); dev = getDeviceFromName(viewsettings.DeviceName); view.setCurrentDevice(dev); i++; } } }
private int _ReloadList_Get8(CDevice device, ref uint current_sector, ref byte[] bytes_sector, ref int offset) { if (offset == 0) { bytes_sector = device.RequestSector(current_sector + 1); current_sector++; if (bytes_sector == null) { return(-1); } } byte _byte = bytes_sector[offset++]; if (offset >= 512) { offset = 0; } return(_byte); }
internal void ResetSingleChange(CDevice device) { foreach (CDevice userDevice in m_users.Keys) { if (userDevice == device) { m_users[userDevice] = 0.0f; return; } } //for (int i = 0; i < m_users.Count; i++) //{ // if (m_users[i].first == device) // { // m_users[i].second = 0.0; // return; // } //} }
public void OnDeviceConnectState(int state, CDevice device) { if (device.getType() != CDevice.DEVICE_NOLO_SIXDOF) { return; } //0=connect,1=disconnect Debug.Log("NxrTrackedDevice.onDeviceConnectState:" + state + "," + device.getType() + "," + device.getName() + "," + device.getMode() + "," + device.getisQuat()); if (state == 0) { _currentStates.connectStatus = 1; NxrViewer.Instance.SwitchControllerMode(true); } else { _currentStates.connectStatus = 0; } }
private bool SetDeviceChannels(CDevice device, int devicenr) { string line, strvalue; int linenr = GetLineWithKey("channels", m_devicelines[devicenr].lines, out line); if (linenr == -1) { Util.LogError($"{m_filename}: device {device.Name} has no channels"); return(false); } Util.GetWord(ref line, out strvalue); int nrchannels; nrchannels = int.Parse(strvalue); device.NrChannels = nrchannels; return(true); }
internal void AddUser(CDevice device) { //add CDevice pointer to users if it doesn't exist yet foreach (CDevice userDevice in m_users.Keys) { if (userDevice == device) { return; } } //for (unsigned int i = 0; i < m_users.size(); i++) //{ // if (m_users[i].first == device) // return; //} m_users.Add(device, 0.0f); }
private void SetDevicePostfix(CDevice device, int devicenr) { string line, strvalue; List <byte> postfix = new List <byte>(); //TODO, confirm size of type uint8_t int linenr = GetLineWithKey("postfix", m_devicelines[devicenr].lines, out line); if (linenr == -1) { return; //postfix is optional, so this is not an error } while (Util.GetWord(ref line, out strvalue)) { byte ipostfix; ipostfix = byte.Parse(strvalue, NumberStyles.HexNumber, null); postfix.Add(ipostfix); } device.m_postfix = postfix; }
private bool SetDeviceInterval(CDevice device, int devicenr) { string line, strvalue; int linenr = GetLineWithKey("interval", m_devicelines[devicenr].lines, out line); if (linenr == -1) { Util.LogError($"{m_filename}: device {device.Name} has no interval"); return(false); } Util.GetWord(ref line, out strvalue); int interval; interval = int.Parse(strvalue); device.Interval = interval; return(true); }
public void FillChannels(IReadOnlyList <CChannel> channels, long time, CDevice device) { for (int j = 0; j < channels.Count; j++) { if (j == _nextChannel) { channels[j].SetValue(_nextColor == 0xFF0000 ? 1f : 0f); // red j++; channels[j].SetValue(_nextColor == 0x00FF00 ? 1f : 0f); // green j++; channels[j].SetValue(_nextColor == 0x0000FF ? 1f : 0f); // blue } else { channels[j].SetValue(0f); // red j++; channels[j].SetValue(0f); // green j++; channels[j].SetValue(0f); // blue } } if (_nextColor == 0xFF0000) { _nextColor = 0x00FF00; } else if (_nextColor == 0x00FF00) { _nextColor = 0x0000FF; } else { _nextColor = 0xFF0000; } _nextChannel += 3; if (_nextChannel >= channels.Count) { _nextChannel = 0; } }
public void FillChannels(IReadOnlyList <CChannel> channels, long time, CDevice device) { for (int i = 0; i < channels.Count; i++) { channels[i].SetValue(_red); i++; channels[i].SetValue(_green); i++; channels[i].SetValue(_blue); } _executions++; if (_executions >= _nextChange) { _nextChange += 100; if (_red == 1f) { _red = 0f; _green = 1f; _blue = 0f; } else if (_green == 1f) { _red = 0f; _green = 0f; _blue = 1f; } else { _red = 1f; _green = 0f; _blue = 0f; } } }
public void restoreFromCfg() { Global.g_list_DeviceTable.Clear(); CDevice.Accu = 1; CDeviceTable.Accu = 1; //---- for (int m = 0; m < u32DevsNum; m++) { CDeviceTable dt = new CDeviceTable(); dt.Id = CDeviceTable.Accu; CDeviceTable.Accu += 1; dt.DeviceTableName = tDevsCfg[m].sName; for (int k = 0; k < tDevsCfg[m].u32DevNum; k++) { CDevice dev = new CDevice(); dev.Id = CDevice.Accu; CDevice.Accu += 1; dev.DeviceName = tDevsCfg[m].tDevCfg[k].sName; dev.ModelName = getModelName(tDevsCfg[m].tDevCfg[k].u32ModelIndex); dt.lst_Device.Add(dev.Id, dev); } Global.g_list_DeviceTable.Add(dt.Id, dt); } }
public void ReloadList() { CDevice _device = d_connection_device; if (_device != null && _device.Connect()) { byte[] _bytes_sector_zero = _device.RequestSector(0); if (_bytes_sector_zero != null) { if (BitConverter.ToUInt32(_bytes_sector_zero, 0) == 0x3CF18EDA) { List <CLogEntry> _list_log_entries = new List <CLogEntry>(); uint _last_sector = BitConverter.ToUInt32(_bytes_sector_zero, 4); uint _current_sector = 0; while (_current_sector < _last_sector) { uint _entry_start_sector = _current_sector + 1; byte[] _bytes_sector_header = _device.RequestSector(_entry_start_sector); _current_sector++; if (_bytes_sector_header == null) { break; } uint _entry_signature = BitConverter.ToUInt32(_bytes_sector_header, 0); uint _entries_count = BitConverter.ToUInt32(_bytes_sector_header, 4); CLogEntry.ECellType _cell_type = (CLogEntry.ECellType)_bytes_sector_header[8]; bool _is_discharging = BitConverter.ToBoolean(_bytes_sector_header, 9); Encoding _enc = Encoding.ASCII; string _name = _enc.GetString(_bytes_sector_header, 32, Array.IndexOf <byte>(_bytes_sector_header, 0, 32, 32) - 32); byte[] _bytes_sector = null; int _offset = 0; CLogEntry.CSample[] _samples = new CLogEntry.CSample[_entries_count]; int _sample_idx = 0; while (_entries_count > 0) { double _cell_current, _cell_voltage, _cell_sensed_voltage; if (_entry_signature == 0xD236FAC4) { // old 24 bit voltage value version int _v_cell_current = _ReloadList_Get24(_device, ref _current_sector, ref _bytes_sector, ref _offset); if (_v_cell_current == -1) { break; } int _v_cell_voltage = _ReloadList_Get24(_device, ref _current_sector, ref _bytes_sector, ref _offset); if (_v_cell_voltage == -1) { break; } int _v_cell_sensed_voltage = _ReloadList_Get24(_device, ref _current_sector, ref _bytes_sector, ref _offset); if (_v_cell_sensed_voltage == -1) { break; } _cell_current = (double)_v_cell_current / 10000; _cell_voltage = (double)_v_cell_voltage / 10000; _cell_sensed_voltage = (double)_v_cell_sensed_voltage / 10000; } else if (_entry_signature == 0x2C483AC7) { // new 16 bit voltage value version int _v_cell_current = _ReloadList_Get24(_device, ref _current_sector, ref _bytes_sector, ref _offset); if (_v_cell_current == -1) { break; } int _v_cell_voltage = _ReloadList_Get16(_device, ref _current_sector, ref _bytes_sector, ref _offset); if (_v_cell_voltage == -1) { break; } int _v_cell_sensed_voltage = _ReloadList_Get16(_device, ref _current_sector, ref _bytes_sector, ref _offset); if (_v_cell_sensed_voltage == -1) { break; } _cell_current = (double)_v_cell_current / 10000; _cell_voltage = (double)_v_cell_voltage / 1000; _cell_sensed_voltage = (double)_v_cell_sensed_voltage / 1000; } else { break; } _samples[_sample_idx++] = new CLogEntry.CSample(_cell_current, _cell_voltage, _cell_sensed_voltage); _entries_count--; } if (_entries_count > 0) { break; } _list_log_entries.Add(new CLogEntry(this, _device, _entry_start_sector, _name, _samples, _cell_type, _is_discharging)); } d_log_entries = _list_log_entries.ToArray(); OnPropertyChanged(nameof(LogEntries)); OnPropertyChanged(nameof(IsValid)); } } _device.Disconnect(); } }
public void FillChannels(IReadOnlyList <CChannel> channels, long time, CDevice device) { List <CLight> usedlights = new List <CLight>(); lock (m_mutex) { //get the oldest client with the highest priority for (int i = 0; i < channels.Count; i++) { long clienttime = 0x7fffffffffffffff; int priority = 255; int light = channels[i].Light; int color = channels[i].Color; int clientnr = -1; if (light == -1 || color == -1) //unused channel { continue; } for (int j = 0; j < m_clients.Count; j++) { if (m_clients[j].m_priority == 255 || m_clients[j].m_connecttime == -1 || !m_clients[j].m_lights[light].GetUse()) { continue; //this client we don't use } //this client has a high priority (lower number) than the current one, or has the same and is older if (m_clients[j].m_priority < priority || (priority == m_clients[j].m_priority && m_clients[j].m_connecttime < clienttime)) { clientnr = j; clienttime = m_clients[j].m_connecttime; priority = m_clients[j].m_priority; } } if (clientnr == -1) //no client for the light on this channel { channels[i].m_isused = false; channels[i].SetSpeed(m_lights[light].GetSpeed()); channels[i].SetValueToFallback(); channels[i].SetGamma(1.0f); channels[i].SetAdjust(1.0f); channels[i].SetBlacklevel(0.0f); continue; } //fill channel with values from the client channels[i].SetUsed(true); channels[i].SetValue(m_clients[clientnr].m_lights[light].GetColorValue(color, time)); channels[i].SetSpeed(m_clients[clientnr].m_lights[light].GetSpeed()); channels[i].SetGamma(m_clients[clientnr].m_lights[light].GetGamma(color)); channels[i].SetAdjust(m_clients[clientnr].m_lights[light].GetAdjust(color)); channels[i].SetBlacklevel(m_clients[clientnr].m_lights[light].GetBlacklevel(color)); channels[i].SetSingleChange(m_clients[clientnr].m_lights[light].GetSingleChange(device)); //save pointer to this light because we have to reset the singlechange later //more than one channel can use a light so can't do this from the loop usedlights.Add(m_clients[clientnr].m_lights[light]); } //reset singlechange var distinctLights = usedlights.Distinct(); foreach (var usedLight in distinctLights) { usedLight.ResetSingleChange(device); } //update which lights we're using foreach (CClient client in m_clients) { foreach (CLight clientLight in client.m_lights) { bool lightused = false; foreach (CLight it in distinctLights) { if (it == clientLight) { lightused = true; break; } } if (lightused) { clientLight.AddUser(device); } else { clientLight.ClearUser(device); } } } } }
private bool BuildDeviceConfig(List <CDevice> devices, IChannelDataProvider clients) { for (int i = 0; i < m_devicelines.Count; i++) { string line; int linenr = GetLineWithKey("type", m_devicelines[i].lines, out line); string type; Util.GetWord(ref line, out type); if (type == "popen") { throw new NotImplementedException("'popen' devices not supported yet"); //CDevice device = null; //if (!BuildPopen(device, i, clients)) //{ // if (device) // delete device; // return false; //} //devices.push_back(device); } else if (type == "momo" || type == "atmo" || type == "karate" || type == "sedu") { CDevice device = null; if (!BuildRS232(out device, i, clients, type)) { if (device != null) { device = null; //TODO: Call dispose instead??? } return(false); } devices.Add(device); } else if (type == "ltbl") { throw new NotImplementedException("'ltbl' devices not supported yet"); //CDevice* device = NULL; //if (!BuildLtbl(device, i, clients)) //{ // if (device) // delete device; // return false; //} //devices.push_back(device); } else if (type == "ola") { throw new NotImplementedException("'ola' devices not supported yet"); //# ifdef HAVE_OLA // CDevice* device = NULL; // if (!BuildOla(device, i, clients)) // { // if (device) // delete device; // return false; // } // devices.push_back(device); //#else // LogError("%s line %i: boblightd was built without ola, recompile with enabled ola support", // m_filename.c_str(), linenr); // return false; //#endif } else if (type == "sound") { throw new NotImplementedException("'sound' devices not supported yet"); //# ifdef HAVE_LIBPORTAUDIO // CDevice* device = NULL; // if (!BuildSound(device, i, clients)) // { // if (device) // delete device; // return false; // } // devices.push_back(device); //#else // LogError("%s line %i: boblightd was built without portaudio, no support for sound devices", // m_filename.c_str(), linenr); // return false; //#endif } else if (type == "dioder") { throw new NotImplementedException("'dioder' devices not supported yet"); //CDevice* device = NULL; //if (!BuildDioder(device, i, clients)) //{ // if (device) // delete device; // return false; //} //devices.push_back(device); } else if (type == "ambioder") { throw new NotImplementedException("'ambioder' devices not supported yet"); //CDevice* device = NULL; //if (!BuildAmbioder(device, i, clients)) //{ // if (device) // delete device; // return false; //} //devices.push_back(device); } else if (type == "ibelight") { throw new NotImplementedException("'ibelight' devices not supported yet"); //# ifdef HAVE_LIBUSB // CDevice* device = NULL; // if (!BuildiBeLight(device, i, clients)) // { // if (device) // delete device; // return false; // } // devices.push_back(device); //#else // LogError("%s line %i: boblightd was built without libusb, no support for ibelight devices", // m_filename.c_str(), linenr); // return false; //#endif } else if (type == "lightpack") { throw new NotImplementedException("'lightpack' devices not supported yet"); //# ifdef HAVE_LIBUSB // CDevice* device = NULL; // if (!BuildLightpack(device, i, clients)) // { // if (device) // delete device; // return false; // } // devices.push_back(device); //#else // LogError("%s line %i: boblightd was built without libusb, no support for lightpack devices", // m_filename.c_str(), linenr); // return false; //#endif } else if (type == "lpd8806" || type == "ws2801") { throw new NotImplementedException("'lpd8806' and 'ws2801' devices are not supported yet"); //# ifdef HAVE_LINUX_SPI_SPIDEV_H // CDevice* device = NULL; // if (!BuildSPI(device, i, clients, type)) // { // if (device) // delete device; // return false; // } // devices.push_back(device); //#else // LogError("%s line %i: boblightd was built without spi, no support for lpd8806 devices", // m_filename.c_str(), linenr); // return false; //#endif } else { Util.LogError($"{m_filename} line {linenr}: unknown type {type}"); return(false); } } return(true); }
private bool BuildRS232(out CDevice device, int devicenr, IChannelDataProvider clients, string type) { CDeviceRS232 rs232device = new CDeviceRS232(clients); device = rs232device; if (!SetDeviceName(rs232device, devicenr)) { return(false); } if (!SetDeviceOutput(rs232device, devicenr)) { return(false); } if (!SetDeviceChannels(rs232device, devicenr)) { return(false); } if (!SetDeviceRate(rs232device, devicenr)) { return(false); } if (!SetDeviceInterval(rs232device, devicenr)) { return(false); } SetDeviceAllowSync(device, devicenr); SetDeviceDebug(device, devicenr); SetDeviceDelayAfterOpen(device, devicenr); SetDeviceThreadPriority(device, devicenr); bool hasbits = SetDeviceBits(rs232device, devicenr); bool hasmax = SetDeviceMax(rs232device, devicenr); if (hasbits && hasmax) { Util.LogError($"{m_filename}: device {rs232device.Name} has both bits and max set"); return(false); } if (type == "momo") { device.Type = CDevice.MOMO; SetDevicePrefix(rs232device, devicenr); SetDevicePostfix(rs232device, devicenr); } else if (type == "atmo") { device.Type = CDevice.ATMO; } else if (type == "karate") { device.Type = CDevice.KARATE; } else if (type == "sedu") { device.Type = CDevice.SEDU; } return(true); }