yy1717
2020-11-25 1baa8f7baa336ce7e78d4b8389a351526cb8c673
lib/src/main/cpp/master/comm_if.cpp
@@ -1988,6 +1988,21 @@
            MasterInqRoadStatus();
            break;
        }
        case ID_MS_BLUETOOTH_NAME: {
            Document doc;
            doc.Parse(value);
            if (!doc.HasParseError()) {
                if (doc.HasMember("bluetooth_name") && doc.HasMember("bluetooth_addr")) {
                    const Value& s1 = doc["bluetooth_name"];
                    const Value& s2 = doc["bluetooth_addr"];
                    SetRemoteBluetooth(s1.GetString(), s2.GetString());
                } else if (doc.HasMember("bluetooth_addr")) {
                    const Value& s = doc["bluetooth_addr"];
                    SetRemoteBluetooth(NULL, s.GetString());
                }
            }
            break;
        }
        default:break;
    }
}
@@ -2026,12 +2041,22 @@
    SendMsgToMainProcIndep(ID_SM_LIGHT_EXAM_REQ, NULL);
}
void MA_SendBlueStatus(int status)
void MA_SendBlueStatus(const char *name, const char *addr, int status)
{
    StringBuffer sb;
    Writer<StringBuffer> writer(sb);
    writer.StartObject();
    if (name != NULL) {
        writer.Key("bluetooth_name");
        writer.String(name);
    }
    if (addr != NULL) {
        writer.Key("bluetooth_addr");
        writer.String(addr);
    }
    writer.Key("bluetooth_status");
    writer.Int(status);
    writer.EndObject();