コード例 #1
0
        protected override bool ProcessMessageInternal(ILogMethod method, FFMsg_H2G message)
        {
            if (message == null)
            {
                method.Info("Freeform message (H2G) was null.");
                return false;
            }

            this.OnModifyMessage(method, message);
            return _serverInstance.PostMessageToTransceiver(message);
        }
コード例 #2
0
 internal static bool ProcessMessage(FFMsg_H2G request)
 {
     if (_executorType == 0)
     {
         return _executor.ProcessMessage(request);
     }
     else
     {
         FreeformExecutorFactory.ProcessMessage(request);
         return true;
     }
 }
コード例 #3
0
        public bool ProcessMessage(FFMsg_H2G message)
        {
            using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "ProcessMessage(H2G)"))
            {
                bool result = default(bool);

                try
                {
                    result = this.ProcessMessageInternal(method, message);
                }
                catch (Exception ex)
                {
                    method.Exception(ex);
                }

                return result;
            }
        }
コード例 #4
0
 void OnProcessH2GMessageFromWorker(FFMsg_H2G request)
 {
     if (request.SessionID == FF_AppId_SessionIds.GIM)
     {
         UpdateInstallationIP(request.IpAddress, request.InstallationNo);
     }
     else
     {
         PopulateIP(request);
     }
     FFMsgHandlerFactory.Current.Execute(request);
 }
コード例 #5
0
        public bool ProcessMessage(FFMsg_H2G request)
        {
            using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "ProcessH2GMessage"))
            {
                bool result = false;

                try
                {
                    // find the queue executor by session id
                    IThreadPoolExecutor<FFMsg_H2G> executor = this.GetExecutorH2G(request);
                    executor.QueueWorkerItem(request);
                    result = true;
                }
                catch (Exception ex)
                {
                    method.Exception(ex);
                }

                return result;
            }
        }
コード例 #6
0
        protected virtual IThreadPoolExecutor<FFMsg_H2G> GetExecutorH2G(FFMsg_H2G msg)
        {
            switch (msg.SessionID)
            {
                case FF_AppId_SessionIds.A1:
                    return _h2gExecutor_NonPrio;

                case FF_AppId_SessionIds.GIM:
                    return _h2gExecutor_GIM;

                default:
                    return _h2gExecutor_Prio;
            }
        }
コード例 #7
0
 private static bool UpdateIP(ref FFMsg_H2G message)
 {
     bool retval = false;
     if (_htInstallationIp != null &&
         _htInstallationIp.ContainsKey(message.InstallationNo))
     {
         message.IpAddress = _htInstallationIp[message.InstallationNo];
         retval = true;
     }
     return retval;
 }
コード例 #8
0
 protected virtual void OnModifyMessage(ILogMethod method, FFMsg_H2G message) { }
コード例 #9
0
 protected virtual void OnParseEntityPart2(FFMsg_H2G msg, ref List <byte> buffer)
 {
 }
コード例 #10
0
        protected virtual bool OnProcessMessageInternal(FFMsg_H2G message)
        {
            using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "OnProcessMessageInternal(H2G)"))
            {
                bool result = default(bool);

                try
                {
                    if (message == null)
                    {
                        method.Info("Freeform message (H2G) was null.");
                        return false;
                    }

                    result = _serverInstance.PostMessageToTransceiver(message);
                }
                catch (Exception ex)
                {
                    method.Exception(ex);
                }

                return result;
            }
        }
コード例 #11
0
 protected abstract bool ProcessMessageInternal(ILogMethod method, FFMsg_H2G message);
コード例 #12
0
 public static void ProcessMessage(FFMsg_H2G message)
 {
     using (ILogMethod method = Log.LogMethod(DYN_MODULE_NAME, "ProcessMessage(H2G)"))
     {
         try
         {
             FreeformExecutorBase executor = GetMessageType(message.SessionID);
             if (message.SessionID == FF_AppId_SessionIds.GIM)
             {
                 UpdateInstallationIP(message.IpAddress, message.InstallationNo);
             }
             else
             {
                 UpdateIP(ref message);
             }
             executor.ProcessMessage(message);
         }
         catch (Exception ex)
         {
             method.Exception(ex);
         }
     }
 }
コード例 #13
0
 protected virtual void OnParseEntityPart1(FFMsg_H2G msg, ref List<byte> buffer)
 {
     buffer.Add((byte)msg.DeviceType);
     buffer.Add(msg.PollCode.GetGmuIdInt8());
     buffer.Add(msg.SessionID.GetGmuIdInt8().CreateRequestResponseId(msg.IsResponseRequired));
     buffer.Add((byte)msg.TransactionID);
 }
コード例 #14
0
 protected virtual void OnParseEntityPart2(FFMsg_H2G msg, ref List<byte> buffer) { }
コード例 #15
0
        protected virtual void OnParseBufferPart3(FFMsg_H2G msg, byte[] buffer, ref int offset)
        {
            msg.DataLength = buffer.GetValue<ushort>(offset, _parentParser.DataLength);
            offset += _parentParser.DataLength;
            msg.EntityData = buffer.GetValue<byte[]>(offset, msg.DataLength);
            offset += msg.DataLength;

            msg.Checksum = buffer.GetBytesToNumberUInt8(-1, 1);
            msg.ChecksumCalculated = FreeformHelper.CalculateCheckSum(buffer, 0, buffer.Length - 1);
        }
コード例 #16
0
 protected virtual void OnParseBufferPart2(FFMsg_H2G msg, byte[] buffer, ref int offset) { }
コード例 #17
0
 protected virtual void OnParseBufferPart1(FFMsg_H2G msg, byte[] buffer, FF_AppId_SessionIds sessionId, ref int offset)
 {
     msg.DeviceType = (FF_GmuId_DeviceTypes)buffer[offset++];
     msg.PollCode = buffer.GetBytesToNumberUInt8(offset++, 1).GetAppId<FF_GmuId_H2G_PollCodes, FF_AppId_H2G_PollCodes>();
     msg.SessionID = sessionId;
     offset++;
     msg.TransactionID = buffer.GetBytesToNumberUInt8(offset++, 1);
 }
コード例 #18
0
        private bool PopulateIP(FFMsg_H2G message)
        {
            using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "UpdateInstallationNo"))
            {
                bool retval = default(bool);

                try
                {
                    if (_mapInstallationIP != null &&
                        _mapInstallationIP.ContainsKey(message.InstallationNo))
                    {
                        message.IpAddress = _mapInstallationIP[message.InstallationNo];
                        retval = true;
                    }
                }
                catch (Exception ex)
                {
                    method.Exception(ex);
                }

                return retval;
            }
        }
コード例 #19
0
 protected override void OnParseEntityPart2(FFMsg_H2G msg, ref List<byte> buffer)
 {
     FFMsg_H2G_1 msg2 = msg as FFMsg_H2G_1;
     buffer.SetValue(msg2.SegmentCount, 2);
     buffer.SetValue(msg2.SegmentNumber, 2);
 }
コード例 #20
0
 protected virtual void OnParseEntityPart3(FFMsg_H2G msg, ref List<byte> buffer)
 {
     msg.EntityData = this.TargetParser.ParseTarget(msg);
     if (msg.EntityData == null) msg.EntityData = new byte[msg.DataLength];
     msg.DataLength = (ushort)msg.EntityData.Length;
     buffer.SetValue(msg.DataLength, _parentParser.DataLength);
     buffer.AddRange(msg.EntityData);
     buffer.CalculateAndStoreChecksum();
 }
コード例 #21
0
 protected virtual void OnParseBufferPart2(FFMsg_H2G msg, byte[] buffer, ref int offset)
 {
 }
コード例 #22
0
 protected override void OnParseBufferPart2(FFMsg_H2G msg, byte[] buffer, ref int offset)
 {
     FFMsg_H2G_1 msg2 = msg as FFMsg_H2G_1;
     msg2.SegmentNumber = buffer.GetValue<ushort>(offset, 2);
     offset += 2;
     msg2.SegmentCount = buffer.GetValue<ushort>(offset, 2);
     offset += 2;
 }
コード例 #23
0
        public bool ProcessMessage(FFMsg_H2G message)
        {
            using (ILogMethod method = Log.LogMethod(this.DYN_MODULE_NAME, "ProcessMessage(H2G)"))
            {
                bool result = default(bool);

                try
                {
                    var sessionId = (int)message.SessionID;
                    result = _handlers.ContainsKey(sessionId) ?
                        _handlers[sessionId].ProcessMessage(message) :
                        _genericHandler.ProcessMessage(message);
                }
                catch (Exception ex)
                {
                    method.Exception(ex);
                }

                return result;
            }
        }