private JMethod generateZclCommandSignature(JDefinedClass jZclClass, JClass jParentClass,
			ZclCommandDescriptor zclCommandDescriptor, boolean addContext) throws Exception {

		if (zclCommandDescriptor.isResponse())
			return null;

		// FIXME: the return type depends on the returned response!!!!
		JType jReturnType = null;

		ZclCommandDescriptor responseCommand = zclCommandDescriptor.getResponse();
		if (responseCommand != null)
			jReturnType = jTypeForZigBeeTypeName(jModel, jParentClass._package(), jParentClass, responseCommand.getName());
		else
			jReturnType = jModel.VOID;

		JMethod jMethodCommandSignature = jZclClass.method(JMod.PUBLIC, jReturnType, getCommandName(zclCommandDescriptor));
		jMethodCommandSignature._throws(ApplianceException.class);
		jMethodCommandSignature._throws(ServiceClusterException.class);

		if (addContext && !contextLast)
			jMethodCommandSignature.param(IEndPointRequestContext.class, "context");

		Vector zclParametersDescriptors = zclCommandDescriptor.getParametersDescriptors();

		for (int i = 0; i < zclParametersDescriptors.size(); i++) {
			ZclField zclParameterDescriptor = (ZclField) zclParametersDescriptors.get(i);
			JType type = jTypeForZbTypename(jModel, jParentClass._package(), zclParameterDescriptor.getType(),
					zclParameterDescriptor);

			if (zclParameterDescriptor.isArray()) {
				jMethodCommandSignature.param(type.array(), zclParameterDescriptor.getName());
			} else {
				jMethodCommandSignature.param(type, zclParameterDescriptor.getName());
			}
		}

		if (addContext && contextLast)
			jMethodCommandSignature.param(IEndPointRequestContext.class, "context");

		if (confirmationRequiredField)
			jMethodCommandSignature.param(boolean.class, "confirmationRequired");

		return jMethodCommandSignature;
	}