⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hf_demo_app_lib.c

📁 BlueTooth Host Software HandFree相关的lib/app/demo源码
💻 C
📖 第 1 页 / 共 2 页
字号:
                                {
                                    while (whiteSpace(*line))
                                    {
                                        (*charsConsumed)++;
                                        line++;
                                    }
                                    if (compareCharNotZero('?', &line, charsConsumed))
                                    {
                                        returnToken = CSR_BAT_HF_TOKEN;
                                    }
                                }
                            }
                        }
                    }
                    else if (compareCharNotZero('G', &line, charsConsumed))
                    {
                        while (whiteSpace(*line))
                        {
                            (*charsConsumed)++;
                            line++;
                        }
                        if (compareCharNotZero('E', &line, charsConsumed))
                        {
                            while (whiteSpace(*line))
                            {
                                (*charsConsumed)++;
                                line++;
                            }
                            if (compareCharNotZero('T', &line, charsConsumed))
                            {
                                while (whiteSpace(*line))
                                {
                                    (*charsConsumed)++;
                                    line++;
                                }
                                if (compareCharNotZero('S', &line, charsConsumed))
                                {
                                    while (whiteSpace(*line))
                                    {
                                        (*charsConsumed)++;
                                        line++;
                                    }
                                    if (compareCharNotZero('M', &line, charsConsumed))
                                    {
                                        while (whiteSpace(*line))
                                        {
                                            (*charsConsumed)++;
                                            line++;
                                        }
                                        if (compareCharNotZero('S', &line, charsConsumed))
                                        {
                                            while (whiteSpace(*line))
                                            {
                                                (*charsConsumed)++;
                                                line++;
                                            }
                                            if (compareCharNotZero(':', &line, charsConsumed))
                                            {
                                                while (whiteSpace(*line))
                                                {
                                                    (*charsConsumed)++;
                                                    line++;
                                                }
                                                returnToken = CSR_GET_SMS_HF_TOKEN;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    else if (compareCharNotZero('S', &line, charsConsumed))
                    {
                        while (whiteSpace(*line))
                        {
                            (*charsConsumed)++;
                            line++;
                        }
                        if (compareCharNotZero('F', &line, charsConsumed))
                        {
                            while (whiteSpace(*line))
                            {
                                (*charsConsumed)++;
                                line++;
                            }
                            if (compareCharNotZero(':', &line, charsConsumed))
                            {
                                while (whiteSpace(*line))
                                {
                                    (*charsConsumed)++;
                                    line++;
                                }
                                returnToken = CSR_SF_HF_TOKEN;
                            }
                        }
                        else if (compareCharNotZero('M', &line, charsConsumed))
                        {
                            while (whiteSpace(*line))
                            {
                                (*charsConsumed)++;
                                line++;
                            }
                            if (compareCharNotZero('S', &line, charsConsumed))
                            {
                                while (whiteSpace(*line))
                                {
                                    (*charsConsumed)++;
                                    line++;
                                }
                                if (compareCharNotZero(':', &line, charsConsumed))
                                {
                                    while (whiteSpace(*line))
                                    {
                                        (*charsConsumed)++;
                                        line++;
                                    }
                                    returnToken = CSR_SMS_HF_TOKEN;
                                }
                            }
                        }
                    }
                    else if (compareCharNotZero('T', &line, charsConsumed))
                    {
                        while (whiteSpace(*line))
                        {
                            (*charsConsumed)++;
                            line++;
                        }
                        if (compareCharNotZero('X', &line, charsConsumed))
                        {
                            while (whiteSpace(*line))
                            {
                                (*charsConsumed)++;
                                line++;
                            }
                            if (compareCharNotZero('T', &line, charsConsumed))
                            {
                                while (whiteSpace(*line))
                                {
                                    (*charsConsumed)++;
                                    line++;
                                }
                                if (compareCharNotZero(':', &line, charsConsumed))
                                {
                                    while (whiteSpace(*line))
                                    {
                                        (*charsConsumed)++;
                                        line++;
                                    }
                                    returnToken = CSR_TXT_HF_TOKEN;
                                }
                            }
                        }
                    }
                }
            }
        }
        else if (compareCharNotZero('B', &line, charsConsumed))
        {
            while (whiteSpace(*line))
            {
                (*charsConsumed)++;
                line++;
            }
            if (compareCharNotZero('R', &line, charsConsumed))
            {
                while (whiteSpace(*line))
                {
                    (*charsConsumed)++;
                    line++;
                }
                if (compareCharNotZero('S', &line, charsConsumed))
                {
                    while (whiteSpace(*line))
                    {
                        (*charsConsumed)++;
                        line++;
                    }
                    if (compareCharNotZero('F', &line, charsConsumed))
                    {
                        returnToken = BRSF_TOKEN;
                    }
                }

            }
        }
    }
    *nextChar2Interpret = (char *)line;
    if (returnToken == OTHER_TOKEN)
    {
        charsConsumed = 0;
    }
    return returnToken;
}

void appSendBrsf(uint16_t features)
{
    uint16_t length;
    uint8_t *body;
    char temp[50];

    length = sprintf(temp, "AT+BRSF=%d\r", features);
    body = pmalloc(length);
    memcpy(body, temp, length);
    HfAtCmdReqSend(length, body, HF_CONNECTION);
}

void appSendVgs(uint8_t gain)
{
    uint16_t length;
    uint8_t *body;
    char temp[50];

    length = sprintf(temp, "AT+VGS=%d\r", gain);
    body = pmalloc(length);
    memcpy(body, temp, length);
    HfAtCmdReqSend(length, body, HF_CONNECTION);
}

void appSendVgm(uint8_t gain)
{
    uint16_t length;
    uint8_t *body;
    char temp[50];

    length = sprintf(temp, "AT+VGM=%d\r", gain);
    body = pmalloc(length);
    memcpy(body, temp, length);
    HfAtCmdReqSend(length, body, HF_CONNECTION);
}

void appSendCindSupport(void)
{
    uint16_t length;
    uint8_t *body;
    char temp[50];

    length = sprintf(temp, "AT+CIND=?\r");
    body = pmalloc(length);
    memcpy(body, temp, length);
    HfAtCmdReqSend(length, body, HF_CONNECTION);
}

void appSendCindvalue(void)
{
    uint16_t length;
    uint8_t *body;
    char temp[50];

    length = sprintf(temp, "AT+CIND?\r");
    body = pmalloc(length);
    memcpy(body, temp, length);
    HfAtCmdReqSend(length, body, HF_CONNECTION);
}

void appSendChld(void)
{
    uint16_t length;
    uint8_t *body;
    char temp[50];

    length = sprintf(temp, "AT+CHLD=?\r");
    body = pmalloc(length);
    memcpy(body, temp, length);
    HfAtCmdReqSend(length, body, HF_CONNECTION);
}

void appSendCmerValue(char *text)
{
    uint16_t length;
    uint8_t *body;
    char        temp[50];

    length = sprintf(temp, "AT+CMER=%s\r",text);
    body = pmalloc(length);
    memcpy(body, temp, length);
    HfAtCmdReqSend(length, body, HF_CONNECTION);
}

void appSendAta(void)
{
    uint16_t length;
    uint8_t *body;
    char temp[50];

    length = sprintf(temp, "ATA\r");
    body = pmalloc(length);
    memcpy(body, temp, length);
    HfAtCmdReqSend(length, body, HF_CONNECTION);
}



void appSendError(void)
{
    uint16_t length;
    uint8_t *body;
    char temp[50];

    length = sprintf(temp, "ERROR\r");
    body = pmalloc(length);
    memcpy(body, temp, length);
    HfAtCmdReqSend(length, body, HF_CONNECTION);
}

void appSendATD(char *number)
{
    uint16_t len;
    char        *dialString;

    len = strlen(number);
    dialString = pmalloc(len + 6);
    sprintf(dialString, "ATD%s;\r", number);
    HfAtCmdReqSend((uint16_t)(len + 5), dialString, HF_CONNECTION);
}

void HfBvraReqSend(char *text)
{
    uint16_t length;
    uint8_t *body;
    char        temp[50];

    length = sprintf(temp, "AT+BVRA=%s\r",text);
    body = pmalloc(length);
    memcpy(body, temp, length);
    HfAtCmdReqSend(length, body, HF_CONNECTION);
}

void appSendDtmf(char *text)
{
    uint16_t length;
    uint8_t *body;
    char        temp[50];

    length = sprintf(temp, "AT+VTS=%s\r",text);
    body = pmalloc(length);
    memcpy(body, temp, length);
    HfAtCmdReqSend(length, body, HF_CONNECTION);
}

void appSendATBLDN(void)
{
    char        *dialString;

    dialString = pmalloc(9);
    sprintf(dialString, "AT+BLDN\r");
    HfAtCmdReqSend(8, dialString, HF_CONNECTION);
}

void appSendAtClip(bool enableClip)
{
    uint16_t length;
    uint8_t *body;
    char        temp[50];

    if (enableClip)
    {
        length = sprintf(temp, "AT+CLIP=1\r");
        body = pmalloc(length);
    }
    else
    {
        length = sprintf(temp, "AT+CLIP=0\r");
        body = pmalloc(length);
    }
    memcpy(body, temp, length);
    HfAtCmdReqSend(length, body, HF_CONNECTION);
}

void appSendAtchup(void)
{
    uint16_t length;
    uint8_t *body;
    char temp[50];

    length = sprintf(temp, "AT+CHUP\r");
    body = pmalloc(length);
    memcpy(body, temp, length);
    HfAtCmdReqSend(length, body, HF_CONNECTION);
}

void appSendATCLCC(void)
{
    uint16_t length;
    uint8_t *body;
    char temp[64];

    length = sprintf(temp, "AT+CLCC\r");
    body = pmalloc(length);
    memcpy(body, temp, length);
    HfAtCmdReqSend(length, body, HF_CONNECTION);
}

void appSendATCOPS(void)
{
    uint16_t length;
    uint8_t *body;
    char temp[64];

    length = sprintf(temp, "AT+COPS?\r");
    body = pmalloc(length);
    memcpy(body, temp, length);
    HfAtCmdReqSend(length, body, HF_CONNECTION);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -