Exemplo n.º 1
0
 /// <summary>
 /// The hook for the event dispatcher.
 /// </summary>
 /// <param name="rte"></param>
 public override void onRealTimeEvent(RealTimeEvent rte)
 {
     if(rte.GetType() == typeof(ReceiverSlice.RealTimeEvents.UnparsedMessage))
     {
         ReceiverSlice.RealTimeEvents.UnparsedMessage unparsedMessage = (ReceiverSlice.RealTimeEvents.UnparsedMessage)rte;
         Decode(unparsedMessage);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="message">Human readable description of this event</param>
 /// <param name="originatingEvent">The causal event.</param>
 /// <remarks>If this event is a consequence of an earlier event, it should be constructed
 /// with a reference to originating event.  As the object is constructed, the key/value
 /// pairs in the originating event are copied into this event and made available to
 /// future consumers of the event.  In cases where key conflict, the newer
 /// value will be used.
 /// </remarks>
 public RealTimeEvent(string message, RealTimeEvent originatingEvent)
 {
     this.message = message;
     if (originatingEvent != null)
     {
         _thisDict = originatingEvent._thisDict;
     }
     else
     {
         _thisDict = new Dictionary<string, dynamic>();
     }
 }
Exemplo n.º 3
0
 public DatabaseResponse(string sql, int response, RealTimeEvent originatingEvent)
     : base("SQL statement: " + sql, originatingEvent)
 {
     this.sql = sql;
     this.response = response;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Constructor for this event.
 /// </summary>
 /// <param name="decoded">A map of the parameters of the message to their values. For example, "receiver_id" -> "450028"</param>
 /// <param name="originatingEvent">From whence this event came.</param>
 /// <param name="undecoded">The raw message.</param>
 /// <param name="messageType">The type of message. For example, a detection.</param>
 public Decoded(Dictionary<String,String> decoded, RealTimeEvent originatingEvent, String undecoded, String messageType)
     : base("Decoded message type: " + messageType + " from raw message: " + undecoded, originatingEvent)
 {
     this["decodedmessage"] = decoded;
     this["messagetype"] = messageType;
 }
Exemplo n.º 5
0
 /// <summary>
 /// Constructor for this event.
 /// </summary>
 /// <param name="message">The SQL non-query command (generally an INSERT).</param>
 /// <param name="response">The number of rows affected. -1 indicates a failed insertion.</param>
 /// <param name="originatingEvent">From whence this event came.</param>
 public DatabaseResponse(string message, int response, RealTimeEvent originatingEvent)
     : base("Database module: " + message, originatingEvent)
 {
     this.sql = message;
     this.response = response;
 }
Exemplo n.º 6
0
 public DatabaseException(Exception e, RealTimeEvent originatingEvent)
     : base("Database module exception " + e.Message, originatingEvent)
 {
 }
Exemplo n.º 7
0
 /// <summary>
 /// Human-readable text of any real time event dispatched is printed to the console.
 /// </summary>
 /// <param name="rte">Real time event dispatched</param>
 public override void onRealTimeEvent(RealTimeEvent rte)
 {
     System.Console.WriteLine(rte);
 }
Exemplo n.º 8
0
 /// <summary>
 /// The hook for the event dispatcher. Determines the type of message, and if applicable, makes a database insertion.
 /// </summary>
 /// <param name="realTimeEvent"></param>
 public override void onRealTimeEvent(RealTimeEvent realTimeEvent)
 {
     int response = 0;
     if(realTimeEvent.GetType() == typeof(Decoder.RealTimeEvents.Decoded))
     {
         Decoder.RealTimeEvents.Decoded rte = (Decoder.RealTimeEvents.Decoded)realTimeEvent;
         string eventType = rte["messagetype"];
         if (eventType == "detection_event")
             response = detectionInsert(rte);
         else if (eventType == "status_response")
             response = statusInsert(rte);
         if (response > 1)
             response = 1;
     }
     //return response;
 }