Esempio n. 1
0
        // Stop the connection with Apollo when the program shuts down
        public void OnApplicationQuit()
        {
            // stop the tcp client
            ApolloTCP.StopClient();

            // stop the apollo checking coroutine
            StopAllCoroutines();
            running = false;
        }
Esempio n. 2
0
        // Called when a fail message is returned from Apollo
        private static void failHandler(IntPtr cbr, UInt64 session, UInt16 eventID, string failMsg)
        {
            warning("Fail(" + eventID + "," + eventList[eventID].type + "): " + failMsg);
            // This event is handled (failed) so remove from the eventList if it exists
            if (eventList.ContainsKey(eventID))
            {
                eventList.Remove(eventID);
            }

            // Restart client if it failed to setup raw/data streams
            ApolloTCP.StopClient();
        }
Esempio n. 3
0
        void Start()
        {
            CreateApolloSession();

            // initialise the TCP client connecting to Apollo
            _apolloTCP = new ApolloTCP(receivePacket, _ip, _port);

            // Try to start Apollo
            StartCoroutine(StartApollo(2));

            // start periodic check for the Apollo connection and state
            _apolloCheck = StartCoroutine(ApolloCheck());
        }
Esempio n. 4
0
        // Reset every variable related to connecting with Apollo
        private void resetApolloState()
        {
            apolloState = ApolloState.APOLLO_0_CONNECTING;
            // empty the source and event List
            sourceList.Clear();
            eventList.Clear();

            // reset the apollo session
            ApolloSDK.apolloCloseSession(_session);
            CreateApolloSession();

            // make sure the TCP server is reset
            ApolloTCP.StopClient();

            _connectionAttempts = 0;
        }