예제 #1
0
		public async Task<WebServiceRequestStatus> PostRequest()
		{
			WebServiceRequestStatus status = WebServiceRequestStatus.SUCCESS;

			if (this.isRequestDataValid())
			{
				WebService ws = new WebService();
				string jsonString = JsonConvert.SerializeObject(request);
				System.Diagnostics.Debug.WriteLine(jsonString);
				this.request.requestJSON = jsonString;
				string responseStr = await ws.PostData(Utils.GetDeviceServicesURL() + METHOD_NAME, jsonString);
				System.Diagnostics.Debug.WriteLine(responseStr);
				this.response.responseJSON = responseStr;
				this.response = JsonConvert.DeserializeObject<GetDeviceInfoResponse>(responseStr, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
				if (string.Equals(this.response.ResponseStatus, "FAIL"))
					status = WebServiceRequestStatus.FAIL;
			}
			else
			{
				status = WebServiceRequestStatus.ERROR_REQUEST_DATA_INVALID;
			}
			return status;
		}
예제 #2
0
		private void SetSettingsFromGetDeviceInfoResponseWS(GetDeviceInfoResponse WSGetDeviceInfoResponseInstance)
		{

			UserInformationInstance.MemberDeviceId = WSGetDeviceInfoResponseInstance.MemberDeviceID;

			AppUpdateSettingsInstance.UpdateFlag = WSGetDeviceInfoResponseInstance.appUpdateInfo.UpdateFlag;
			AppUpdateSettingsInstance.UpdateType = WSGetDeviceInfoResponseInstance.appUpdateInfo.UpdateType;
			AppUpdateSettingsInstance.VersionOfNewApp = WSGetDeviceInfoResponseInstance.appUpdateInfo.VersionOfNewApp;

			this.updateType = AppUpdateSettingsInstance.UpdateType;

			FirmwareUpdateInfoInstance = new FirmwareUpdateInfo();
			FirmwareUpdateInfoInstance.ModelFirmwareID = WSGetDeviceInfoResponseInstance.deviceFwUpdateInfo.ModelFirmwareID;
			FirmwareUpdateInfoInstance.VersionOfNewFirmware = WSGetDeviceInfoResponseInstance.deviceFwUpdateInfo.VersionOfNewFirmware;

			MemberServerProfileInstance = new MemberServerProfile();
			MemberServerProfileInstance.MemberDeviceID = WSGetDeviceInfoResponseInstance.MemberDeviceID;
			MemberServerProfileInstance.UpdateFlag = (int)WSGetDeviceInfoResponseInstance.UpdateFlag;
			MemberServerProfileInstance.UpdateFlagChanges = 0;
			MemberServerProfileInstance.SynchronizationID = WSGetDeviceInfoResponseInstance.SynchronizationID;
			MemberServerProfileInstance.ServerDateTime = WSGetDeviceInfoResponseInstance.ServerDateTime;


			this.clearTracker = WSGetDeviceInfoResponseInstance.ClearTrackerDataFlag;


			ProcessSignatureUploaded(WSGetDeviceInfoResponseInstance.SignatureUploadedDates);
			this.SeizureBlockInfoInstance = new SeizureBlockInfo();
			if(WSGetDeviceInfoResponseInstance.lastSeizureDataUploadInfo != null)
				ProcessSeizureUploaded(WSGetDeviceInfoResponseInstance.lastSeizureDataUploadInfo.SeizureDate,WSGetDeviceInfoResponseInstance.lastSeizureDataUploadInfo.BlockNumber);


			//User Settings
			UserSettingsInstance.Stride = WSGetDeviceInfoResponseInstance.userSettings.Stride;
			UserSettingsInstance.Weight = WSGetDeviceInfoResponseInstance.userSettings.Weight;
			UserSettingsInstance.RestMetabolicRate = WSGetDeviceInfoResponseInstance.userSettings.RestMetabolicRate;
			UserSettingsInstance.UnitOfMeasure = WSGetDeviceInfoResponseInstance.userSettings.UnitOfMeasure;
			UserSettingsInstance.DOBYear = WSGetDeviceInfoResponseInstance.userSettings.DOBYear;
			UserSettingsInstance.DOBMonth = WSGetDeviceInfoResponseInstance.userSettings.DOBMonth;
			UserSettingsInstance.DOBDay = WSGetDeviceInfoResponseInstance.userSettings.DOBDay;
			UserSettingsInstance.Age = WSGetDeviceInfoResponseInstance.userSettings.Age;

			// Device Settings
			string serverTime = WSGetDeviceInfoResponseInstance.ServerDateTime;
			bool timeFormat = WSGetDeviceInfoResponseInstance.DeviceTimeFormat;

			DateTime st = Motion.Mobile.Utilities.Utils.GetServerDateTimeFromString(serverTime);

			//
			this.timeDiff = WSGetDeviceInfoResponseInstance.AllowableTimeDifference;


			Debug.WriteLine("Date Time" + st);
			DeviceSettingsInstance.Year = st.Year - 2000;
			DeviceSettingsInstance.Month = st.Month;
			DeviceSettingsInstance.Day = st.Day;
			DeviceSettingsInstance.Hour = st.Hour;
			DeviceSettingsInstance.Minute = st.Minute;
			DeviceSettingsInstance.Second = st.Second;
			DeviceSettingsInstance.HourType = timeFormat;



			//Company Settings
			CompanySettingsInstance.TenacitySteps = WSGetDeviceInfoResponseInstance.companySettings.TenacitySteps;
			CompanySettingsInstance.IntensitySteps = WSGetDeviceInfoResponseInstance.companySettings.IntensitySteps;
			CompanySettingsInstance.IntensityTime = WSGetDeviceInfoResponseInstance.companySettings.IntensityTime;
			CompanySettingsInstance.IntensityMinuteThreshold = WSGetDeviceInfoResponseInstance.companySettings.IntensityMinuteThreshold;
			CompanySettingsInstance.IntensityRestMinuteAllowed = WSGetDeviceInfoResponseInstance.companySettings.IntensityRestMinuteAllowed;
			CompanySettingsInstance.IntensityCycle = WSGetDeviceInfoResponseInstance.companySettings.IntensityCycle;
			CompanySettingsInstance.FrequencySteps = WSGetDeviceInfoResponseInstance.companySettings.FrequencySteps;
			CompanySettingsInstance.FrequencyCycleTime = WSGetDeviceInfoResponseInstance.companySettings.FrequencyCycleTime;
			CompanySettingsInstance.FrequencyCycle = WSGetDeviceInfoResponseInstance.companySettings.FrequencyCycle;
			CompanySettingsInstance.FrequencyCycleInterval = WSGetDeviceInfoResponseInstance.companySettings.FrequencyCycleInterval;


			//Exercise Settings
			ExerciseSettingsInstance.SyncTimeInterval = WSGetDeviceInfoResponseInstance.exerciseSettings.SyncTimeInterval;
			ExerciseSettingsInstance.DataSyncEnable = WSGetDeviceInfoResponseInstance.exerciseSettings.DataSyncEnable;
			ExerciseSettingsInstance.FrequencyAlarmEnable = WSGetDeviceInfoResponseInstance.exerciseSettings.FrequencyAlarmEnable;

			//Signature Settings
			SignatureSettingsInstance.SamplingFrequency = WSGetDeviceInfoResponseInstance.signatureSettings.SamplingFrequency;
			SignatureSettingsInstance.SamplingTime = WSGetDeviceInfoResponseInstance.signatureSettings.SamplingTime;
			SignatureSettingsInstance.SamplingCycle = WSGetDeviceInfoResponseInstance.signatureSettings.SamplingCycle;
			SignatureSettingsInstance.SamplingThreshold = WSGetDeviceInfoResponseInstance.signatureSettings.SamplingThreshold;
			SignatureSettingsInstance.SamplingTotalBlocks = WSGetDeviceInfoResponseInstance.signatureSettings.SamplingTotalBlocks;

			//Seizure Settings
			SeizureSettingsInstance.SeizureSettingsEnable = WSGetDeviceInfoResponseInstance.seizureSettings.SeizureSettingsEnable;
			SeizureSettingsInstance.SeizureSamplingFrequency = WSGetDeviceInfoResponseInstance.seizureSettings.SeizureSamplingFrequency;
			SeizureSettingsInstance.SeizureNumberOfRecords = WSGetDeviceInfoResponseInstance.seizureSettings.SeizureNumberOfRecords;
			SeizureSettingsInstance.SeizureSamplingTime = WSGetDeviceInfoResponseInstance.seizureSettings.SeizureSamplingTime;

		}