Beispiel #1
0
 public void NotifyBeaconEvent(Beacon beacon, BeaconEventType eventType)
 {
     BeaconEvent?.Invoke(this, new BeaconEventArgs()
     {
         Beacon = beacon, EventType = eventType
     });
 }
Beispiel #2
0
 public async Task <bool> SaveBeaconEventState(string pid, BeaconEventType enter)
 {
     LastEventState[pid] = new BackgroundEvent()
     {
         BeaconId = pid, EventTime = DateTimeOffset.Now, LastEvent = enter
     };
     return(true);
 }
Beispiel #3
0
        private void AddBeaconArgs(Beacon beacon, BeaconEventType eventType)
        {
            var args = new BeaconEventArgs();

            args.Beacon    = beacon;
            args.EventType = eventType;
            _beaconArgs.Add(args);
        }
Beispiel #4
0
        public async Task <bool> SaveBeaconEventState(string pid, BeaconEventType type)
        {
            StorageFolder folder = await GetFolder(BackgroundSettingsFolder, true);

            StorageFile file = await folder.CreateFileAsync(pid, CreationCollisionOption.OpenIfExists);

            return(await RetryWriting(file, FileStorageHelper.BeaconEventStateToString(pid, type, DateTimeOffset.Now)));
        }
Beispiel #5
0
 public static Request ToRequest(string uuid, ushort man, ushort beaconId, BeaconEventType type)
 {
     return(new Request(new BeaconEventArgs()
     {
         Beacon = new Beacon()
         {
             Id1 = uuid, Id2 = man, Id3 = beaconId
         }, EventType = type
     }, SdkData.NextId()));
 }
        public void TestHistoryEventParsing(string query, string beaconId, string eventTime, BeaconEventType beaconEventType, bool send)
        {
            HistoryEvent e = FileStorageHelper.EventFromString(query);

            //fallback for unparsable data
            if (beaconId == null && eventTime == null)
            {
                Assert.IsNull(e);
                return;
            }

            Assert.AreEqual(beaconId, e.BeaconId);
            Assert.AreEqual(eventTime, e.EventTime);
            Assert.AreEqual((int) beaconEventType, e.Trigger);
        }
Beispiel #7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="resolvedAction"></param>
        /// <param name="dueTime"></param>
        /// <param name="beaconPid"></param>
        /// <param name="eventTypeDetectedByDevice"></param>
        /// <returns></returns>
        public async Task SaveDelayedActionAsync(
            ResolvedAction resolvedAction, DateTimeOffset dueTime, string beaconPid, BeaconEventType eventTypeDetectedByDevice)
        {
            string actionAsString = ResolvedAction.Serialize(resolvedAction);

            DBDelayedAction delayedAction = new DBDelayedAction()
            {
                ResolvedAction = actionAsString,
                DueTime = dueTime,
                BeaconPid = beaconPid,
                EventTypeDetectedByDevice = (int)eventTypeDetectedByDevice,
                Executed = false
            };

            await _db.InsertAsync(delayedAction);
        }
 private async Task <bool> SaveBeaconEventStateRetry(string pid, BeaconEventType enter, int retry)
 {
     if (retry < 0)
     {
         return(false);
     }
     try
     {
         if (await Storage.SaveBeaconEventState(pid, enter))
         {
             return(true);
         }
         return(await SaveBeaconEventStateRetry(pid, enter, --retry));
     }
     catch (UnauthorizedAccessException)
     {
         return(await SaveBeaconEventStateRetry(pid, enter, --retry));
     }
     catch (FileNotFoundException)
     {
         return(await SaveBeaconEventStateRetry(pid, enter, --retry));
     }
 }
Beispiel #9
0
        /// <summary>
        /// Executes the given action, stores the event in event history and notifies the listeners.
        /// </summary>
        private async Task ExecuteActionAsync(ResolvedAction resolvedAction, string beaconPid, BeaconEventType beaconEventType, string location)
        {
            try
            {
                Logger.Debug("SDKEngine: ExecuteActionAsync " + beaconPid + " BeaconEventType: " + beaconEventType + " type: " + resolvedAction?.BeaconAction.Type);
                bool checkOnlyOnce = _eventHistory.CheckSendOnlyOnceAsync(resolvedAction);
                bool shouldSupress = _eventHistory.ShouldSupressAsync(resolvedAction);

                Logger.Trace("SDKEngine: ExecuteActionAsync " + beaconPid + " checkOnlyOnce: " + checkOnlyOnce + " shouldSupress:" + shouldSupress);
                if (!shouldSupress && !checkOnlyOnce && resolvedAction.IsInsideTimeframes(DateTimeOffset.Now))
                {
                    Logger.Trace("SDKEngine: ExecuteActionAsync " + beaconPid + " action resolved");
                    await _eventHistory.SaveExecutedResolvedActionAsync(resolvedAction.BeaconAction, beaconPid, beaconEventType, location);

                    if (resolvedAction.BeaconAction.Type != BeaconActionType.Silent)
                    {
                        BeaconActionResolved?.Invoke(this, resolvedAction.BeaconAction);
                    }
                }
                else
                {
                    Logger.Trace("SDKEngine: ExecuteActionAsync " + beaconPid + " action not resolved");
                }
            }
            catch (Exception e)
            {
                Logger.Error("Error during ExecuteActionAsync", e);
            }
        }
 public void NotifyBeaconEvent(Beacon beacon, BeaconEventType eventType)
 {
     BeaconEvent?.Invoke(this, new BeaconEventArgs() { Beacon = beacon, EventType = eventType });
 }
Beispiel #11
0
        public void TestHistoryEventParsing(string query, string beaconId, string eventTime, BeaconEventType beaconEventType, bool send)
        {
            HistoryEvent e = FileStorageHelper.EventFromString(query);

            //fallback for unparsable data
            if (beaconId == null && eventTime == null)
            {
                Assert.IsNull(e);
                return;
            }

            Assert.AreEqual(beaconId, e.BeaconId);
            Assert.AreEqual(eventTime, e.EventTime);
            Assert.AreEqual((int)beaconEventType, e.Trigger);
        }
 public static HistoryEvent ToHistoryEvent(string pid, DateTimeOffset timestamp, BeaconEventType eventType, string location)
 {
     return(new HistoryEvent()
     {
         BeaconId = pid, EventTime = timestamp.ToString(History.Timeformat), Trigger = (int)eventType, Location = location
     });
 }
 public async Task<bool> SaveBeaconEventState(string pid, BeaconEventType enter)
 {
     LastEventState[pid] = new BackgroundEvent() {BeaconId = pid, EventTime = DateTimeOffset.Now, LastEvent = enter};
     return true;
 }
 private async Task <bool> SaveDelayedActionsRetry(ResolvedAction action, DateTimeOffset dueTime, string beaconPid, BeaconEventType eventTypeDetectedByDevice, string location, int retry)
 {
     if (retry < 0)
     {
         return(false);
     }
     try
     {
         if (await Storage.SaveDelayedAction(action, dueTime, beaconPid, eventTypeDetectedByDevice, location))
         {
             return(true);
         }
         return(await SaveDelayedActionsRetry(action, dueTime, beaconPid, eventTypeDetectedByDevice, location, --retry));
     }
     catch (UnauthorizedAccessException)
     {
         return(await SaveDelayedActionsRetry(action, dueTime, beaconPid, eventTypeDetectedByDevice, location, --retry));
     }
     catch (FileNotFoundException)
     {
         return(await SaveDelayedActionsRetry(action, dueTime, beaconPid, eventTypeDetectedByDevice, location, --retry));
     }
 }
 public static string DelayedActionToString(ResolvedAction action, DateTimeOffset dueTime, string beaconPid, BeaconEventType beaconEventType, string location)
 {
     return DelayedActionToString(action, dueTime, beaconPid, beaconEventType, Guid.NewGuid(), location);
 }
 private async Task<bool> SaveHistoryActionRetry(string uuid, string beaconPid, DateTimeOffset now, BeaconEventType beaconEventType, string location, int retry)
 {
     if (retry < 0)
     {
         return false;
     }
     try
     {
         HistoryAction action = FileStorageHelper.ToHistoryAction(uuid, beaconPid, now, beaconEventType, location);
         if (await Storage.SaveHistoryAction(action))
         {
             return true;
         }
         return await SaveHistoryActionRetry(uuid, beaconPid, now, beaconEventType, location, --retry);
     }
     catch (UnauthorizedAccessException)
     {
         return await SaveHistoryActionRetry(uuid, beaconPid, now, beaconEventType, location, --retry);
     }
     catch (FileNotFoundException)
     {
         return await SaveHistoryActionRetry(uuid, beaconPid, now, beaconEventType, location, --retry);
     }
 }
 public async Task<bool> SaveHistoryEvent(string pid, DateTimeOffset timestamp, BeaconEventType eventType, string location)
 {
     return await SaveHistoryEventRetry(pid, timestamp, eventType, location, MaxRetries);
 }
 public static HistoryEvent ToHistoryEvent(string pid, DateTimeOffset timestamp, BeaconEventType eventType, string location)
 {
     return new HistoryEvent() { BeaconId = pid, EventTime = timestamp.ToString(History.Timeformat), Trigger = (int)eventType, Location = location};
 }
 public async Task<bool> SaveHistoryAction(string uuid, string beaconPid, DateTimeOffset now, BeaconEventType beaconEventType, string location)
 {
     return await SaveHistoryActionRetry(uuid, beaconPid, now, beaconEventType, location, MaxRetries);
 }
 public static HistoryAction ToHistoryAction(string uuid, string beaconPid, DateTimeOffset now, BeaconEventType beaconEventType, string location)
 {
     return new HistoryAction() { BeaconId = beaconPid, ActionTime = now.ToString(History.Timeformat), EventId = uuid, Trigger = (int)beaconEventType, Location = location};
 }
 public static string BeaconEventStateToString(string pid, BeaconEventType type, DateTimeOffset now)
 {
     return string.Format("{0},{1},{2}", pid, (int)type, now.ToUnixTimeMilliseconds());
 }
 public static string DelayedActionToString(ResolvedAction action, DateTimeOffset dueTime, string beaconPid, BeaconEventType beaconEventType, Guid guid, string location)
 {
     string serializeObject = JsonConvert.SerializeObject(new SerializedAction() {Action = action, Time = dueTime, Beacon = beaconPid, Event = beaconEventType});
     return DelayedActionToString(Convert.ToBase64String(Encoding.UTF8.GetBytes(serializeObject)), dueTime, false, guid.ToString(), location);
 }
 private async Task <bool> SaveHistoryActionRetry(string uuid, string beaconPid, DateTimeOffset now, BeaconEventType beaconEventType, string location, int retry)
 {
     if (retry < 0)
     {
         return(false);
     }
     try
     {
         HistoryAction action = FileStorageHelper.ToHistoryAction(uuid, beaconPid, now, beaconEventType, location);
         if (await Storage.SaveHistoryAction(action))
         {
             return(true);
         }
         return(await SaveHistoryActionRetry(uuid, beaconPid, now, beaconEventType, location, --retry));
     }
     catch (UnauthorizedAccessException)
     {
         return(await SaveHistoryActionRetry(uuid, beaconPid, now, beaconEventType, location, --retry));
     }
     catch (FileNotFoundException)
     {
         return(await SaveHistoryActionRetry(uuid, beaconPid, now, beaconEventType, location, --retry));
     }
 }
Beispiel #24
0
        /// <summary>
        /// Resolves the beacon actions associated with the given PID and event type.
        /// </summary>
        /// <param name="pid"></param>
        /// <param name="eventType"></param>
        /// <returns>A list of actions based on the given values or an empty list if none found.</returns>
        public IList<ResolvedAction> GetResolvedActionsForPidAndEvent(string pid, BeaconEventType eventType)
        {
            List<ResolvedAction> actions = new List<ResolvedAction>();

            foreach (ResolvedAction item in ResolvedActions)
            {
                if (item.BeaconPids.ContainsKey(pid)
                    && (item.EventTypeDetectedByDevice == eventType || item.EventTypeDetectedByDevice == BeaconEventType.EnterExit))
                { 
                    actions.Add(item);
                }
            }

            return actions;
        }
 private async Task <bool> SaveHistoryEventRetry(string pid, DateTimeOffset timestamp, BeaconEventType eventType, string location, int retry)
 {
     if (retry < 0)
     {
         return(false);
     }
     try
     {
         if (await Storage.SaveHistoryEvents(FileStorageHelper.ToHistoryEvent(pid, timestamp, eventType, location)))
         {
             return(true);
         }
         return(await SaveHistoryEventRetry(pid, timestamp, eventType, location, --retry));
     }
     catch (UnauthorizedAccessException)
     {
         return(await SaveHistoryEventRetry(pid, timestamp, eventType, location, --retry));
     }
     catch (FileNotFoundException)
     {
         return(await SaveHistoryEventRetry(pid, timestamp, eventType, location, --retry));
     }
 }
 public static string BeaconEventStateToString(string pid, BeaconEventType type, DateTimeOffset now)
 {
     return(string.Format("{0},{1},{2}", pid, (int)type, now.ToUnixTimeMilliseconds()));
 }
 private async Task<bool> SaveHistoryEventRetry(string pid, DateTimeOffset timestamp, BeaconEventType eventType, string location, int retry)
 {
     if (retry < 0)
     {
         return false;
     }
     try
     {
         if (await Storage.SaveHistoryEvents(FileStorageHelper.ToHistoryEvent(pid, timestamp, eventType, location)))
         {
             return true;
         }
         return await SaveHistoryEventRetry(pid, timestamp, eventType, location, --retry);
     }
     catch (UnauthorizedAccessException)
     {
         return await SaveHistoryEventRetry(pid, timestamp, eventType, location, --retry);
     }
     catch (FileNotFoundException)
     {
         return await SaveHistoryEventRetry(pid, timestamp, eventType, location, --retry);
     }
 }
 public static string ActionToString(string uuid, string beaconPid, DateTimeOffset timestamp, BeaconEventType beaconEventType, string location)
 {
     return ActionToString(uuid, beaconPid, timestamp, (int) beaconEventType, false, false, location);
 }
        public static string DelayedActionToString(ResolvedAction action, DateTimeOffset dueTime, string beaconPid, BeaconEventType beaconEventType, Guid guid, string location)
        {
            string serializeObject = JsonConvert.SerializeObject(new SerializedAction()
            {
                Action = action, Time = dueTime, Beacon = beaconPid, Event = beaconEventType
            });

            return(DelayedActionToString(Convert.ToBase64String(Encoding.UTF8.GetBytes(serializeObject)), dueTime, false, guid.ToString(), location));
        }
 public async Task<bool> SaveDelayedAction(ResolvedAction action, DateTimeOffset dueTime, string beaconPid, BeaconEventType eventType, string location)
 {
     return await SaveDelayedActionsRetry(action, dueTime, beaconPid, eventType, location, MaxRetries);
 }
 public static HistoryAction ToHistoryAction(string uuid, string beaconPid, DateTimeOffset now, BeaconEventType beaconEventType, string location)
 {
     return(new HistoryAction()
     {
         BeaconId = beaconPid, ActionTime = now.ToString(History.Timeformat), EventId = uuid, Trigger = (int)beaconEventType, Location = location
     });
 }
 private async Task<bool> SaveDelayedActionsRetry(ResolvedAction action, DateTimeOffset dueTime, string beaconPid, BeaconEventType eventTypeDetectedByDevice, string location, int retry)
 {
     if (retry < 0)
     {
         return false;
     }
     try
     {
         if (await Storage.SaveDelayedAction(action, dueTime, beaconPid, eventTypeDetectedByDevice, location))
         {
             return true;
         }
         return await SaveDelayedActionsRetry(action, dueTime, beaconPid, eventTypeDetectedByDevice, location, --retry);
     }
     catch (UnauthorizedAccessException)
     {
         return await SaveDelayedActionsRetry(action, dueTime, beaconPid, eventTypeDetectedByDevice, location, --retry);
     }
     catch (FileNotFoundException)
     {
         return await SaveDelayedActionsRetry(action, dueTime, beaconPid, eventTypeDetectedByDevice, location, --retry);
     }
 }
Beispiel #33
0
        public async Task <bool> SaveDelayedAction(ResolvedAction action, DateTimeOffset dueTime, string beaconPid, BeaconEventType eventType, string location)
        {
            StorageFolder folder = await GetFolder(Background?BackgroundActionsFolder : ForegroundActionsFolder, true);

            StorageFile file = await folder.CreateFileAsync(DelayedActionsFileName, CreationCollisionOption.OpenIfExists);

            string actionToString = FileStorageHelper.DelayedActionToString(action, dueTime, beaconPid, eventType, location);

            return(await RetryAppending(file, actionToString));
        }
 public async Task<bool> SaveBeaconEventState(string pid, BeaconEventType enter)
 {
     return await SaveBeaconEventStateRetry(pid, enter,MaxRetries);
 }
 /// <summary>
 /// For convenience.
 /// </summary>
 public async Task SaveExecutedResolvedActionAsync(BeaconAction beaconAction, string beaconPid, BeaconEventType beaconEventType, string location)
 {
     await ServiceManager.StorageService.SaveHistoryAction(beaconAction.Uuid, beaconPid, DateTime.Now, beaconEventType, location);
 }
 private async Task<bool> SaveBeaconEventStateRetry(string pid, BeaconEventType enter, int retry)
 {
     if (retry < 0)
     {
         return false;
     }
     try
     {
         if (await Storage.SaveBeaconEventState(pid, enter))
         {
             return true;
         }
         return await SaveBeaconEventStateRetry(pid, enter, --retry);
     }
     catch (UnauthorizedAccessException)
     {
         return await SaveBeaconEventStateRetry(pid, enter, --retry);
     }
     catch (FileNotFoundException)
     {
         return await SaveBeaconEventStateRetry(pid, enter, --retry);
     }
 }
Beispiel #37
0
        public void TestHistoryActionParsing(string query, string uuid, string beaconId, string eventTime, BeaconEventType beaconEventType, bool send)
        {
            HistoryAction a = FileStorageHelper.ActionFromString(query);

            //fallback for unparsable data
            if (beaconId == null && eventTime == null)
            {
                Assert.IsNull(a);
                return;
            }

            Assert.AreEqual(beaconId, a.BeaconId);
            Assert.AreEqual(eventTime, a.ActionTime);
            Assert.AreEqual(uuid, a.EventId);
            Assert.AreEqual((int)beaconEventType, a.Trigger);
        }
Beispiel #38
0
 public async Task SaveBeaconBackgroundEvent(string pidIn,BeaconEventType triggerIn )
 {
     int eventType = (int)triggerIn;
     DateTimeOffset eventTime = DateTimeOffset.Now;
     DBBackgroundEventsHistory actions = new DBBackgroundEventsHistory() { BeaconPid = pidIn, EventType = eventType, EventTime = eventTime };
     await _db.InsertAsync(actions);
 }
 public static Request ToRequest(string uuid, ushort man, ushort beaconId, BeaconEventType type)
 {
     return new Request(new BeaconEventArgs() {Beacon = new Beacon() {Id1 = uuid, Id2 = man, Id3 = beaconId }, EventType = type}, SdkData.NextId());
 }
Beispiel #40
0
 public async Task UpdateBackgroundEventAsync(string pidIn,BeaconEventType eventType)
 {
     int type = (int)eventType;
     DateTimeOffset eventTime = DateTimeOffset.Now;
     DBBackgroundEventsHistory backgroundEvent = new DBBackgroundEventsHistory() { BeaconPid = pidIn, EventTime = eventTime, EventType= type };
     await _db.UpdateAsync(backgroundEvent);
 }
 public async Task <bool> SaveHistoryAction(string uuid, string beaconPid, DateTimeOffset now, BeaconEventType beaconEventType, string location)
 {
     return(await SaveHistoryActionRetry(uuid, beaconPid, now, beaconEventType, location, MaxRetries));
 }
Beispiel #42
0
 public async Task <bool> SaveDelayedAction(ResolvedAction action, DateTimeOffset dueTime, string beaconPid, BeaconEventType eventType, string location)
 {
     DelayedActions.Add(new DelayedActionData()
     {
         BeaconPid = beaconPid, DueTime = dueTime, EventTypeDetectedByDevice = eventType, Id = Guid.NewGuid().ToString(), ResolvedAction = action, Location = location
     });
     return(true);
 }
 public async Task <bool> SaveHistoryEvent(string pid, DateTimeOffset timestamp, BeaconEventType eventType, string location)
 {
     return(await SaveHistoryEventRetry(pid, timestamp, eventType, location, MaxRetries));
 }
        public void TestHistoryActionParsing(string query, string uuid, string beaconId, string eventTime, BeaconEventType beaconEventType, bool send)
        {
            HistoryAction a = FileStorageHelper.ActionFromString(query);

            //fallback for unparsable data
            if (beaconId == null && eventTime == null)
            {
                Assert.IsNull(a);
                return;
            }

            Assert.AreEqual(beaconId, a.BeaconId);
            Assert.AreEqual(eventTime, a.ActionTime);
            Assert.AreEqual(uuid, a.EventId);
            Assert.AreEqual((int)beaconEventType, a.Trigger);
        }
 public async Task <bool> SaveDelayedAction(ResolvedAction action, DateTimeOffset dueTime, string beaconPid, BeaconEventType eventType, string location)
 {
     return(await SaveDelayedActionsRetry(action, dueTime, beaconPid, eventType, location, MaxRetries));
 }
        /// <summary>
        /// Executes the given action, stores the event in event history and notifies the listeners.
        /// </summary>
        private async Task ExecuteActionAsync(ResolvedAction resolvedAction, string beaconPid, BeaconEventType beaconEventType, string location)
        {
            try
            {
                Logger.Debug("SDKEngine: ExecuteActionAsync " + beaconPid + " BeaconEventType: " + beaconEventType + " type: " + resolvedAction?.BeaconAction.Type);
                bool checkOnlyOnce = _eventHistory.CheckSendOnlyOnceAsync(resolvedAction);
                bool shouldSupress = _eventHistory.ShouldSupressAsync(resolvedAction);

                Logger.Trace("SDKEngine: ExecuteActionAsync " + beaconPid + " checkOnlyOnce: " + checkOnlyOnce + " shouldSupress:" + shouldSupress);
                if (!shouldSupress && !checkOnlyOnce && resolvedAction.IsInsideTimeframes(DateTimeOffset.Now))
                {
                    Logger.Trace("SDKEngine: ExecuteActionAsync " + beaconPid + " action resolved");
                    await _eventHistory.SaveExecutedResolvedActionAsync(resolvedAction.BeaconAction, beaconPid, beaconEventType, location);

                    if (resolvedAction.BeaconAction.Type != BeaconActionType.Silent)
                    {
                        BeaconActionResolved?.Invoke(this, resolvedAction.BeaconAction);
                    }
                }
                else
                {
                    Logger.Trace("SDKEngine: ExecuteActionAsync " + beaconPid + " action not resolved");
                }
            }
            catch (Exception e)
            {
                Logger.Error("Error during ExecuteActionAsync", e);
            }
        }
 public async Task <bool> SaveBeaconEventState(string pid, BeaconEventType enter)
 {
     return(await SaveBeaconEventStateRetry(pid, enter, MaxRetries));
 }
 public static string DelayedActionToString(ResolvedAction action, DateTimeOffset dueTime, string beaconPid, BeaconEventType beaconEventType, string location)
 {
     return(DelayedActionToString(action, dueTime, beaconPid, beaconEventType, Guid.NewGuid(), location));
 }
Beispiel #49
0
        /// <summary>
        /// Executes the given action, stores the event in event history and notifies the listeners.
        /// </summary>
        /// <param name="resolvedAction"></param>
        /// <param name="beaconPid"></param>
        /// <param name="beaconEventType"></param>
        private async Task ExecuteActionAsync(ResolvedAction resolvedAction, string beaconPid, BeaconEventType beaconEventType)
        {
            bool checkOnlyOnce = await _eventHistory.CheckSendOnlyOnceAsync(resolvedAction);
            bool shouldSupress = await _eventHistory.ShouldSupressAsync(resolvedAction);

            if (!shouldSupress && !checkOnlyOnce && resolvedAction.IsInsideTimeframes(DateTimeOffset.Now))
            {
                await _eventHistory.SaveExecutedResolvedActionAsync(resolvedAction.BeaconAction, beaconPid, beaconEventType);

                if (resolvedAction.ReportImmediately)
                {
                    await _eventHistory.FlushHistoryAsync();
                }

                if (BeaconActionResolved != null)
                {
                    BeaconActionResolved(this, resolvedAction.BeaconAction);
                }
            }
        }
 public async Task<bool> SaveDelayedAction(ResolvedAction action, DateTimeOffset dueTime, string beaconPid, BeaconEventType eventType, string location)
 {
     DelayedActions.Add(new DelayedActionData() {BeaconPid = beaconPid,DueTime = dueTime, EventTypeDetectedByDevice =  eventType, Id = Guid.NewGuid().ToString(), ResolvedAction = action, Location = location});
     return true;
 }
 private void AddBeaconArgs(Beacon beacon, BeaconEventType eventType)
 {
     var args = new BeaconEventArgs();
     args.Beacon = beacon;
     args.EventType = eventType;
     _beaconArgs.Add(args);
 }
 /// <summary>
 /// For convenience.
 /// </summary>
 /// <param name="beaconAction"></param>
 /// <param name="beaconPid"></param>
 /// <param name="beaconActionType"></param>
 /// <returns></returns>
 public IAsyncAction SaveExecutedResolvedActionAsync(BeaconAction beaconAction, string beaconPid, BeaconEventType beaconEventType)
 {
     return _storage.SaveHistoryActionAsync(
         beaconAction.Uuid, beaconPid, DateTime.Now, (int)beaconEventType).AsAsyncAction();
 }
 public static string ActionToString(string uuid, string beaconPid, DateTimeOffset timestamp, BeaconEventType beaconEventType, string location)
 {
     return(ActionToString(uuid, beaconPid, timestamp, (int)beaconEventType, false, false, location));
 }
Beispiel #54
0
 /// <summary>
 /// For convenience.
 /// </summary>
 public async Task SaveExecutedResolvedActionAsync(BeaconAction beaconAction, string beaconPid, BeaconEventType beaconEventType, string location)
 {
     await ServiceManager.StorageService.SaveHistoryAction(beaconAction.Uuid, beaconPid, DateTime.Now, beaconEventType, location);
 }