Beispiel #1
0
extern int rilCcMain(int request, void *data, size_t datalen, RIL_Token t)
{
	switch (request) {
	case RIL_REQUEST_GET_CURRENT_CALLS:
		requestGetCurrentCalls(data, datalen, t);
		break;
	case RIL_REQUEST_DIAL:
		requestDial(data, datalen, t, 0);
		break;
	case RIL_REQUEST_HANGUP:
		requestHangup(data, datalen, t);
		break;
	case RIL_REQUEST_HANGUP_WAITING_OR_BACKGROUND:
		requestHangupWaitingOrBackground(data, datalen, t);
		break;
	case RIL_REQUEST_HANGUP_FOREGROUND_RESUME_BACKGROUND:
		requestHangupForegroundResumeBackground(data, datalen, t);
		break;
	case RIL_REQUEST_SWITCH_WAITING_OR_HOLDING_AND_ACTIVE:
		requestSwitchWaitingOrHoldingAndActive(data, datalen, t);
		break;
	case RIL_REQUEST_ANSWER:
		requestAnswer(data, datalen, t);
		break;
	case RIL_REQUEST_CONFERENCE:
		requestConference(data, datalen, t);
		break;
	case RIL_REQUEST_UDUB:
		requestUdub(data, datalen, t);
		break;
	case RIL_REQUEST_SEPARATE_CONNECTION:
		requestSeparateConnection(data, datalen, t);
		break;
	case RIL_REQUEST_EXPLICIT_CALL_TRANSFER:
		requestExplicitCallTransfer(data, datalen, t);
		break;
	case RIL_REQUEST_LAST_CALL_FAIL_CAUSE:
		requestLastCallFailCause(data, datalen, t);
		break;
	case RIL_REQUEST_DTMF:
		requestDtmf(data, datalen, t);
		break;
	case RIL_REQUEST_DTMF_START:
		requestDtmfStart(data, datalen, t);
		break;
	case RIL_REQUEST_DTMF_STOP:
		requestDtmfStop(data, datalen, t);
		break;
	case RIL_REQUEST_SET_TTY_MODE:
		requestSetTTYMode(data, datalen, t);
		break;
	/* MTK proprietary start */
	case RIL_REQUEST_EMERGENCY_DIAL:
		requestDial(data, datalen, t, 1);
		break;
	case RIL_REQUEST_HANGUP_ALL:
		requestHangupAll(data, datalen, t);
		break;
	case RIL_REQUEST_HANGUP_ALL_EX:
		requestHangupAllEx(data, datalen, t);
		break;
	case RIL_REQUEST_FORCE_RELEASE_CALL:
		requestForceReleaseCall(data, datalen, t);
		break;
	case RIL_REQUEST_SET_CALL_INDICATION:
		requestSetCallIndication(data, datalen, t);
		break;
	case RIL_REQUEST_GET_CCM:
		requestGetCcm(data, datalen, t);
		break;
	case RIL_REQUEST_GET_ACM:
		requestGetAcm(data, datalen, t);
		break;
	case RIL_REQUEST_GET_ACMMAX:
		requestGetAcmMax(data, datalen, t);
		break;
	case RIL_REQUEST_GET_PPU_AND_CURRENCY:
		requestGetPpuAndCurrency(data, datalen, t);
		break;
	case RIL_REQUEST_SET_ACMMAX:
		requestSetAcmMax(data, datalen, t);
		break;
	case RIL_REQUEST_RESET_ACM:
		requestResetAcm(data, datalen, t);
		break;
	case RIL_REQUEST_SET_PPU_AND_CURRENCY:
		requestSetPpuAndCurrency(data, datalen, t);
		break;
	case RIL_REQUEST_DISABLE_VT_CAPABILITY:
		requestDisableVTCapability(data, datalen, t);
		break;
		/* MTK proprietary end */
#ifdef  MTK_VT3G324M_SUPPORT
	case RIL_REQUEST_VT_DIAL:
		requestVtDial(data, datalen, t);
		break;
	case RIL_REQUEST_VOICE_ACCEPT:
		requestVoiceAccept(data, datalen, t);
		break;
	case RIL_REQUEST_REPLACE_VT_CALL:
		requestReplaceVtCall(data, datalen, t);
		break;
#endif  /* MTK_VT3G324M_SUPPORT */
	default:
		return 0; /* no matched request */
		break;
	}

	return 1; /* request found and handled */
}
bool RControlStationComm::getState(int car, CAR_STATE *state, int timeoutMs)
{
    bool ret = true;

    if (!isTcpConnected()) {
        qWarning() << "libRControlStation: not connected";
        ret = false;
        return ret;
    }

    QByteArray xml = requestAnswer(car, "getState", timeoutMs);

    if (!xml.isEmpty()) {
        QXmlStreamReader stream(xml);
        stream.readNextStartElement();
        QString name;

        while (stream.readNextStartElement()) {
            if (stream.hasError()) {
                break;
            }

            name = stream.name().toString();

            if (name == "getState") {
                bool ok = true;

                while (stream.readNextStartElement()) {
                    QString name2 = stream.name().toString();

                    if (name2 == "id") {
                        stream.readElementText(); // Skip
                    } else if (name2 == "fw_major") {
                        state->fw_major = stream.readElementText().toInt();
                    } else if (name2 == "fw_minor") {
                        state->fw_minor = stream.readElementText().toInt();
                    } else if (name2 == "roll") {
                        state->roll = stream.readElementText().toDouble();
                    } else if (name2 == "pitch") {
                        state->pitch = stream.readElementText().toDouble();
                    } else if (name2 == "yaw") {
                        state->yaw = stream.readElementText().toDouble();
                    } else if (name2 == "accel_0") {
                        state->accel[0] = stream.readElementText().toDouble();
                    } else if (name2 == "accel_1") {
                        state->accel[1] = stream.readElementText().toDouble();
                    } else if (name2 == "accel_2") {
                        state->accel[2] = stream.readElementText().toDouble();
                    } else if (name2 == "gyro_0") {
                        state->gyro[0] = stream.readElementText().toDouble();
                    } else if (name2 == "gyro_1") {
                        state->gyro[1] = stream.readElementText().toDouble();
                    } else if (name2 == "gyro_2") {
                        state->gyro[2] = stream.readElementText().toDouble();
                    } else if (name2 == "mag_0") {
                        state->mag[0] = stream.readElementText().toDouble();
                    } else if (name2 == "mag_1") {
                        state->mag[1] = stream.readElementText().toDouble();
                    } else if (name2 == "mag_2") {
                        state->mag[2] = stream.readElementText().toDouble();
                    } else if (name2 == "px") {
                        state->px = stream.readElementText().toDouble();
                    } else if (name2 == "py") {
                        state->py = stream.readElementText().toDouble();
                    } else if (name2 == "speed") {
                        state->speed = stream.readElementText().toDouble();
                    } else if (name2 == "vin") {
                        state->vin = stream.readElementText().toDouble();
                    } else if (name2 == "temp_fet") {
                        state->temp_fet = stream.readElementText().toDouble();
                    } else if (name2 == "mc_fault") {
                        state->mc_fault = (mc_fault_code)stream.readElementText().toInt();
                    } else if (name2 == "px_gps") {
                        state->px_gps = stream.readElementText().toDouble();
                    } else if (name2 == "py_gps") {
                        state->py_gps = stream.readElementText().toDouble();
                    } else if (name2 == "ap_goal_px") {
                        state->ap_goal_px = stream.readElementText().toDouble();
                    } else if (name2 == "ap_goal_py") {
                        state->ap_goal_py = stream.readElementText().toDouble();
                    } else if (name2 == "ap_rad") {
                        state->ap_rad = stream.readElementText().toDouble();
                    } else if (name2 == "ms_today") {
                        state->ms_today = stream.readElementText().toInt();
                    } else if (name2 == "ap_route_left") {
                        state->ap_route_left = stream.readElementText().toInt();
                    } else if (name2 == "px_uwb") {
                        state->px_uwb = stream.readElementText().toDouble();
                    } else if (name2 == "py_uwb") {
                        state->py_uwb = stream.readElementText().toDouble();
                    } else {
                        qWarning() << "libRControlStation: argument not found:" << name2;
                        stream.skipCurrentElement();
                        ok = false;
                    }
                }

                if (stream.hasError()) {
                    break;
                }

                if (!ok) {
                    continue;
                }
            } else {
                qWarning() << "libRControlStation: Command not found: " << name;
                stream.skipCurrentElement();
            }
        }

        if (stream.hasError()) {
            qWarning() << "libRControlStation: XML Parse error:" << stream.errorString();
        }
    } else {
        ret = false;
        qWarning() << "libRControlStation: No response";
    }

    return ret;
}