/// <summary> /// Creates a new device of the specificied type. /// </summary> /// <param name="type"></param> /// <returns></returns> public Device CreateDevice(CctalkDeviceTypes type) { Device dev = null; switch (type) { case CctalkDeviceTypes.BillValidator: dev = CreateBillValidator(); break; case CctalkDeviceTypes.CoinAcceptor: dev = CreateCoinAcceptor(); break; default: throw new NotImplementedException("No existing implementation for device '" + GenericDevice.GetDeviceTypeName(type) + "'. Check documentation for more info."); } return dev; }
public DeviceErrorEventArgs(CctalkDeviceTypes _type, Byte _error, String _errorMessage) { SourceDeviceType = _type; Error = _error; ErrorMessage = _errorMessage; }
/// <summary> /// Given a device type returns an string with its name. /// </summary> /// <param name="_deviceType">Device type</param> /// <returns>String with the name of the device</returns> public static string GetDeviceTypeName(CctalkDeviceTypes _deviceType) { string deviceName; _deviceNames.TryGetValue(_deviceType, out deviceName); deviceName = deviceName == null ? "Unknown" : deviceName; return deviceName; }
/// <summary> /// Gets de address for commincating with the specified type of device. /// Any configuration given by the user has priority. /// </summary> /// <param name="deviceType">Type of the device whose address is to be /// obtained.</param> /// <returns>Address for communicating with de device.</returns> private byte GetDeviceAddress(CctalkDeviceTypes deviceType) { return DeviceAddress == 0 ? (byte)deviceType : DeviceAddress; }