11using FroniusSolarClient . Entities . SolarAPI . V1 ;
22using FroniusSolarClient . Entities . SolarAPI . V1 . InverterRealtimeData ;
3+ using FroniusSolarClient . Extensions ;
34using System ;
4- using System . Collections . Generic ;
5- using System . Text ;
65
76namespace FroniusSolarClient . Services
87{
@@ -13,12 +12,11 @@ internal class InverterRealtimeDataService : BaseDataService
1312 {
1413 private readonly string _cgi = "GetInverterRealtimeData.cgi" ;
1514
16- public InverterRealtimeDataService ( RestClient restClient )
15+ public InverterRealtimeDataService ( RestClient restClient )
1716 : base ( restClient )
1817 {
1918 }
2019
21-
2220 /// <summary>
2321 /// Builds the query string for the request
2422 /// </summary>
@@ -27,35 +25,34 @@ public InverterRealtimeDataService(RestClient restClient)
2725 protected string BuildQueryString ( int deviceId , Scope scope , DataCollection dataCollection )
2826 {
2927 //TODO: Support list of string dictionary to build HTTP query string
30- return $ "?Scope={ scope } &DeviceId={ deviceId } &DataCollection={ dataCollection } ";
28+ return $ "?Scope={ scope } &DeviceId={ deviceId } &DataCollection={ dataCollection . GetDescription ( ) } ";
3129 }
3230
3331 public Response < CumulationInverterData > GetCumulationInverterData ( int deviceId = 1 , Scope scope = Scope . Device )
3432 {
35- string baseEndpointURL = _cgi + BuildQueryString ( deviceId , scope , DataCollection . CumulationInverterData ) ;
33+ string baseEndpointURL = _cgi + BuildQueryString ( deviceId , scope , DataCollection . CumulationInverterData ) ;
3634 return GetDataServiceResponse < CumulationInverterData > ( baseEndpointURL ) ;
3735 }
3836
3937 public Response < CommonInverterData > GetCommonInverterData ( int deviceId = 1 , Scope scope = Scope . Device )
4038 {
4139 string baseEndpointURL = _cgi + BuildQueryString ( deviceId , scope , DataCollection . CommonInverterData ) ;
42- return GetDataServiceResponse < CommonInverterData > ( baseEndpointURL ) ;
40+ return GetDataServiceResponse < CommonInverterData > ( baseEndpointURL ) ;
4341 }
4442
45-
46- public Response < P3InverterData > GetP3InverterData ( int deviceId = 1 , Scope scope = Scope . Device )
43+ public Response < P3InverterData > Get3PInverterData ( int deviceId = 1 , Scope scope = Scope . Device )
4744 {
48- string param = $ "?Scope={ scope . ToString ( ) } &DeviceId={ deviceId } &DataCollection=P3InverterData";
49- string baseEndpointURL = _cgi + param ;
45+ string baseEndpointURL = _cgi + BuildQueryString ( deviceId , scope , DataCollection . P3InverterData ) ;
5046 return GetDataServiceResponse < P3InverterData > ( baseEndpointURL ) ;
5147 }
5248
49+ [ Obsolete ( "use Get3PInverterData" ) ]
50+ public Response < P3InverterData > GetP3InverterData ( int deviceId = 1 , Scope scope = Scope . Device ) => Get3PInverterData ( deviceId , scope ) ;
5351
5452 public Response < MinMaxInverterData > GetMinMaxInverterData ( int deviceId = 1 , Scope scope = Scope . Device )
5553 {
5654 string baseEndpointURL = _cgi + BuildQueryString ( deviceId , scope , DataCollection . MinMaxInverterData ) ;
5755 return GetDataServiceResponse < MinMaxInverterData > ( baseEndpointURL ) ;
5856 }
59-
6057 }
6158}
0 commit comments