Example #1
0
/*
 * extends kenwood_get_func
 * Assumes rig!=NULL, val!=NULL
 */
int ts570_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
{
		char fctbuf[50];
		size_t fct_len;
		int retval;

		fct_len = 50;
		/* filter unimplemented RIG_FUNC_TUNER
		 * and send all other requests to kenwood_get_func()
		 */
		switch (func) {
		case RIG_FUNC_NR:
			retval = kenwood_transaction (rig, "NR", fctbuf, sizeof (fctbuf));
			if (retval != RIG_OK)
				return retval;
			fct_len = strlen (fctbuf);
			if (fct_len != 3) {
				rig_debug(RIG_DEBUG_ERR,"kenwood_get_func: "
					"wrong answer len=%d\n", fct_len);
				return -RIG_ERJCTED;
			}

			*status = atoi(&fctbuf[2]);
			break;

		case RIG_FUNC_TUNER:
			retval = kenwood_transaction (rig, "AC", fctbuf, sizeof (fctbuf));
			if (retval != RIG_OK)
				return retval;
			fct_len = strlen (fctbuf);
			if (fct_len != 5) {
				rig_debug(RIG_DEBUG_ERR,"kenwood_get_func: "
					"wrong answer len=%d\n", fct_len);
				return -RIG_ERJCTED;
			}

			*status = fctbuf[3] == '0' ? 0 : 1;
			break;

		default:
			return kenwood_get_func(rig, vfo, func, status);
		}

		return RIG_OK;
}
Example #2
0
/*
 * Some functions, notably RIT and XIT On/Off status, can be queried
 * on the K3.  Those functions are handled here and others are passed
 * through to kenwood_get_func().
 */
int k3_get_func(RIG *rig, vfo_t vfo, setting_t func, int *status)
{
	rig_debug(RIG_DEBUG_VERBOSE, "%s called\n", __func__);

	if (!rig || !status)
		return -RIG_EINVAL;

	switch (func) {
	case RIG_FUNC_RIT:
		return get_kenwood_func(rig, "RT", status);

	case RIG_FUNC_XIT:
		return get_kenwood_func(rig, "XT", status);

	default:
		return kenwood_get_func(rig, vfo, func, status);
	}
}