mirror of
				https://gitee.com/jiuyilian/embedded-framework.git
				synced 2025-10-24 18:20:15 -04:00 
			
		
		
		
	Improve:wifi hal.
This commit is contained in:
		
							parent
							
								
									af6f25397f
								
							
						
					
					
						commit
						a20ed62c08
					
				| 
						 | 
				
			
			@ -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)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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));
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        // {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user