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;
}
Example #2
0
int getOnvifSoapActionNotSupportSubCode1(struct soap *soap,
		const char* subCode1, const char *faultInfo, const char* faultDetail) {
	if (NULL == faultDetail)
		return getOnvifSoapReceiverSubCode2Fault(soap, "ter:ActionNotSupported",
				subCode1, faultInfo, "not support");
	else
		return getOnvifSoapReceiverSubCode2Fault(soap, "ter:ActionNotSupported",
				subCode1, faultInfo, faultDetail);
}