The following section is the manual provided by them.
Definition
NeptuneCamHandle ntcOpen(_char_t* pstrDevID, NeptuneCamHandle* phCamHandle,ENeptuneDevAccess eAccessFlag=NEPTUNE_DEV_ACCESS_EXCLUSIVE)
Parameters
- [IN] pstrDevID : ID string of a camera
- [OUT] phCamHandle : camera handle
- [IN, Optional] AccessFlag : control mode
Example
_uint32_t nCameras = ntcGetCameraCount();
if ( nCameras > 0 )
{
pCamInfo = new NEPTUNE_CAM_INFO[nCameras];
ntcGetCameraInfo(pCamInfo, nCameras);
}
NeptuneCamHandle hCamHandle;
// if unicast
ntcOpen(pCamInfo[0].strCamID, &hCamHandle);
// if multicast
ntcOpen(pCamInfo[0].strCamID, &hCamHandle, NEPTUNE_DEV_ACCESS_CONTROL);
This is how I use it in my code:
class _NEPTUNE_CAM_INFO_(Structure):
pass
_NEPTUNE_CAM_INFO_._fields_ = [
('strVendor', c_char * 512),
('strModel', c_char * 512),
('strSerial', c_char * 512),
('strUserID', c_char * 512),
('strIP', c_char * 512),
('strMAC', c_char * 32),
('strSubnet', c_char * 512),
('strGateway', c_char * 512),
('strCamID', c_char * 512),
]
NEPTUNE_CAM_INFO = _NEPTUNE_CAM_INFO_
class IMICamera:
def __init__(self):
self._handle = c_void_p() # 记录当前连接设备的句柄
self.handle = pointer(self._handle) # 创建句柄指针
self.IMI_ntcInit()
def IMI_ntcInit(self):
IMICamCtrldll.ntcGetCameraCount.restype = c_int
return IMICamCtrldll.ntcInit()
# return MvCamCtrldll.ntcInit()
def IMI_ntcGetCameraCount(self, count):
IMICamCtrldll.ntcGetCameraCount.argtype = (c_void_p,)
IMICamCtrldll.ntcGetCameraCount.restype = c_int
return IMICamCtrldll.ntcGetCameraCount(byref(count))
def IMI_ntcGetCameraInfo(self, pInfo, count):
IMICamCtrldll.ntcGetCameraInfo.argtype = (c_void_p, c_void_p)
IMICamCtrldll.ntcGetCameraInfo.restype = c_int
return IMICamCtrldll.ntcGetCameraInfo(byref(pInfo), count)
def IMI_ntcOpen(self, pstrDevID):
IMICamCtrldll.ntcOpen.argtype = (c_char, c_void_p)
IMICamCtrldll.ntcOpen.restype = c_int
return IMICamCtrldll.ntcOpen(pstrDevID, byref(self.handle))
if __name__ == '__main__':
mv = IMICamera()
count = c_uint()
res = mv.IMI_ntcGetCameraCount(count)
if res != 0:
print('IMI_ntcGetCameraCount', res)
pInfo = (NEPTUNE_CAM_INFO * count.value)()
res = mv.IMI_ntcGetCameraInfo(pInfo, count)
if res != 0:
print('IMI_ntcGetCameraInfo', res)
strCamID = pInfo[1].strCamID
pid = (c_char * 512)()
for i in range(len(strCamID)):
pid[i] = strCamID[i]
pid2 = ctypes.create_string_buffer(512)
pid2.value = strCamID
pid3 = c_char_p(b'00:09:7e:02:80:88')
res = mv.IMI_ntcOpen(pid3)
I try many type parameters,as you can see in my code. After I run my code, the result is always get error_code -203,it means NEPTUNE_ERR_InvalidParameter.
How can i fix this? What have I done wrong? Thanks!