private Dictionary <string, string> GetApiArgs(bool cost, EnergyDataType data_type, int?mtu = null) { Dictionary <string, string> args; string key; key = cost.ToString() + data_type.ToString() + ((mtu != null) ? mtu.Value.ToString() : "1"); if (args_cache.TryGetValue(key, out args)) { return(args); } args = new Dictionary <string, string>(); if (cost) { args.Add("T", "1"); } else { args.Add("T", "0"); } args.Add("D", ((int)data_type).ToString()); if (data_type == EnergyDataType.MTU) { if (mtu != null) { args.Add("M", mtu.Value.ToString()); } else { args.Add("M", "1"); } } args_cache.Add(key, args); return(args); }
public SpyderData GetSpyderData(bool cost, EnergyDataType data_type, int?mtu = null) { RestClient.RestResponse <SpyderData> response; response = client.Execute <SpyderData>("SpyderData.xml", "GET", null, GetApiArgs(cost, data_type, mtu)); if (response.StatusCode == System.Net.HttpStatusCode.OK) { return(response.Data); } UpdateStatus <SpyderData>(response); return(null); }
public DialDataDetail GetSystemOverview(bool cost, EnergyDataType data_type, int?mtu = null) { RestClient.RestResponse <DialDataDetail> response; response = client.Execute <DialDataDetail>("SystemOverview.xml", "GET", null, GetApiArgs(cost, data_type, mtu)); if (response.StatusCode == System.Net.HttpStatusCode.OK) { return(response.Data); } UpdateStatus <DialDataDetail>(response); return(null); }
public DashData GetDashData(bool cost, EnergyDataType data_type, int?mtu = null) { RestClient.RestResponse <DashData> response; response = client.Execute <DashData>("DashData.xml", "GET", null, GetApiArgs(cost, data_type, mtu)); if ((response.StatusCode == HttpStatusCode.OK) && (response.Data != null)) { response.Data.Type = data_type; response.Data.Cost = cost; if (mtu != null) { response.Data.MTU = mtu.Value; } return(response.Data); } UpdateStatus <DashData>(response); return(null); }