Open tms2003 opened 4 years ago
With this, but you need one media profile token
mycam = ONVIFCamera(cameraConfig['ip'], cameraConfig['port'], cameraConfig['onvif_user'], cameraConfig['onvif_pass'], cameraConfig['path_wsdl'])
# instances resources
media = mycam.create_media_service()
media_profile = media.GetProfiles()[0]
ptz = mycam.create_ptz_service()
# set profile token
requestPtzStatus = ptz.create_type('GetStatus')
requestPtzStatus.ProfileToken = media_profile.token
status = ptz.GetStatus(requestPtzStatus)
# return data from "ptz.GetStatus"
position = { }
position['x'] = status.Position.PanTilt.x
position['y'] = status.Position.PanTilt.y
position['z'] = status.Position.Zoom.x
To create a new media profile token
def createMediaProfile(name,token):
media = mycam.create_media_service()
newProfile = media.create_type('CreateProfile')
newProfile.Name = name
newProfile.Token = token
media.CreateProfile(newProfile)
how to get absulte value for ptz? I found locate absulately value in samples,but I can't get ptz value,so ,please help me!