Ejemplo n.º 1
0
        public static void DoDataRecord(DeviceData deviceData)
        {
            // TODO: Record it in the files.
            if (deviceData.OriginData != null && deviceData.OriginData.Length > 0)
            {
                if (deviceData.OriginData == DeviceData.BeginFlag)
                {
                    return;
                }
                else if (deviceData.OriginData == DeviceData.ErrorFlag)
                {
                    RecordManager.WriteDataToLog(deviceData.Device, "Error or No Data Received.", RecordType.Origin);
                    return;
                }
                string originLine = deviceData.OriginData;

                // remove temp by kaikai
                //RecordManager.WriteDataToLog(deviceData.Device, originLine.Trim(), RecordType.Origin);
            }

            string line = RecordManager.PackDeviceData(deviceData);

            // Record into MySQL:)
            if (!RecordManager.mysql.DoRecord(deviceData))
            {
                // TODO: Do log this failure.
                RecordManager.WriteDataToLog(deviceData.Device, "Insert to DB Error", RecordType.Data);
            }
            else
            {
                // log
                RecordManager.WriteDataToLog(deviceData.Device, line, RecordType.Data);
            }
        }
Ejemplo n.º 2
0
 public static void DoSystemEventRecord(Device device, string systemEvent, RecordType recordType = RecordType.Event, bool flush = false)
 {
     RecordManager.WriteDataToLog(device, systemEvent, recordType, flush);
 }