Esempio n. 1
0
        // *** constructors ***
        public OpenKitConfiguration(OpenKitType openKitType, string applicationName, string applicationID, long deviceID, string endpointURL,
                                    ISessionIDProvider sessionIDProvider, ISSLTrustManager trustManager, Device device, string applicationVersion,
                                    BeaconCacheConfiguration beaconCacheConfiguration, BeaconConfiguration beaconConfiguration)
        {
            OpenKitType = openKitType;

            // immutable settings
            ApplicationName = applicationName;
            ApplicationID   = applicationID;
            DeviceID        = deviceID;
            EndpointURL     = endpointURL;

            // mutable settings
            capture        = DEFAULT_CAPTURE;
            sendInterval   = DEFAULT_SEND_INTERVAL;
            maxBeaconSize  = DEFAULT_MAX_BEACON_SIZE;
            captureErrors  = DEFAULT_CAPTURE_ERRORS;
            captureCrashes = DEFAULT_CAPTURE_CRASHES;

            this.device = device;

            HTTPClientConfig = new HTTPClientConfiguration(
                endpointURL,
                openKitType.DefaultServerID,
                applicationID,
                trustManager);

            this.applicationVersion = applicationVersion;

            this.beaconCacheConfiguration = beaconCacheConfiguration;

            this.sessionIDProvider = sessionIDProvider;

            BeaconConfig = beaconConfiguration;
        }
Esempio n. 2
0
        // updates settings based on a status response
        public void UpdateSettings(StatusResponse statusResponse)
        {
            // if invalid status response OR response code != 200 -> capture off
            if ((statusResponse == null) || (statusResponse.ResponseCode != 200))
            {
                IsCaptureOn = false;
            }
            else
            {
                IsCaptureOn = statusResponse.Capture;
            }

            // if capture is off -> leave other settings on their current values
            if (!IsCaptureOn)
            {
                return;
            }

            // use monitor name from beacon response or default
            string newMonitorName = statusResponse.MonitorName;

            if (newMonitorName == null)
            {
                newMonitorName = OpenKitType.DefaultMonitorName;
            }

            // use server id from beacon response or default
            int newServerID = statusResponse.ServerID;

            if (newServerID == -1)
            {
                newServerID = OpenKitType.DefaultServerID;
            }

            // check if http config needs to be updated
            if (HTTPClientConfig.ServerID != newServerID)
            {
                HTTPClientConfig = new HTTPClientConfiguration(
                    EndpointURL,
                    newServerID,
                    ApplicationID,
                    HTTPClientConfig.SSLTrustManager);
            }

            // use send interval from beacon response or default
            int newSendInterval = statusResponse.SendInterval;

            if (newSendInterval == -1)
            {
                newSendInterval = DEFAULT_SEND_INTERVAL;
            }
            // check if send interval has to be updated
            if (sendInterval != newSendInterval)
            {
                sendInterval = newSendInterval;
            }

            // use max beacon size from beacon response or default
            int newMaxBeaconSize = statusResponse.MaxBeaconSize;

            if (newMaxBeaconSize == -1)
            {
                newMaxBeaconSize = DEFAULT_MAX_BEACON_SIZE;
            }
            if (maxBeaconSize != newMaxBeaconSize)
            {
                maxBeaconSize = newMaxBeaconSize;
            }

            // use capture settings for errors and crashes
            CaptureErrors  = statusResponse.CaptureErrors;
            CaptureCrashes = statusResponse.CaptureCrashes;
        }