Пример #1
0
 public void set_fastread_flag(SSMParameterCode code, bool flag, bool quiet)
 {
     if (!quiet)
     {
         logger.Debug("Fastread flag of " + code.ToString() + "is enabled.");
     }
     content_table[code].FastReadEnable = flag;
 }
Пример #2
0
        protected override void processReceivedJSONMessage(string receivedJSONmode, string message, WebSocketSession session)
        {
            var sessionparam = (SSMCOMWebsocketSessionParam)session.Items["Param"];

            switch (receivedJSONmode)
            {
            //SSM COM all reset
            case (ResetJSONFormat.ModeCode):
                sessionparam.reset();
                send_response_msg(session, "SSMCOM session RESET. All send parameters are disabled.");
                break;

            case (SSMCOMReadJSONFormat.ModeCode):
                SSMCOMReadJSONFormat msg_obj_ssmread = JsonConvert.DeserializeObject <SSMCOMReadJSONFormat>(message);
                msg_obj_ssmread.Validate();

                SSMParameterCode target_code = (SSMParameterCode)Enum.Parse(typeof(SSMParameterCode), msg_obj_ssmread.code);
                bool             flag        = msg_obj_ssmread.flag;

                if (msg_obj_ssmread.read_mode == SSMCOMReadJSONFormat.FastReadModeCode)
                {
                    sessionparam.FastSendlist[target_code] = flag;
                }
                else
                {
                    sessionparam.SlowSendlist[target_code] = flag;
                }
                send_response_msg(session, "SSMCOM session read flag for : " + target_code.ToString() + " read_mode :" + msg_obj_ssmread.read_mode + " set to : " + flag.ToString());
                break;

            case (SSMSLOWREADIntervalJSONFormat.ModeCode):
                SSMSLOWREADIntervalJSONFormat msg_obj_interval = JsonConvert.DeserializeObject <SSMSLOWREADIntervalJSONFormat>(message);
                msg_obj_interval.Validate();
                ssmcom1.SlowReadInterval = msg_obj_interval.interval;

                send_response_msg(session, "SSMCOM slowread interval to : " + msg_obj_interval.interval.ToString());
                break;

            default:
                throw new JSONFormatsException("Unsuppoted mode property.");
            }
        }