private static SerialConnectionServiceCommandBase CreateCommandBy(string commandId, string commandData, SerialConnectionServicesController serialConnectionServicesController){
     switch (commandId){
         case "04":
             return new SerialConnectionSensorServiceAcceptDataCommand(commandData, serialConnectionServicesController.BumperServices);
     }
     throw new Exception(string.Format("Command has not been defined for ID={0}", commandId));
 }
 public static SerialConnectionServiceCommandBase CreateBy(string commandText, SerialConnectionServicesController serialConnectionServicesController){
     string command = Regex.Replace(commandText, @"[\*Q]", "");
     var commandId = command.Substring(0, 2);
     var commandData = command.Substring(2);
     try{
         return CreateCommandBy(commandId, commandData, serialConnectionServicesController);
     }
     catch (Exception ex){
         return new SerialConnectionWrongServiceCommand(command, ex);
     }
 }
예제 #3
0
 protected ServiceStateChangedCommand(byte address, SerialConnectionServicesController serialConnectionServicesController) {
     Address = address;
     SerialConnectionServicesController = serialConnectionServicesController;
 }
예제 #4
0
파일: MainForm.cs 프로젝트: satr/rvslite
 private ServiceProvider CreateServicesProvider(TerminalController terminalController){
     var serviceProvider = new ServiceProvider();
     var serialConnectionServicesController = new SerialConnectionServicesController(terminalController);
     serviceProvider.BumperPorts = new List<IService>{
                                                         bumperControl1,
                                                         bumperControl2,
                                                         serialConnectionServicesController.Add(new SerialConnectionBumperService("SC " + Lang.Res.Bumper, 1), 0),
                                                         serialConnectionServicesController.Add(new SerialConnectionBumperService("SC " + Lang.Res.Bumper, 2), 1)
                                                     };
     serviceProvider.LEDPorts = new List<IService>{
                                                      ledControl1,
                                                      ledControl2,
                                                      serialConnectionServicesController.Add(new SerialConnectionLEDService("SC" + Lang.Res.LED), 0)
                                                  };
     serviceProvider.DrivePorts = new List<IService>{
                                                        driveControl1, 
                                                        driveControl2,
                                                        serialConnectionServicesController.Add(new SerialConnectionDriveService("SC " + Lang.Res.Drive, 1), 0),
                                                        serialConnectionServicesController.Add(new SerialConnectionDriveService("SC " + Lang.Res.Drive, 2), 1)
                                                    };
     serviceProvider.MessengerPorts = new List<IService>{messengerEmulatorControl1};
     return serviceProvider;
 }