コード例 #1
0
        public bool ProcessAggResult(ref AggResult result)
        {
            if (result == null || result.AggDatas.Count == 0)
            {
                Log.Info("agg data storage failed, para is null!");
                return(false);
            }

            SeclureCloudDbHelper dbHelper = SeclureCloudDbHelper.Instance();

            if (dbHelper == null)
            {
                Log.Info("agg data storage failed, dbhelper is null!");
                return(false);
            }

            Log.InfoFormat("struct:{0},factorId:{1},type:{2}, statrt data storage...", result.StructId, result.SafeFactorId, result.AggType);
            if (dbHelper.Accessor.SaveAggResult(result) > 0)
            {
                Log.InfoFormat("struct:{0},factorId:{1},type:{2}, data storage sucessful!", result.StructId, result.SafeFactorId, result.AggType);
                return(true);
            }
            else
            {
                Log.InfoFormat("struct:{0},factorId:{1},type:{2}, data storage failed!", result.StructId, result.SafeFactorId, result.AggType);
                return(false);
            }
        }
コード例 #2
0
        public override void PowerOn()
        {
            Log.Info("PowerOn");
            List <BaseAggConfig> configs = BaseAggConfig.Create(SeclureCloudDbHelper.Instance().Accessor.GetConfig());

            jobManage = new AggJobManage(configs);
            jobManage.StartWork();
        }
コード例 #3
0
 public void OnMessageReceived(string buff)
 {
     try
     {
         FsMessage msg = FsMessage.FromJson(buff);
         // real-time DAC: // body:{"dtu":1,"sensors":[17,20]}
         Log.InfoFormat("pull({0})", buff);
         if (msg != null && msg.Header.R == @"/agg/config/")
         {
             jobManage.StopWork();
             List <BaseAggConfig> configs = BaseAggConfig.Create(SeclureCloudDbHelper.Instance().Accessor.GetConfig());
             jobManage.ReStart(configs);
         }
     }
     catch (Exception ce)
     {
         Log.ErrorFormat("err {0}!", ce.Message);
     }
 }
コード例 #4
0
 protected DBDataPoolBase()
 {
     this.DbHelper = SeclureCloudDbHelper.Instance();
     //this.config = new BaseAggConfig();
 }