Use totalBytesHack for intergateway2 too
This commit is contained in:
parent
991e174e2e
commit
dceda08e70
@ -1734,7 +1734,7 @@ func (client *WANCommonInterfaceConfig1) GetMaximumActiveConnections() (NewMaxim
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (client *WANCommonInterfaceConfig1) GetTotalBytesSent() (NewTotalBytesSent uint32, err error) {
|
func (client *WANCommonInterfaceConfig1) GetTotalBytesSent() (NewTotalBytesSent uint64, err error) {
|
||||||
// Request structure.
|
// Request structure.
|
||||||
request := interface{}(nil)
|
request := interface{}(nil)
|
||||||
// BEGIN Marshal arguments into request.
|
// BEGIN Marshal arguments into request.
|
||||||
@ -1753,14 +1753,14 @@ func (client *WANCommonInterfaceConfig1) GetTotalBytesSent() (NewTotalBytesSent
|
|||||||
|
|
||||||
// BEGIN Unmarshal arguments from response.
|
// BEGIN Unmarshal arguments from response.
|
||||||
|
|
||||||
if NewTotalBytesSent, err = soap.UnmarshalUi4(response.NewTotalBytesSent); err != nil {
|
if NewTotalBytesSent, err = soap.UnmarshalUi8(response.NewTotalBytesSent); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// END Unmarshal arguments from response.
|
// END Unmarshal arguments from response.
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (client *WANCommonInterfaceConfig1) GetTotalBytesReceived() (NewTotalBytesReceived uint32, err error) {
|
func (client *WANCommonInterfaceConfig1) GetTotalBytesReceived() (NewTotalBytesReceived uint64, err error) {
|
||||||
// Request structure.
|
// Request structure.
|
||||||
request := interface{}(nil)
|
request := interface{}(nil)
|
||||||
// BEGIN Marshal arguments into request.
|
// BEGIN Marshal arguments into request.
|
||||||
@ -1779,7 +1779,7 @@ func (client *WANCommonInterfaceConfig1) GetTotalBytesReceived() (NewTotalBytesR
|
|||||||
|
|
||||||
// BEGIN Unmarshal arguments from response.
|
// BEGIN Unmarshal arguments from response.
|
||||||
|
|
||||||
if NewTotalBytesReceived, err = soap.UnmarshalUi4(response.NewTotalBytesReceived); err != nil {
|
if NewTotalBytesReceived, err = soap.UnmarshalUi8(response.NewTotalBytesReceived); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// END Unmarshal arguments from response.
|
// END Unmarshal arguments from response.
|
||||||
|
@ -43,27 +43,7 @@ var dcpMetadata = []DCPMetadata{
|
|||||||
OfficialName: "Internet Gateway Device v1",
|
OfficialName: "Internet Gateway Device v1",
|
||||||
DocURL: "http://upnp.org/specs/gw/UPnP-gw-InternetGatewayDevice-v1-Device.pdf",
|
DocURL: "http://upnp.org/specs/gw/UPnP-gw-InternetGatewayDevice-v1-Device.pdf",
|
||||||
XMLSpecURL: "http://upnp.org/specs/gw/UPnP-gw-IGD-TestFiles-20010921.zip",
|
XMLSpecURL: "http://upnp.org/specs/gw/UPnP-gw-IGD-TestFiles-20010921.zip",
|
||||||
Hacks: []DCPHackFn{
|
Hacks: []DCPHackFn{totalBytesHack},
|
||||||
func(dcp *DCP) error {
|
|
||||||
for _, service := range dcp.Services {
|
|
||||||
if service.URN == "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1" {
|
|
||||||
variables := service.SCPD.StateVariables
|
|
||||||
for key, variable := range variables {
|
|
||||||
varName := variable.Name
|
|
||||||
if varName == "TotalBytesSent" || varName == "TotalBytesReceived" {
|
|
||||||
// Fix size of total bytes which is by default ui4 or maximum 4 GiB.
|
|
||||||
variable.DataType.Name = "ui8"
|
|
||||||
variables[key] = variable
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "internetgateway2",
|
Name: "internetgateway2",
|
||||||
@ -82,7 +62,7 @@ var dcpMetadata = []DCPMetadata{
|
|||||||
}
|
}
|
||||||
dcp.ServiceTypes[missingURN] = urnParts
|
dcp.ServiceTypes[missingURN] = urnParts
|
||||||
return nil
|
return nil
|
||||||
},
|
}, totalBytesHack,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -93,6 +73,26 @@ var dcpMetadata = []DCPMetadata{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func totalBytesHack(dcp *DCP) error {
|
||||||
|
for _, service := range dcp.Services {
|
||||||
|
if service.URN == "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1" {
|
||||||
|
variables := service.SCPD.StateVariables
|
||||||
|
for key, variable := range variables {
|
||||||
|
varName := variable.Name
|
||||||
|
if varName == "TotalBytesSent" || varName == "TotalBytesReceived" {
|
||||||
|
// Fix size of total bytes which is by default ui4 or maximum 4 GiB.
|
||||||
|
variable.DataType.Name = "ui8"
|
||||||
|
variables[key] = variable
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type DCPHackFn func(*DCP) error
|
type DCPHackFn func(*DCP) error
|
||||||
|
|
||||||
// NAME
|
// NAME
|
||||||
|
Loading…
Reference in New Issue
Block a user