refactor: update HTTP request handling and improve documentation

- Replaced http.NewRequest with http.NewRequestWithContext in client tests for better context management.
- Updated method names and comments for clarity, including renaming GetWsdlUrl to GetWsdlURL and StorageUri to StorageURI for consistency.
- Enhanced comments across various files to provide clearer descriptions of functionality and ONVIF specifications.
This commit is contained in:
0x524a
2025-12-02 08:41:37 -05:00
parent 9e3b5e0170
commit 96ac509c24
32 changed files with 248 additions and 184 deletions
+6 -6
View File
@@ -17,7 +17,7 @@ type GetDeviceInformationResponse struct {
Model string `xml:"Model"`
FirmwareVersion string `xml:"FirmwareVersion"`
SerialNumber string `xml:"SerialNumber"`
HardwareId string `xml:"HardwareId"`
HardwareID string `xml:"HardwareId"`
}
// GetCapabilitiesResponse represents GetCapabilities response.
@@ -110,8 +110,8 @@ type MediaCapabilities struct {
// StreamingCapabilities represents streaming capabilities.
type StreamingCapabilities struct {
RTPMulticast bool `xml:"RTPMulticast,attr"`
RTP_TCP bool `xml:"RTP_TCP,attr"`
RTP_RTSP_TCP bool `xml:"RTP_RTSP_TCP,attr"`
RTPTCP bool `xml:"RTP_TCP,attr"`
RTPRTSPTCP bool `xml:"RTP_RTSP_TCP,attr"`
}
// PTZCapabilities represents PTZ service capabilities.
@@ -153,7 +153,7 @@ func (s *Server) HandleGetDeviceInformation(body interface{}) (interface{}, erro
Model: s.config.DeviceInfo.Model,
FirmwareVersion: s.config.DeviceInfo.FirmwareVersion,
SerialNumber: s.config.DeviceInfo.SerialNumber,
HardwareId: s.config.DeviceInfo.HardwareID,
HardwareID: s.config.DeviceInfo.HardwareID,
}, nil
}
@@ -204,8 +204,8 @@ func (s *Server) HandleGetCapabilities(body interface{}) (interface{}, error) {
XAddr: baseURL + "/media_service",
StreamingCapabilities: &StreamingCapabilities{
RTPMulticast: false,
RTP_TCP: true,
RTP_RTSP_TCP: true,
RTPTCP: true,
RTPRTSPTCP: true,
},
},
}