public static double?Convert(TelemetryKey key, double?value)
        {
            // Don't check, return as is
            if (value == null)
            {
                return(null);
            }

            // Try to get field data, if none, return as is
            TelemetryField field = TelemetryKeys.GetTelemetryFieldByKeyOrNull(key);

            if (field == null)
            {
                return(value);
            }

            // We have a semantic, check if it is to be coverted to degrees
            if (field.SemanticSpecified && DEGREE_VALUES.Contains(field.Semantic))
            {
                return(value.Value / Math.PI * 180.0);
            }

            // Return as is
            return(value);
        }
        public void AddTelemetryKey(string applicationId, string username)
        {
            var newKey = new TelemetryKey();

            newKey.ApplicationId    = applicationId;
            newKey.Expired          = false;
            newKey.ExpireReason     = null;
            newKey.KeyData          = Helpers.GenerationHelper.CreateRandomString(true, true, false, 20);
            newKey.UsernameWhoAdded = username;
            this.repositoryWrapper.TelemetryKeyRepository.AddOne <TelemetryKey>(newKey);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Send different events to SQL.
 /// </summary>
 /// <param name="key">What is being sent.</param>
 /// <param name="val">What's being sent's value.</param>
 public static void log(TelemetryKey key, string val)
 {
     sessionTelem.SendEvent(key.ToString(), val);
 }