int handleOnvifPTZPresetActionError(struct soap *soap, OnvifPTZPreset* preset) {
	char v[LARGE_INFO_LENGTH] = {0};
	int result = SOAP_OK;
	switch(preset->error) {
	case ERROR_PTZ_INDEX_NOT_EXIST:
		sprintf(v, "preset token %d is not exist", preset->index);
		result = getOnvifSoapSenderSubCode2Fault(soap, "ter:InvalidArgVal", "ter:NoToken", v, NULL);
		break;
	case ERROR_PTZ_INDEX_OUT_RANGE:
		sprintf(v, "preset token index %d out of range", preset->index);
		result = getOnvifSoapReceiverSubCode2Fault(soap, "ter:Action", "ter:TooManyPresets", v, NULL);
		break;
	case ERROR_PTZ_PRESETNAME_NOT_EXIST:
		sprintf(v, "preset name %s is not valid", preset->name);
		result = getOnvifSoapSenderSubCode2Fault(soap, "ter:InvalidArgVal", "ter:InvalidPresetName", v, NULL);
		break;
	case ERROR_PTZ_INDEX_OVER:
		sprintf(v, "preset token index %d is reached max", preset->index);
		result = getOnvifSoapReceiverSubCode2Fault(soap, "ter:Action", "ter:TooManyPresets", v, NULL);
		break;
	case ERROR_PTZ_PRESETNAME_EMPTY:
		sprintf(v, "preset name is empty");
		result = getOnvifPTZSoapActionNotSupport(soap, v, NULL);
		break;
	case ERROR_PTZ_PRESETNAME_REPEAT:
		sprintf(v, "preset name %s is repeat", preset->name);
		result = getOnvifSoapSenderSubCode2Fault(soap, "ter:InvalidArgVal", "ter:PresetExist", v, NULL);
		break;
	}
	return result;
}
SOAP_FMAC5 int SOAP_FMAC6 __tptz__GetNode(struct soap* soap,
		struct _tptz__GetNode *tptz__GetNode,
		struct _tptz__GetNodeResponse *tptz__GetNodeResponse) {
	logInfo("__tptz__GetNode %s", tptz__GetNode->NodeToken);
	int index = getIndexFromPTZNodeToken(tptz__GetNode->NodeToken);
	if (index < 0) {
		return getOnvifSoapSenderSubCode2Fault(soap, "ter:InvalidArgVal",
				"ter:NoEntity", "ptz get node", "name token is invalid");
	}
	tptz__GetNodeResponse->PTZNode = getPTZNodeInfo(soap, index);
	return SOAP_OK;
}
SOAP_FMAC5 int SOAP_FMAC6 __tptz__GetConfiguration(struct soap* soap,
		struct _tptz__GetConfiguration *tptz__GetConfiguration,
		struct _tptz__GetConfigurationResponse *tptz__GetConfigurationResponse) {
	logInfo("__tptz__GetConfiguration %s",
			tptz__GetConfiguration->PTZConfigurationToken);
	int index = getIndexFromPTZConfigToken(
			tptz__GetConfiguration->PTZConfigurationToken);
	if (index < 0) {
		return getOnvifSoapSenderSubCode2Fault(soap, "ter:InvalidArgVal",
				"ter:NoConfig", "ptz get configuration",
				"name token is invalid");
	}
	tptz__GetConfigurationResponse->PTZConfiguration = getPTZConfiguration(
			soap);
	return SOAP_OK;
}
示例#4
0
int getOnvifSoapSendInvalidArgSubCodeFailedCode(struct soap *soap, const char *faultsubcodeQName1,
		const char *faultInfo, const char* faultDetail) {
	return getOnvifSoapSenderSubCode2Fault(soap, "ter:InvalidArgVal",
			faultsubcodeQName1, faultInfo, faultDetail);
}