コード例 #1
0
ファイル: AstroData.cs プロジェクト: pprasit/Project
        public static ReturnKnowType GRBHandler(String Ra, String Dec, String FOV, DateTime UpdateTIme)
        {
            StationHandler ThisSite = KeeperData.FirstOrDefault(Item => Item.StationName == STATIONNAME.TNO);

            if (ThisSite == null)
            {
                return(ReturnKnowType.DefineReturn(ReturnStatus.FAILED, "Station TNO 2.4 Meter Telescope is now offline. Please contact Pakawat Prasit", null));
            }

            try
            {
                //ReturnDeviceInformation OutHum = ThisSite.GetDataT07ByCommandName(DEVICENAME.T24WSC, InformationdName.WEATHER_ATTRIBUTE_DATA_OUTHUM);
                //ReturnDeviceInformation Temp = ThisSite.GetDataT07ByCommandName(DEVICENAME.T24WSC, InformationdName.WEATHER_ATTRIBUTE_DATA_TEMPOUT);
                //ReturnDeviceInformation DewPt = ThisSite.GetDataT07ByCommandName(DEVICENAME.T24WSC, InformationdName.WEATHER_ATTRIBUTE_DATA_DEWPT);
                //ReturnDeviceInformation InfoDate = ThisSite.GetDataT07ByCommandName(DEVICENAME.T24WSC, InformationdName.WEATHER_ATTRIBUTE_DATA_DATE);
                //ReturnDeviceInformation InfoTime = ThisSite.GetDataT07ByCommandName(DEVICENAME.T24WSC, InformationdName.WEATHER_ATTRIBUTE_DATA_TIME);

                //if (Convert.ToDouble(OutHum.ReturnValue.Value) > 85)
                //    return ReturnKnowType.DefineReturn(ReturnStatus.Failed, "We can not open the dome because the humidity is heighter than 85%. (Weather time is " + InfoDate.ReturnValue.Value.ToString() +
                //        " " + InfoTime.ReturnValue.Value.ToString() + ")", null);
                //else if (Convert.ToDouble(Temp.ReturnValue.Value) - Convert.ToDouble(DewPt.ReturnValue.Value) <= 2)
                //    return ReturnKnowType.DefineReturn(ReturnStatus.Failed, "We can not open the dome because the dew point is too height. (Weather time is " + InfoDate.ReturnValue.Value.ToString() +
                //        " " + InfoTime.ReturnValue.Value.ToString() + ")", null);
            }
            catch { }

            return(ThisSite.RelayGRB(Ra, Dec, FOV, UpdateTIme));
        }
コード例 #2
0
        internal AddToRoom(Context _ctx, Room _room, StationHandler _handler)
        {
            InitializeComponent();
            room    = _room;
            ctx     = _ctx;
            handler = _handler;
            Label_RoomName.Content = room.roomName;
            handler.switchLedBlink(true);

            //dimensiono graficamente la stanza
            if (GridRoom.Width > 100 || GridRoom.Height > 100)
            {
                GridRoom.Width     = room.size.X;
                GridRoom.Height    = room.size.Y;
                Canvas_Room.Width  = room.size.X;
                Canvas_Room.Height = room.size.Y;
            }
            else
            {
                GridRoom.Width     = room.size.X * 100;
                GridRoom.Height    = room.size.Y * 100;
                Canvas_Room.Width  = room.size.X * 100;
                Canvas_Room.Height = room.size.Y * 100;
            }

            ComputeRadius();             //calcolo raggio grafico
            LoadStations();
        }
コード例 #3
0
        public static void SendScriptToStation(ScriptTB CompletedScript)
        {
            STATIONNAME     DestinationStation = STATIONNAME.NULL;
            List <ScriptTB> ScriptArr          = ScriptDBBuffer.Values.Where(Item => Item.BlockID == CompletedScript.BlockID).ToList();

            ScriptStructure[] StructureArr = ConvertScriptTBToScriptStructure(ScriptArr);

            foreach (ScriptTB ThisScript in ScriptArr)
            {
                DestinationStation     = TTCSHelper.StationStrConveter(ThisScript.StationName);
                ThisScript.ScriptState = SCRIPTSTATE.WAITINGSERVER.ToString();

                UpdateScriptToMonitoring(ThisScript);
            }

            StationHandler ThisStation = AstroData.GetStationObject(DestinationStation);

            if (ThisStation.IsStationConnected)
            {
                StructureArr.OrderBy(Item => Item.ExecutionNumber);
                AstroData.ScriptHandler(DestinationStation, StructureArr);

                foreach (ScriptTB ThisScript in ScriptArr)
                {
                    ThisScript.ScriptState = SCRIPTSTATE.SENDINGTOSTATION.ToString();
                    UpdateScriptToMonitoring(ThisScript);
                }
            }
        }
コード例 #4
0
ファイル: AstroData.cs プロジェクト: pprasit/Project
        private static void SubFrameChecking(DEVICENAME DeviceName, StationHandler ExistingStation)
        {
            try
            {
                int STARTX      = Convert.ToInt32(ExistingStation.GetInformation(DeviceName, IMAGING.IMAGING_STARTX).Value);
                int STARTY      = Convert.ToInt32(ExistingStation.GetInformation(DeviceName, IMAGING.IMAGING_STARTX).Value);
                int CAMERAXSIZE = Convert.ToInt32(ExistingStation.GetInformation(DeviceName, IMAGING.IMAGING_CCD_CAMERAXSIZE).Value);
                int CAMERAYSIZE = Convert.ToInt32(ExistingStation.GetInformation(DeviceName, IMAGING.IMAGING_CCD_CAMERAYSIZE).Value);
                int NUMX        = Convert.ToInt32(ExistingStation.GetInformation(DeviceName, IMAGING.IMAGING_STARTX).Value);
                int NUMY        = Convert.ToInt32(ExistingStation.GetInformation(DeviceName, IMAGING.IMAGING_STARTX).Value);
                int BINX        = Convert.ToInt32(ExistingStation.GetInformation(DeviceName, IMAGING.IMAGING_CCD_BINX).Value);
                int BINY        = Convert.ToInt32(ExistingStation.GetInformation(DeviceName, IMAGING.IMAGING_CCD_BINY).Value);

                if (STARTX > 0 && STARTY > 0 && NUMX < CAMERAXSIZE && NUMY < CAMERAYSIZE && BINX > 1 && BINY > 1)
                {
                    ExistingStation.NewIMAGINGInformation(DeviceName, IMAGING.IMAGING_CCD_ISSUBFRAMEON, true, DateTime.UtcNow);
                }
                else
                {
                    ExistingStation.NewIMAGINGInformation(DeviceName, IMAGING.IMAGING_CCD_ISSUBFRAMEON, false, DateTime.UtcNow);
                }
            }
            catch
            {
                ExistingStation.NewIMAGINGInformation(DeviceName, IMAGING.IMAGING_CCD_ISSUBFRAMEON, false, DateTime.UtcNow);
            }
        }
コード例 #5
0
ファイル: AstroData.cs プロジェクト: pprasit/Project
        public static void CreateStation(STATIONNAME StationName, List <DEVICEMAPPER> AvaliableDevices)
        {
            StationHandler NewStation = new StationHandler();

            NewStation.CreateEngine(StationName, AvaliableDevices);

            KeeperData.Add(NewStation);
        }
コード例 #6
0
ファイル: AstroData.cs プロジェクト: pprasit/Project
        public static void NewGPSInformation(String DataGroupID, STATIONNAME StationName, DEVICENAME DeviceName, GPS FieldName, Object Value, DateTime DataTimestamp, Boolean IsHistory)
        {
            StationHandler ExistingStation = KeeperData.FirstOrDefault(Item => Item.StationName == StationName);

            if (ExistingStation != null)
            {
                ExistingStation.NewGPSInformation(DataGroupID, DeviceName, FieldName, Value, DataTimestamp, IsHistory);
            }
        }
コード例 #7
0
ファイル: AstroData.cs プロジェクト: pprasit/Project
        public static void NewASTROSERVERInformation(STATIONNAME StationName, DEVICENAME DeviceName, ASTROSERVER FieldName, Object Value, DateTime DataTimestamp)
        {
            StationHandler ExistingStation = KeeperData.FirstOrDefault(Item => Item.StationName == StationName);

            if (ExistingStation != null)
            {
                ExistingStation.NewASTROSERVERInformation(DeviceName, FieldName, Value, DataTimestamp);
            }
        }
コード例 #8
0
        public static void Init()
        {
            connection = DBConnection.CreateConnection();
            Storage    = new StorageHandler(connection);
            Channel    = new ChannelHandler(connection);
            Station    = new StationHandler(connection);

            UpdateChache();
        }
コード例 #9
0
ファイル: AstroData.cs プロジェクト: pprasit/Project
        public static void SubscribeInformation(STATIONNAME StationName, DEVICENAME DeviceName, dynamic FieldName, String SessionID, Object CallBackObject)
        {
            StationHandler SiteInformation = KeeperData.FirstOrDefault(Item => Item.StationName == StationName);

            if (SiteInformation != null)
            {
                SiteInformation.SubscribeInformation(DeviceName, FieldName, SessionID, CallBackObject);
            }
        }
コード例 #10
0
ファイル: AstroData.cs プロジェクト: pprasit/Project
        public static List <OUTPUTSTRUCT> GetInformation(STATIONNAME StationName)
        {
            StationHandler SiteInformation = KeeperData.FirstOrDefault(Item => Item.StationName == StationName);

            if (SiteInformation != null)
            {
                return(SiteInformation.GetInformation());
            }
            return(null);
        }
コード例 #11
0
ファイル: AstroData.cs プロジェクト: pprasit/Project
        public static INFORMATIONSTRUCT GetInformationObject(STATIONNAME StationName, DEVICENAME DeviceName, dynamic FieldName)
        {
            StationHandler SiteInformation = KeeperData.FirstOrDefault(Item => Item.StationName == StationName);

            if (SiteInformation != null)
            {
                return(SiteInformation.GetInformationObject(DeviceName, FieldName));
            }
            return(null);
        }
コード例 #12
0
ファイル: AstroData.cs プロジェクト: pprasit/Project
        public static void SetStationDisconnected(String StationSessionID)
        {
            StationHandler ThisStation = KeeperData.FirstOrDefault(Item => Item.StationSessionID == StationSessionID && Item.IsStationConnected);

            if (ThisStation != null)
            {
                ThisStation.IsStationConnected = false;
            }

            UIHandler.StationLostConnectionHandler();
        }
コード例 #13
0
ファイル: AstroData.cs プロジェクト: pprasit/Project
        public static List <OUTPUTSTRUCT> GetInformation(STATIONNAME StationName, DEVICECATEGORY DeviceCategory)
        {
            StationHandler SiteInformation = KeeperData.FirstOrDefault(Item => Item.StationName == StationName);

            if (SiteInformation != null)
            {
                List <OUTPUTSTRUCT> ThisOutput = SiteInformation.GetInformation(DeviceCategory);
                return(ThisOutput);
            }
            return(null);
        }
コード例 #14
0
ファイル: AstroData.cs プロジェクト: pprasit/Project
 public static DEVICECATEGORY GetDeviceCategoryByDeviceName(STATIONNAME StationName, DEVICENAME DeviceName)
 {
     if (KeeperData != null)
     {
         StationHandler ThisSite = KeeperData.FirstOrDefault(Item => Item.StationName == StationName);
         if (ThisSite != null)
         {
             return(ThisSite.GetDeviceCategoryByDeviceName(DeviceName));
         }
     }
     return(DEVICECATEGORY.NULL);
 }
コード例 #15
0
ファイル: AstroData.cs プロジェクト: pprasit/Project
 public static List <DEVICEMAPPER> GetAvaliableDevice(STATIONNAME StationName)
 {
     if (KeeperData != null)
     {
         StationHandler ThisSite = KeeperData.FirstOrDefault(Item => Item.StationName == StationName);
         if (ThisSite != null)
         {
             return(ThisSite.GetAvaliableDevices());
         }
     }
     return(null);
 }
コード例 #16
0
ファイル: AstroData.cs プロジェクト: pprasit/Project
        public static ReturnKnowType CreateStation(STATIONNAME StationName, String StationSessionID, Object ServerCallBackObject)
        {
            StationHandler ThisStation      = KeeperData.FirstOrDefault(Item => Item.StationName == StationName);
            ReturnKnowType CreateSiteResult = ThisStation.CreateEngine(StationSessionID, ServerCallBackObject);

            if (ThisStation != null)
            {
                ThisStation.StationConnected();
            }

            TTCSLog.NewLogInformation(StationName, DateTime.UtcNow, "Station name : " + StationName.ToString() + " has been created, Status ready and waiting for command.", LogType.COMMUNICATION, null);
            return(CreateSiteResult);
        }
コード例 #17
0
ファイル: AstroData.cs プロジェクト: pprasit/Project
        public static STATIONNAME GetStationName(String StationSessionID)
        {
            StationHandler ThisStation = KeeperData.FirstOrDefault(Item => Item.StationSessionID == StationSessionID);

            if (ThisStation != null)
            {
                return(ThisStation.StationName);
            }
            else
            {
                return(STATIONNAME.NULL);
            }
        }
コード例 #18
0
ファイル: AstroData.cs プロジェクト: pprasit/Project
        public static Boolean IsStationConnected(String StationSessionID)
        {
            StationHandler ThisStation = KeeperData.FirstOrDefault(Item => Item.StationSessionID == StationSessionID);

            if (ThisStation != null)
            {
                return(ThisStation.IsStationConnected);
            }
            else
            {
                return(false);
            }
        }
コード例 #19
0
        public void ReadStationsFromDb()
        {
            bool           expect   = true;
            bool           actual   = false;
            List <Station> stations = StationHandler.station(null);

            stations.Sort();

            if (stations[0].stationId == 0001)
            {
                actual = true;
            }
            Assert.AreEqual(expect, actual);
        }
コード例 #20
0
 private void InitHandlers()
 {
     GameEvents        = new GameHandler(this);
     PlayerEvents      = new PlayerHandler(this);
     ShipEvents        = new ShipHandler(this);
     CombatEvents      = new CombatHandler(this);
     ExplorationEvents = new ExplorationHandler(this);
     StationEvents     = new StationHandler(this);
     TradeEvents       = new TradeHandler(this);
     TravelEvents      = new TravelHandler(this);
     PowerplayEvents   = new PowerplayHandler(this);
     WingEvents        = new WingHandler(this);
     SquadronEvents    = new SquadronHandler(this);
     CrewEvents        = new CrewHandler(this);
 }
コード例 #21
0
ファイル: AstroData.cs プロジェクト: pprasit/Project
        public static ReturnKnowType UpdateStationUser(String UserID, String UserName, String UserLoginName, String UserLoginPassword, String UserPermissionType, String USerStationPermission, String StationName, DATAACTION UserAction)
        {
            STATIONNAME    ThisStationName = TTCSHelper.StationStrConveter(StationName);
            StationHandler ThisSite        = KeeperData.FirstOrDefault(Item => Item.StationName == ThisStationName);

            if (ThisSite != null)
            {
                ReturnKnowType ThisResult = ThisSite.UpdateStationUser(UserID, UserName, UserLoginName, UserLoginPassword, UserPermissionType, USerStationPermission, UserAction);
                if (ThisResult.ReturnType == ReturnStatus.SUCESSFUL)
                {
                    return(ThisResult);
                }
            }

            return(ReturnKnowType.DefineReturn(ReturnStatus.FAILED, "(#TT004) Can not update user data to station. Will try again.", false));
        }
コード例 #22
0
ファイル: ScriptEngine.cs プロジェクト: pprasit/Project
        public static void SendScriptToStation(STATIONNAME ScriptStationName)
        {
            if (ScriptStationName != STATIONNAME.NULL)
            {
                String         Message = null;
                StationHandler StationCommunication = AstroData.GetStationObject(ScriptStationName);
                StationScript  StationScript        = GetStationScript(ScriptStationName);

                DBScheduleEngine.UpdateFailSchedule(ScriptStationName);

                //DBScheduleEngine.DropSchedule(ScriptStationName);
                Console.WriteLine("Preparing Station Script before sending.");

                foreach (ScriptStructureNew Script in StationScript.ScriptCollection)
                {
                    //if (Script.ScriptState != SCRIPTSTATE.CANCELED.ToString())
                    //{
                    //    Script.ScriptState = SCRIPTSTATE.SENDINGTOSTATION.ToString();
                    //    DBScheduleEngine.UpdateSchedule(Script);
                    //}
                    //else
                    //{
                    //    Console.WriteLine("CANCEL");
                    //}
                    Script.ScriptState = SCRIPTSTATE.SENDINGTOSTATION.ToString();
                    DBScheduleEngine.UpdateSchedule(Script);
                }


                Console.WriteLine("Sending Script to " + ScriptStationName + " ...");
                if (StationCommunication.NewScriptInformation(StationScript.GetScript(), out Message))
                {
                    //DBScheduleEngine.DropSchedule(ScriptStationName);

                    /*
                     * foreach (ScriptStructureNew Script in StationScript.ScriptCollection)
                     * {
                     *  Script.ScriptState = SCRIPTSTATE.WAITINGSTATION.ToString();
                     *  DBScheduleEngine.UpdateSchedule(Script);
                     * }
                     */
                }

                DisplayScriptMessage(Message);
            }
        }
コード例 #23
0
        private void GetMissingData()
        {
            ReturnKnowType ThisResult = AstroData.GetAllOnlineStation();

            if (ThisResult.ReturnValue != null)
            {
                List <StationHandler> AllStation = (List <StationHandler>)ThisResult.ReturnValue;

                foreach (StationHandler ThisStation in AllStation)
                {
                    if (ThisStation.IsStationConnected && ThisStation.StationName != STATIONNAME.ASTROSERVER)
                    {
                        StationHandler StationCommunication = AstroData.GetStationObject(ThisStation.StationName);
                        StationCommunication.CheckLastesInformation(DateTime.UtcNow.Ticks);
                    }
                }
            }
        }
コード例 #24
0
        private HttpResponseMessage GetSetCommandStructure(String StationNameStr, String TargetIDStr, String SessionID)
        {
            XmlDocument    myXml = new XmlDocument();
            XPathNavigator xNav  = myXml.CreateNavigator();

            if (UserSessionHandler.VerifyTimeout(SessionID))
            {
                STATIONNAME ThisStation = HostingHelper.ConvertStationNameStrToSTATIONNAME(StationNameStr);

                if (ThisStation == STATIONNAME.NULL)
                {
                    return(HostingHelper.ReturnError("Invalid station name. Please check.", myXml, xNav));
                }

                if (DBScheduleEngine.IsFoundScheduleByTargetID(StationNameStr, TargetIDStr))
                {
                    StationHandler StationHandle = AstroData.GetStationObject(ThisStation);
                    StationHandle.CancelScript(TargetIDStr);

                    return(HostingHelper.ReturnSuccess(ThisStation, "OK", myXml, xNav));
                }
                else
                {
                    return(HostingHelper.ReturnError("There are no TargetID in Database.", myXml, xNav));
                }

                /*
                 * TTCSCommandDisplay[] ListOfDisplayCommand = CommandDefinition.GetListCommandName(ThisStation, ThisDeviceCategory).ToArray();
                 * if (ListOfDisplayCommand != null)
                 * {
                 *  var json = new JavaScriptSerializer().Serialize(ListOfDisplayCommand);
                 *  return new HttpResponseMessage() { Content = new StringContent(json, Encoding.UTF8, "application/json") };
                 * }
                 * else
                 *  return HostingHelper.ReturnError("There are no set command avaliable on this stationName and DeviceName.", myXml, xNav);
                 */
            }
            else
            {
                return(HostingHelper.ReturnError("Session is timeout. Please login to the system.", myXml, xNav));
            }
        }