Пример #1
0
 /// <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;
 }
Пример #2
0
 public DeviceErrorEventArgs(CctalkDeviceTypes _type, Byte _error, String _errorMessage)
 {
     SourceDeviceType = _type;
     Error = _error;
     ErrorMessage = _errorMessage;
 }
Пример #3
0
 /// <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;
 }
Пример #4
0
 /// <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;
 }