コード例 #1
0
        public async Task <string> SetAllConfigurations([FromBody] MassConfigData data)
        {
            var authStatus = CheckClient(data.Id, out string rtspIp);

            switch (authStatus)
            {
            case 200:
            {
                Console.WriteLine($"Setting {rtspIp}");
                Console.WriteLine(await PutRequests.SetTimeFromBody(data.TimeData));
                Console.WriteLine(await PutRequests.SetNtpFromBody(data.NtpData));
                Console.WriteLine(await PutRequests.SetOsdChannelNameFromBody(data.OsdChannelNameData));
                Console.WriteLine(await PutRequests.SetOsdDateTimeFromBody(data.OsdDateTimeData));
                Console.WriteLine(await PutRequests.SetEmailFromBody(data.EmailData));
                Console.WriteLine(await PutRequests.SetDetectionFromBody(data.DetectionData));
                Console.WriteLine(await PutRequests.SetAlarmNotificationsFromBody(data.EventTriggerData));
                Console.WriteLine(await PutRequests.SetDnsFromBody(data.NetworkData));
                Console.WriteLine(await PutRequests.SetStreamConfigFromBody(data.StreamingData));
                Console.WriteLine(await PutRequests.ChangePassword());
                Console.WriteLine("Done");

                return($"Status сode {authStatus}: OK");
            }

            case 401:
            {
                _logger.Info("[SetAllConfigurations] Auth status 401. Unauthorized. \nMethod has completed");
                return("Auth status 401. Unauthorized.");
            }

            case 404:
            {
                _logger.Info("[SetAllConfigurations] Auth status 404. Device not supported. \nMethod has completed");
                return("Auth status 404. Device not supported.");
            }

            case 601:
            {
                _logger.Info("[SetAllConfigurations] Status 601. Rtsp_ip is null. \nMethod has completed");
                return("Status 601. Rtsp_ip is null.");
            }

            default:
            {
                _logger.Info($"[SetAllConfigurations] Auth status {authStatus}. Default error. \nMethod has completed");
                return("Default error.");
            }
            }
        }
コード例 #2
0
        public async Task <string> ChangeDetectionMaskFromBody([FromBody] DetectionData.GridFromDB data)
        {
            var authStatus = CheckClient(data.id, out string rtspIp);

            switch (authStatus)
            {
            case 200:
            {
                _logger.Info("[ChangeDetectionMaskFromBody] Auth status 200");

                var response = await PutRequests.ChangeDetectionMaskFromBody(data);

                _logger.Info("[ChangeDetectionMaskFromBody] Configuration is complete. \nMethod has completed");
                return(response);
            }

            case 401:
            {
                _logger.Info("[ChangeDetectionMaskFromBody] Auth status 401. Unauthorized. \nMethod has completed");
                return(null);
            }

            case 404:
            {
                _logger.Info("[ChangeDetectionMaskFromBody] Auth status 404. Device not supported. \nMethod has completed");
                return(null);
            }

            case 601:
            {
                _logger.Info("[ChangeDetectionMaskFromBody] Status 601. Rtsp_ip is null. \nMethod has completed");
                return(null);
            }

            default:
            {
                _logger.Info($"[ChangeDetectionMaskFromBody] Auth status {authStatus}. Default error. \nMethod has completed");
                return(null);
            }
            }
        }