1
1
using FroniusSolarClient . Entities . SolarAPI . V1 ;
2
2
using FroniusSolarClient . Entities . SolarAPI . V1 . InverterRealtimeData ;
3
+ using FroniusSolarClient . Extensions ;
3
4
using System ;
4
- using System . Collections . Generic ;
5
- using System . Text ;
6
5
7
6
namespace FroniusSolarClient . Services
8
7
{
@@ -13,12 +12,11 @@ internal class InverterRealtimeDataService : BaseDataService
13
12
{
14
13
private readonly string _cgi = "GetInverterRealtimeData.cgi" ;
15
14
16
- public InverterRealtimeDataService ( RestClient restClient )
15
+ public InverterRealtimeDataService ( RestClient restClient )
17
16
: base ( restClient )
18
17
{
19
18
}
20
19
21
-
22
20
/// <summary>
23
21
/// Builds the query string for the request
24
22
/// </summary>
@@ -27,35 +25,34 @@ public InverterRealtimeDataService(RestClient restClient)
27
25
protected string BuildQueryString ( int deviceId , Scope scope , DataCollection dataCollection )
28
26
{
29
27
//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 ( ) } ";
31
29
}
32
30
33
31
public Response < CumulationInverterData > GetCumulationInverterData ( int deviceId = 1 , Scope scope = Scope . Device )
34
32
{
35
- string baseEndpointURL = _cgi + BuildQueryString ( deviceId , scope , DataCollection . CumulationInverterData ) ;
33
+ string baseEndpointURL = _cgi + BuildQueryString ( deviceId , scope , DataCollection . CumulationInverterData ) ;
36
34
return GetDataServiceResponse < CumulationInverterData > ( baseEndpointURL ) ;
37
35
}
38
36
39
37
public Response < CommonInverterData > GetCommonInverterData ( int deviceId = 1 , Scope scope = Scope . Device )
40
38
{
41
39
string baseEndpointURL = _cgi + BuildQueryString ( deviceId , scope , DataCollection . CommonInverterData ) ;
42
- return GetDataServiceResponse < CommonInverterData > ( baseEndpointURL ) ;
40
+ return GetDataServiceResponse < CommonInverterData > ( baseEndpointURL ) ;
43
41
}
44
42
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 )
47
44
{
48
- string param = $ "?Scope={ scope . ToString ( ) } &DeviceId={ deviceId } &DataCollection=P3InverterData";
49
- string baseEndpointURL = _cgi + param ;
45
+ string baseEndpointURL = _cgi + BuildQueryString ( deviceId , scope , DataCollection . P3InverterData ) ;
50
46
return GetDataServiceResponse < P3InverterData > ( baseEndpointURL ) ;
51
47
}
52
48
49
+ [ Obsolete ( "use Get3PInverterData" ) ]
50
+ public Response < P3InverterData > GetP3InverterData ( int deviceId = 1 , Scope scope = Scope . Device ) => Get3PInverterData ( deviceId , scope ) ;
53
51
54
52
public Response < MinMaxInverterData > GetMinMaxInverterData ( int deviceId = 1 , Scope scope = Scope . Device )
55
53
{
56
54
string baseEndpointURL = _cgi + BuildQueryString ( deviceId , scope , DataCollection . MinMaxInverterData ) ;
57
55
return GetDataServiceResponse < MinMaxInverterData > ( baseEndpointURL ) ;
58
56
}
59
-
60
57
}
61
58
}
0 commit comments