void rpc_deserialize(const uint8_t * p_buf, uint16_t length) {

	uint8_t fn_index;
	uint8_t sig_type;

	if (NULL != p_buf) {
		sig_type = p_buf[0];
		fn_index = p_buf[1];

		p_buf += 2;
		length -= 2;

		switch(sig_type) {
		case SIG_TYPE_NONE:
			if (sizeof(m_fct_none))
				deserialize_none(fn_index, p_buf, length);
			break;
		case SIG_TYPE_S:
			if (sizeof(m_fct_s))
				deserialize_s(fn_index, p_buf, length);
			break;
		case SIG_TYPE_P:
			if (sizeof(m_fct_p))
				deserialize_p(fn_index, p_buf, length);
			break;
		case SIG_TYPE_S_B:
			if (sizeof(m_fct_s_b))
				deserialize_s_b(fn_index, p_buf, length);
			break;
		case SIG_TYPE_B_B_P:
			if (sizeof(m_fct_b_b_p))
				deserialize_b_b_p(fn_index, p_buf, length);
			break;
		case SIG_TYPE_S_P:
			if (sizeof(m_fct_s_p))
				deserialize_s_p(fn_index, p_buf, length);
			break;
		case SIG_TYPE_S_B_P:
			if (sizeof(m_fct_s_b_p))
				deserialize_s_b_p(fn_index, p_buf, length);
			break;
		case SIG_TYPE_S_B_B_P:
			if (sizeof(m_fct_s_b_b_p))
				deserialize_s_b_b_p(fn_index, p_buf, length);
			break;
		default:
			panic(-1);
			break;
		}
	}
}
Beispiel #2
0
void rpc_deserialize(struct net_buf *buf)
{

	uint8_t fn_index;
	uint8_t sig_type;

	sig_type = buf->data[0];
	fn_index = buf->data[1];

	net_buf_pull(buf, 2);

	switch (sig_type) {
	case SIG_TYPE_NONE:
		if (fn_index < ARRAY_SIZE(m_fct_none)) {
			BT_DBG("%s", debug_func_none[fn_index]);
			deserialize_none(fn_index, buf);
		}
		break;
	case SIG_TYPE_S:
		if (fn_index < ARRAY_SIZE(m_fct_s)) {
			BT_DBG("%s", debug_func_s[fn_index]);
			deserialize_s(fn_index, buf);
		}
		break;
	case SIG_TYPE_P:
		if (fn_index < ARRAY_SIZE(m_fct_p)) {
			BT_DBG("%s", debug_func_p[fn_index]);
			deserialize_p(fn_index, buf);
		}
		break;
	case SIG_TYPE_S_B:
		if (fn_index < ARRAY_SIZE(m_fct_s_b)) {
			BT_DBG("%s", debug_func_s_b[fn_index]);
			deserialize_s_b(fn_index, buf);
		}
		break;
	case SIG_TYPE_B_B_P:
		if (fn_index < ARRAY_SIZE(m_fct_b_b_p)) {
			BT_DBG("%s", debug_func_b_b_p[fn_index]);
			deserialize_b_b_p(fn_index, buf);
		}
		break;
	case SIG_TYPE_S_P:
		if (fn_index < ARRAY_SIZE(m_fct_s_p)) {
			BT_DBG("%s", debug_func_s_p[fn_index]);
			deserialize_s_p(fn_index, buf);
		}
		break;
	case SIG_TYPE_S_B_P:
		if (fn_index < ARRAY_SIZE(m_fct_s_b_p)) {
			BT_DBG("%s", debug_func_s_b_p[fn_index]);
			deserialize_s_b_p(fn_index, buf);
		}
		break;
	case SIG_TYPE_S_B_B_P:
		if (fn_index < ARRAY_SIZE(m_fct_s_b_b_p)) {
			BT_DBG("%s", debug_func_s_b_b_p[fn_index]);
			deserialize_s_b_b_p(fn_index, buf);
		}
		break;
	default:
		panic(-1);
		break;
	}
}
Beispiel #3
0
void rpc_deserialize(const uint8_t *buf, uint16_t length)
{

	uint8_t fn_index;
	uint8_t sig_type;

	if (buf) {
		sig_type = buf[0];
		fn_index = buf[1];

		buf += 2;
		length -= 2;

		switch (sig_type) {
		case SIG_TYPE_NONE:
			if (sizeof(m_fct_none)) {
				BT_DBG("%s", debug_func_none[fn_index]);
				deserialize_none(fn_index, buf, length);
			}
			break;
		case SIG_TYPE_S:
			if (sizeof(m_fct_s)) {
				BT_DBG("%s", debug_func_s[fn_index]);
				deserialize_s(fn_index, buf, length);
			}
			break;
		case SIG_TYPE_P:
			if (sizeof(m_fct_p)) {
				BT_DBG("%s", debug_func_p[fn_index]);
				deserialize_p(fn_index, buf, length);
			}
			break;
		case SIG_TYPE_S_B:
			if (sizeof(m_fct_s_b)) {
				BT_DBG("%s", debug_func_s_b[fn_index]);
				deserialize_s_b(fn_index, buf, length);
			}
			break;
		case SIG_TYPE_B_B_P:
			if (sizeof(m_fct_b_b_p)) {
				BT_DBG("%s", debug_func_b_b_p[fn_index]);
				deserialize_b_b_p(fn_index, buf, length);
			}
			break;
		case SIG_TYPE_S_P:
			if (sizeof(m_fct_s_p)) {
				BT_DBG("%s", debug_func_s_p[fn_index]);
				deserialize_s_p(fn_index, buf, length);
			}
			break;
		case SIG_TYPE_S_B_P:
			if (sizeof(m_fct_s_b_p)) {
				BT_DBG("%s", debug_func_s_b_p[fn_index]);
				deserialize_s_b_p(fn_index, buf, length);
			}
			break;
		case SIG_TYPE_S_B_B_P:
			if (sizeof(m_fct_s_b_b_p)) {
				BT_DBG("%s", debug_func_s_b_b_p[fn_index]);
				deserialize_s_b_b_p(fn_index, buf, length);
			}
			break;
		default:
			panic(-1);
			break;
		}
	}
}