Improve:wifi hal.

This commit is contained in:
Fancy code 2024-06-14 13:42:16 +08:00
parent af6f25397f
commit a20ed62c08
3 changed files with 26 additions and 2 deletions

View File

@ -59,6 +59,20 @@ void CameraHal::GetAudioStream(const void *stream, const unsigned int &length)
if (mTaskRuning && nullptr != mAudioStreamCallback) {
mAudioStreamCallback(stream, length);
}
// if (mTaskRuning) {
// LogInfo("GetAudioStream length33:%d\n", length);
// FILE *file = nullptr;
// file = fopen("/tmp/audio.bin", "a+");
// if (file) {
// fwrite(stream, 1, length, file);
// fflush(file);
// }
// if (file) {
// fclose(file);
// }
// }
}
void CameraHal::GetVideoStream(const void *stream, const unsigned int &length)
{

View File

@ -29,12 +29,22 @@ StatusCode WifiHal::OpenApMode(void)
constexpr int SLEEP_TIME_MS = 5;
constexpr int WAITING_TIME_MS = 1000 * 10;
unsigned int sleepingTime_ms = 0;
unsigned int resetWifiPowerCount = 0;
mInitRunning = true;
while (CheckWlan0IfExist() == false) {
std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_MS));
sleepingTime_ms += SLEEP_TIME_MS;
if (sleepingTime_ms > WAITING_TIME_MS) {
LogError("wlan0 not found. \n");
if (0 == resetWifiPowerCount) {
LogWarning("wlan0 not found, try to reset. \n");
PowerOff();
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
PowerOn();
sleepingTime_ms = 0;
resetWifiPowerCount++;
continue;
}
LogError("wlan0 not found, reset wifi power count: %d. \n", resetWifiPowerCount);
return CreateStatusCode(STATUS_CODE_NOT_OK);
}
if (false == mInitRunning) {

View File

@ -423,8 +423,8 @@ void SixFrameHandle::ResponseGetParamItems(cJSON *result, const AppGetCapability
cJSON_AddItemToObject(mic, CJSON_INDEX_STRING, index);
cJSON_AddItemToArray(items, cJSON_CreateString("on"));
cJSON_AddItemToArray(items, cJSON_CreateString("off"));
cJSON_AddItemToArray(index, cJSON_CreateNumber(0));
cJSON_AddItemToArray(index, cJSON_CreateNumber(1));
cJSON_AddItemToArray(index, cJSON_CreateNumber(0));
}
}
// {