Esempio n. 1
0
        public string GetInternetAlpacaFormData()
        {
            // Build the settings data, convert to JSON, and return it
            var websitesettings = new JsonInternetSettingsWebsite()
            {
                directory = cumulus.ftp_directory,
                forumurl  = cumulus.ForumURL,
                ftpport   = cumulus.ftp_port,
                hostname  = cumulus.ftp_host,
                password  = cumulus.ftp_password,
                username  = cumulus.ftp_user,
                webcamurl = cumulus.WebcamURL
            };

            var websettings = new JsonInternetSettingsWebSettings()
            {
                activeftp             = cumulus.ActiveFTPMode,
                sslftp                = cumulus.Sslftp,
                autoupdate            = cumulus.WebAutoUpdate,
                enablerealtime        = cumulus.RealtimeEnabled,
                enablerealtimeftp     = cumulus.RealtimeFTPEnabled,
                realtimetxtftp        = cumulus.RealtimeTxtFTP,
                realtimegaugestxtftp  = cumulus.RealtimeGaugesTxtFTP,
                realtimeinterval      = cumulus.RealtimeInterval / 1000,
                ftpdelete             = cumulus.DeleteBeforeUpload,
                ftpinterval           = cumulus.UpdateInterval,
                ftprename             = cumulus.FTPRename,
                includestdfiles       = cumulus.IncludeStandardFiles,
                includegraphdatafiles = cumulus.IncludeGraphDataFiles,
                utf8encode            = cumulus.UTF8encode,
                ftplogging            = cumulus.FTPlogging
            };

            var externalprograms = new JsonInternetSettingsExternalPrograms()
            {
                dailyprogram          = cumulus.DailyProgram,
                dailyprogramparams    = cumulus.DailyParams,
                program               = cumulus.ExternalProgram,
                programparams         = cumulus.ExternalParams,
                realtimeprogram       = cumulus.RealtimeProgram,
                realtimeprogramparams = cumulus.RealtimeParams
            };

            var twittersettings = new JsonInternetSettingsTwitterSettings()
            {
                enabled      = cumulus.TwitterEnabled,
                interval     = cumulus.TwitterInterval,
                password     = cumulus.TwitterPW,
                sendlocation = cumulus.TwitterSendLocation,
                user         = cumulus.Twitteruser
            };

            var wusettings = new JsonInternetSettingsWunderground()
            {
                catchup       = cumulus.WundCatchUp,
                enabled       = cumulus.WundEnabled,
                includeindoor = cumulus.SendIndoorToWund,
                includesolar  = cumulus.SendSRToWund,
                includeuv     = cumulus.SendUVToWund,
                interval      = cumulus.WundInterval,
                password      = cumulus.WundPW,
                rapidfire     = cumulus.WundRapidFireEnabled,
                sendavgwind   = cumulus.WundSendAverage,
                stationid     = cumulus.WundID
            };

            var awekassettings = new JsonInternetSettingsAwekas()
            {
                enabled         = cumulus.AwekasEnabled,
                includesolar    = cumulus.SendSolarToAwekas,
                includesoiltemp = cumulus.SendSoilTempToAwekas,
                includeuv       = cumulus.SendUVToAwekas,
                interval        = cumulus.AwekasInterval,
                lang            = cumulus.AwekasLang,
                password        = cumulus.AwekasPW,
                user            = cumulus.AwekasUser
            };

            var wcloudsettings = new JsonInternetSettingsWCloud()
            {
                enabled      = cumulus.WCloudEnabled,
                includesolar = cumulus.SendSolarToWCloud,
                includeuv    = cumulus.SendUVToWCloud,
                key          = cumulus.WCloudKey,
                wid          = cumulus.WCloudWid
            };

            var pwssettings = new JsonInternetSettingsPWSweather()
            {
                catchup      = cumulus.PWSCatchUp,
                enabled      = cumulus.PWSEnabled,
                interval     = cumulus.PWSInterval,
                includesolar = cumulus.SendSRToPWS,
                includeuv    = cumulus.SendUVToPWS,
                password     = cumulus.PWSPW,
                stationid    = cumulus.PWSID
            };

            var wowsettings = new JsonInternetSettingsWOW()
            {
                catchup      = cumulus.WOWCatchUp,
                enabled      = cumulus.WOWEnabled,
                includesolar = cumulus.SendSRToWOW,
                includeuv    = cumulus.SendUVToWOW,
                interval     = cumulus.WOWInterval,
                password     = cumulus.WOWPW,
                stationid    = cumulus.WOWID
            };

            var wbsettings = new JsonInternetSettingsWeatherbug()
            {
                catchup      = cumulus.WeatherbugCatchUp,
                enabled      = cumulus.WeatherbugEnabled,
                includesolar = cumulus.SendSRToWeatherbug,
                includeuv    = cumulus.SendUVToWeatherbug,
                interval     = cumulus.WeatherbugInterval,
                number       = cumulus.WeatherbugNumber,
                password     = cumulus.WeatherbugPW,
                publisherid  = cumulus.WeatherbugID
            };

            var cwopsettings = new JsonInternetSettingsCwop()
            {
                enabled      = cumulus.APRSenabled,
                id           = cumulus.APRSID,
                interval     = cumulus.APRSinterval,
                includesolar = cumulus.SendSRToAPRS,
                password     = cumulus.APRSpass,
                port         = cumulus.APRSport,
                server       = cumulus.APRSserver
            };

            var httpproxy = new JsonInternetSettingsHTTPproxySettings()
            {
                password = cumulus.HTTPProxyPassword,
                port     = cumulus.HTTPProxyPort,
                proxy    = cumulus.HTTPProxyName,
                user     = cumulus.HTTPProxyUser
            };

            var proxy = new JsonInternetSettingsProxySettings()
            {
                httpproxy = httpproxy
            };

            var customseconds = new JsonInternetSettingsCustomHttpSeconds()
            {
                enabled  = cumulus.CustomHttpSecondsEnabled,
                interval = cumulus.CustomHttpSecondsInterval,
                url      = cumulus.CustomHttpSecondsString
            };

            var customminutes = new JsonInternetSettingsCustomHttpMinutes()
            {
                enabled       = cumulus.CustomHttpMinutesEnabled,
                intervalindex = cumulus.CustomHttpMinutesIntervalIndex,
                url           = cumulus.CustomHttpMinutesString
            };

            var customrollover = new JsonInternetSettingsCustomHttpRollover()
            {
                enabled = cumulus.CustomHttpRolloverEnabled,
                url     = cumulus.CustomHttpRolloverString
            };

            var customhttp = new JsonInternetSettingsCustomHttpSettings()
            {
                customseconds = customseconds, customminutes = customminutes, customrollover = customrollover
            };

            var data = new JsonInternetSettingsData()
            {
                website          = websitesettings,
                websettings      = websettings,
                externalprograms = externalprograms,
                twitter          = twittersettings,
                wunderground     = wusettings,
                awekas           = awekassettings,
                weathercloud     = wcloudsettings,
                pwsweather       = pwssettings,
                wow        = wowsettings,
                weatherbug = wbsettings,
                cwop       = cwopsettings,
                proxies    = proxy,
                customhttp = customhttp
            };

            return(JSON.ToJSON(data));
        }
Esempio n. 2
0
        public string GetInternetAlpacaFormData()
        {
            // Build the settings data, convert to JSON, and return it
            var websitesettings = new JsonInternetSettingsWebsite()
            {
                directory = cumulus.ftp_directory,
                forumurl  = cumulus.ForumURL,
                ftpport   = cumulus.ftp_port,
                sslftp    = (int)cumulus.Sslftp,
                hostname  = cumulus.ftp_host,
                password  = cumulus.ftp_password,
                username  = cumulus.ftp_user,
                sshAuth   = cumulus.SshftpAuthentication,
                pskFile   = cumulus.SshftpPskFile,
                webcamurl = cumulus.WebcamURL
            };

            var websettings = new JsonInternetSettingsWebSettings()
            {
                activeftp             = cumulus.ActiveFTPMode,
                autoupdate            = cumulus.WebAutoUpdate,
                enablerealtime        = cumulus.RealtimeEnabled,
                enablerealtimeftp     = cumulus.RealtimeFTPEnabled,
                realtimetxtftp        = cumulus.RealtimeTxtFTP,
                realtimegaugestxtftp  = cumulus.RealtimeGaugesTxtFTP,
                realtimeinterval      = cumulus.RealtimeInterval / 1000,
                ftpdelete             = cumulus.DeleteBeforeUpload,
                ftpinterval           = cumulus.UpdateInterval,
                ftprename             = cumulus.FTPRename,
                includestdfiles       = cumulus.IncludeStandardFiles,
                includegraphdatafiles = cumulus.IncludeGraphDataFiles,
                includemoonimage      = cumulus.IncludeMoonImage,
                utf8encode            = cumulus.UTF8encode,
                ftplogging            = cumulus.FTPlogging
            };

            var externalprograms = new JsonInternetSettingsExternalPrograms()
            {
                dailyprogram          = cumulus.DailyProgram,
                dailyprogramparams    = cumulus.DailyParams,
                program               = cumulus.ExternalProgram,
                programparams         = cumulus.ExternalParams,
                realtimeprogram       = cumulus.RealtimeProgram,
                realtimeprogramparams = cumulus.RealtimeParams
            };

            var twittersettings = new JsonInternetSettingsTwitterSettings()
            {
                enabled      = cumulus.TwitterEnabled,
                interval     = cumulus.TwitterInterval,
                password     = cumulus.TwitterPW,
                sendlocation = cumulus.TwitterSendLocation,
                user         = cumulus.Twitteruser
            };

            var wusettings = new JsonInternetSettingsWunderground()
            {
                catchup       = cumulus.WundCatchUp,
                enabled       = cumulus.WundEnabled,
                includeindoor = cumulus.SendIndoorToWund,
                includesolar  = cumulus.SendSRToWund,
                includeuv     = cumulus.SendUVToWund,
                interval      = cumulus.WundInterval,
                password      = cumulus.WundPW,
                rapidfire     = cumulus.WundRapidFireEnabled,
                sendavgwind   = cumulus.WundSendAverage,
                stationid     = cumulus.WundID
            };

            var windysettings = new JsonInternetSettingsWindy()
            {
                catchup    = cumulus.WindyCatchUp,
                enabled    = cumulus.WindyEnabled,
                includeuv  = cumulus.WindySendUV,
                interval   = cumulus.WindyInterval,
                apikey     = cumulus.WindyApiKey,
                stationidx = cumulus.WindyStationIdx
            };

            var awekassettings = new JsonInternetSettingsAwekas()
            {
                enabled             = cumulus.AwekasEnabled,
                includesolar        = cumulus.SendSolarToAwekas,
                includesoiltemp     = cumulus.SendSoilTempToAwekas,
                includesoilmoisture = cumulus.SendSoilMoistureToAwekas,
                includeleafwetness  = cumulus.SendLeafWetnessToAwekas,
                includeindoor       = cumulus.SendIndoorToAwekas,
                includeuv           = cumulus.SendUVToAwekas,
                interval            = cumulus.AwekasInterval,
                lang     = cumulus.AwekasLang,
                password = cumulus.AwekasPW,
                user     = cumulus.AwekasUser
            };

            var wcloudsettings = new JsonInternetSettingsWCloud()
            {
                enabled      = cumulus.WCloudEnabled,
                includesolar = cumulus.SendSolarToWCloud,
                includeuv    = cumulus.SendUVToWCloud,
                key          = cumulus.WCloudKey,
                wid          = cumulus.WCloudWid
            };

            var pwssettings = new JsonInternetSettingsPWSweather()
            {
                catchup      = cumulus.PWSCatchUp,
                enabled      = cumulus.PWSEnabled,
                interval     = cumulus.PWSInterval,
                includesolar = cumulus.SendSRToPWS,
                includeuv    = cumulus.SendUVToPWS,
                password     = cumulus.PWSPW,
                stationid    = cumulus.PWSID
            };

            var wowsettings = new JsonInternetSettingsWOW()
            {
                catchup      = cumulus.WOWCatchUp,
                enabled      = cumulus.WOWEnabled,
                includesolar = cumulus.SendSRToWOW,
                includeuv    = cumulus.SendUVToWOW,
                interval     = cumulus.WOWInterval,
                password     = cumulus.WOWPW,
                stationid    = cumulus.WOWID
            };

            var cwopsettings = new JsonInternetSettingsCwop()
            {
                enabled      = cumulus.APRSenabled,
                id           = cumulus.APRSID,
                interval     = cumulus.APRSinterval,
                includesolar = cumulus.SendSRToAPRS,
                password     = cumulus.APRSpass,
                port         = cumulus.APRSport,
                server       = cumulus.APRSserver
            };


            var mqttUpdate = new JsonInternetSettingsMqttDataupdate()
            {
                enabled  = cumulus.MQTTEnableDataUpdate,
                topic    = cumulus.MQTTUpdateTopic,
                template = cumulus.MQTTUpdateTemplate
            };

            var mqttInterval = new JsonInternetSettingsMqttInterval()
            {
                enabled  = cumulus.MQTTEnableInterval,
                time     = cumulus.MQTTIntervalTime,
                topic    = cumulus.MQTTIntervalTopic,
                template = cumulus.MQTTIntervalTemplate
            };

            var mqttsettings = new JsonInternetSettingsMqtt()
            {
                server     = cumulus.MQTTServer,
                port       = cumulus.MQTTPort,
                useTls     = cumulus.MQTTUseTLS,
                username   = cumulus.MQTTUsername,
                password   = cumulus.MQTTPassword,
                dataUpdate = mqttUpdate,
                interval   = mqttInterval
            };

            var moonimagesettings = new JsonInternetSettingsMoonImage()
            {
                enabled = cumulus.MoonImageEnabled,
                size    = cumulus.MoonImageSize,
                ftpdest = cumulus.MoonImageFtpDest
            };

            var httpproxy = new JsonInternetSettingsHTTPproxySettings()
            {
                password = cumulus.HTTPProxyPassword,
                port     = cumulus.HTTPProxyPort,
                proxy    = cumulus.HTTPProxyName,
                user     = cumulus.HTTPProxyUser
            };

            var proxy = new JsonInternetSettingsProxySettings()
            {
                httpproxy = httpproxy
            };

            var customseconds = new JsonInternetSettingsCustomHttpSeconds()
            {
                enabled  = cumulus.CustomHttpSecondsEnabled,
                interval = cumulus.CustomHttpSecondsInterval,
                url      = cumulus.CustomHttpSecondsString
            };

            var customminutes = new JsonInternetSettingsCustomHttpMinutes()
            {
                enabled       = cumulus.CustomHttpMinutesEnabled,
                intervalindex = cumulus.CustomHttpMinutesIntervalIndex,
                url           = cumulus.CustomHttpMinutesString
            };

            var customrollover = new JsonInternetSettingsCustomHttpRollover()
            {
                enabled = cumulus.CustomHttpRolloverEnabled,
                url     = cumulus.CustomHttpRolloverString
            };

            var customhttp = new JsonInternetSettingsCustomHttpSettings()
            {
                customseconds = customseconds, customminutes = customminutes, customrollover = customrollover
            };

            var data = new JsonInternetSettingsData()
            {
                website          = websitesettings,
                websettings      = websettings,
                externalprograms = externalprograms,
                twitter          = twittersettings,
                wunderground     = wusettings,
                windy            = windysettings,
                awekas           = awekassettings,
                weathercloud     = wcloudsettings,
                pwsweather       = pwssettings,
                wow        = wowsettings,
                cwop       = cwopsettings,
                mqtt       = mqttsettings,
                moonimage  = moonimagesettings,
                proxies    = proxy,
                customhttp = customhttp
            };

            return(JsonConvert.SerializeObject(data));
        }