public static string LocalizedString(this DeviceConnectionType connectionType) { switch (connectionType) { case DeviceConnectionType.USB: return(Translations.Language.Enum_DeviceConnectionType_USB); case DeviceConnectionType.BLUETOOTH: return(Translations.Language.Enum_DeviceConnectionType_Bluetooth); case DeviceConnectionType.BLUETOOTHLE: return(Translations.Language.Enum_DeviceConnectionType_BluetoothLE); case DeviceConnectionType.SIMULATOR: return(Translations.Language.Enum_DeviceConnectionType_Simulator); case DeviceConnectionType.TCP: return(Translations.Language.Enum_DeviceConnectionType_TCP); default: throw new ArgumentOutOfRangeException("connectionType"); } }
/// <summary> /// Method to initialize network connection, configuration and deviceinfomanager class /// </summary> /// <param name="ipAddress">IPAddress value</param> /// <param name="port">Port value</param> /// <param name="connectionType">DeviceConnectionType</param> protected void Initialize(string ipAddress, string port, DeviceConnectionType connectionType) { try { nc = new NetworkConnection(); nc.DeviceSettings.IPaddress = ipAddress; nc.DeviceSettings.Port = port; nc.DeviceSettings.ConnectionType = connectionType; nc.ReceiveTimeout = 1200000; nc.SendTimeout = 600000; Logger.Info("Starting Wait Connection"); if (WaitForConnection(ipAddress, Convert.ToInt16(port), 15, 10)) { nc.OpenConnection(); Logger.Info(nc.IsOpen.ToString() + nc.DeviceSettings.Port + nc.DeviceSettings.IPaddress); ncm = new NetworkConfigurationManager(nc); Logger.Info(ncm.RetrieveEthernetNetworkSettings().IPAddress.ToString() + ncm.RetrieveEthernetNetworkSettings().Port.ToString()); dim = new DeviceInfoManager(nc); Logger.Info("SDK: Initialize success for IP: " + ipAddress + " and PORT: " + port); } else { throw new Exception("SDK: Failed to initialize network connection. Socket unavailable"); } } catch (IXMSDKException ex) { Logger.Error(ex, "SDK: SDKException"); } catch (Exception ex) { Logger.Error(ex, "SDK: Failed to initialize methods for sdk for IP: " + ipAddress + " and PORT: " + port); throw; } }
public Builder ConnectionType(DeviceConnectionType connectionType) { _code.ConnectionType = connectionType; return(this); }
public GeneralInfo_SDK(string ipAddress, string port, DeviceConnectionType connectionType) : base(ipAddress, port, connectionType) { deviceInfo = dim.GetDeviceInfoByIP(); }
public DeviceInfo_SDK(string ipAddress, string port, DeviceConnectionType connectionType) { Logger.Info("SDK: Initializing device network connection"); Initialize(ipAddress, port, connectionType); }