コード例 #1
0
ファイル: server.c プロジェクト: legatoproject/legato-af
void filePasser_PassFd(int fileDescriptor)
{
    LE_INFO("Received the file descriptor from the client.");
    LE_INFO("Reading the file to see what it said.");

    char buf[1000] = "";

    LE_ASSERT(read(fileDescriptor, buf, sizeof(buf)) > 0);

    LE_INFO("Text in file: '%s'", buf);

    LE_FATAL_IF(strstr(FILE_MSG, buf) != 0,
                "Text in file should be '%s' but was '%s'", FILE_MSG, buf);

    LE_INFO("File descriptor was passed correctly.");

    close(fileDescriptor);
}
コード例 #2
0
ファイル: pa_rtc_simu.c プロジェクト: H-H-bin/legato-af
le_result_t pa_rtc_Init
(
    void
)
{
    LE_INFO("simulation pa_rtc init - stub");

    return LE_OK;
}
コード例 #3
0
ファイル: avData.c プロジェクト: legatoproject/legato-af
//--------------------------------------------------------------------------------------------------
static void SessionReleaseTimerHandler
(
    le_timer_Ref_t timerRef    ///< This timer has expired
)
{
    LE_INFO("SessionRelease timer expired; close session");

    avcServer_ReleaseSession();
}
コード例 #4
0
static void timerExpiredHandler(le_timer_Ref_t  timerRef)
{
	sig_appTermination_cbh(0);

	LE_INFO("Legato AssetData: Legato AssetDataApp Ended");

	//Quit the app
	exit(EXIT_SUCCESS);
}
コード例 #5
0
ファイル: dataAppMain.c プロジェクト: ekral85/legato-af
//--------------------------------------------------------------------------------------------------
static void Field_executeCommandTwo_Handler
(
    le_avdata_AssetInstanceRef_t instRef,
    const char* fieldName,
    void* contextPtr
)
{
    LE_INFO("Registered handler called for %s", fieldName);
}
コード例 #6
0
ファイル: MutexFlux.c プロジェクト: mbaglin/legato-af
// Delete from 1 to n-1 for all threads
static void DelMutex1toNMinus1PerThread
(
    void* param1,
    void* param2
)
{
    LE_INFO("DelMutex1toNMinus1PerThread in thread [%s]", le_thread_GetMyName());
    DelMutexes(0, 1);
}
コード例 #7
0
ファイル: lwm2m.c プロジェクト: H-H-bin/legato-af
//--------------------------------------------------------------------------------------------------
static void RegUpdateTimerHandler
(
    le_timer_Ref_t timerRef    ///< This timer has expired
)
{
    LE_INFO("RegUpdate timer expired; reporting REG_UPDATE");

    lwm2m_RegistrationUpdate();
}
コード例 #8
0
ファイル: main.c プロジェクト: ekral85/legato-af
//--------------------------------------------------------------------------------------------------
static void Testle_ips_GetInputVoltage
(
    void
)
{
    uint32_t voltage = 0;
    LE_INFO("========  Testle_ips_GetInputVoltage Test ========");
    LE_ASSERT(le_ips_GetInputVoltage(&voltage) == LE_OK);
}
コード例 #9
0
ファイル: simTest.c プロジェクト: legatoproject/legato-af
//--------------------------------------------------------------------------------------------------
void simTest_SimSelect
(
)
{
    // Select the embedded SIM
    LE_ASSERT_OK(le_sim_SelectCard(LE_SIM_EMBEDDED));

    // Get the selected card
    le_sim_Id_t simId = le_sim_GetSelectedCard();
    LE_ASSERT(LE_SIM_EMBEDDED == simId);

    // Select the LE_SIM_EXTERNAL_SLOT_1 SIM
    LE_ASSERT_OK(le_sim_SelectCard(LE_SIM_EXTERNAL_SLOT_1));

    // Get the selected card
    simId = le_sim_GetSelectedCard();
    LE_ASSERT(LE_SIM_EXTERNAL_SLOT_1 == simId);

    // Check if SIM present
    if (!le_sim_IsPresent(LE_SIM_EMBEDDED))
    {
        LE_INFO("SIM not present");
    }

    // Get the selected card by le_sim_GetSelectedCard()
    // Notice that the selected card received is the one used by the
    // last Legato API and not the one set by le_sim_SelectCard().
    simId = le_sim_GetSelectedCard();
    LE_ASSERT(LE_SIM_EMBEDDED == simId);

    // Check SIM ready
    if (!le_sim_IsReady(LE_SIM_EXTERNAL_SLOT_1))
    {
        LE_INFO("SIM not ready");
    }

    // Get the selected card by le_sim_GetSelectedCard()
    // Notice that the selected card received is the one used by the
    // last Legato API and not the one set by le_sim_SelectCard().
    simId = le_sim_GetSelectedCard();
    LE_ASSERT(LE_SIM_EXTERNAL_SLOT_1 == simId);


}
コード例 #10
0
ファイル: audioCallPbRecApp.c プロジェクト: H-H-bin/legato-af
//--------------------------------------------------------------------------------------------------
static void ConnectAudioToFileLocalPlay
(
    void
)
{
    le_result_t res;
    if ((AudioFileFd=open(AudioFileRecPath, O_RDWR)) == -1)
    {
        LE_ERROR("Open file %s failure: errno.%d (%s)",  AudioFileRecPath, errno, strerror(errno));
    }
    else
    {
        LE_INFO("Open file %s with AudioFileFd.%d",  AudioFileRecPath, AudioFileFd);
    }

    // Play local on output connector.
    FileAudioRef = le_audio_OpenPlayer();
    LE_ERROR_IF((FileAudioRef==NULL), "OpenFilePlayback returns NULL!");

    MediaHandlerRef = le_audio_AddMediaHandler(FileAudioRef, MyMediaEventHandler, NULL);
    LE_ERROR_IF((MediaHandlerRef==NULL), "AddMediaHandler returns NULL!");

    if (FileAudioRef && AudioOutputConnectorRef)
    {
        res = le_audio_Connect(AudioOutputConnectorRef, FileAudioRef);
        if(res!=LE_OK)
        {
            LE_ERROR("Failed to connect FilePlayback on output connector!");
            return;
        }

        LE_INFO("FilePlayback is now connected.");
        res = le_audio_PlayFile(FileAudioRef, AudioFileFd);

        if(res != LE_OK)
        {
            LE_ERROR("Failed to play the file!");
        }
        else
        {
            LE_INFO("File is now playing");
        }
    }
}
コード例 #11
0
ファイル: tempTest.c プロジェクト: mbarazzouq/legato-af
//--------------------------------------------------------------------------------------------------
static void Testle_temp_SetGetRadioThresholds
(
)
{
    int32_t oldWarningTemp = 0;
    int32_t oldCriticalTemp = 0;
    int32_t warningTemp = 0;
    int32_t criticalTemp = 0;
    int32_t refwarningTemp = 0;
    int32_t refcriticalTemp = 0;
    le_result_t res = LE_FAULT;

    res = le_temp_GetRadioThresholds(&oldWarningTemp, &oldCriticalTemp);
    LE_ASSERT(res == LE_OK);
    LE_INFO("le_temp_GetRadioThresholds(%d, %d)", oldWarningTemp, oldCriticalTemp);

    refwarningTemp = oldWarningTemp - 30;
    refcriticalTemp = oldCriticalTemp - 20;

    res = le_temp_SetRadioThresholds(refwarningTemp, refcriticalTemp);
    LE_ASSERT(res == LE_OK);
    LE_INFO("le_temp_SetThreshold(%d, %d)", refwarningTemp, refcriticalTemp);

    res = le_temp_GetRadioThresholds(&warningTemp, &criticalTemp);
    LE_ASSERT(res == LE_OK);
    LE_INFO("le_temp_GetThreshold(%d, %d)", warningTemp, criticalTemp);
    LE_ASSERT(warningTemp == refwarningTemp);
    LE_ASSERT(criticalTemp == refcriticalTemp);

    // Test with critical threshold equal to the warning temperature.
    res = le_temp_SetRadioThresholds(warningTemp, warningTemp);
    LE_INFO("le_temp_SetThreshold(%d, %d)", warningTemp, warningTemp);
    LE_ASSERT(res == LE_BAD_PARAMETER);

    refwarningTemp = oldWarningTemp;
    refcriticalTemp = oldWarningTemp - 10;

    // Test with critical threshold temperature lesser than the warning temperature.
    res = le_temp_SetRadioThresholds(refwarningTemp, refcriticalTemp);
    LE_INFO("le_temp_SetThreshold(%d, %d)", refwarningTemp, refcriticalTemp);
    LE_ASSERT(res == LE_BAD_PARAMETER);

    LE_INFO("Restore Initial thresold values warning=%d, critical=%d",
        oldWarningTemp, oldCriticalTemp);

    res = le_temp_SetRadioThresholds(oldWarningTemp, oldCriticalTemp);
    LE_INFO("le_temp_SetThreshold(%d, %d)", oldWarningTemp, oldCriticalTemp);
    LE_ASSERT(res == LE_OK);
    res = le_temp_GetRadioThresholds(&warningTemp, &criticalTemp);
    LE_ASSERT(res == LE_OK);
    LE_INFO("le_temp_GetThreshold(%d, %d)", warningTemp, criticalTemp);
    LE_ASSERT(warningTemp == oldWarningTemp);
    LE_ASSERT(criticalTemp == oldCriticalTemp);
}
コード例 #12
0
ファイル: le_media.c プロジェクト: mbaglin/legato-af
//--------------------------------------------------------------------------------------------------
le_result_t le_media_PlayDtmf
(
    le_audio_Stream_t*   streamPtr, ///< [IN] Stream object
    const char*          dtmfPtr,   ///< [IN] The DTMFs to play.
    uint32_t             duration,  ///< [IN] The DTMF duration in milliseconds.
    uint32_t             pause      ///< [IN] The pause duration between tones in milliseconds.
)
{
    le_result_t       res;
    DtmfThreadCtx_t*  threadCtxPtr = le_mem_ForceAlloc(DtmfThreadContextPool);

    memset(threadCtxPtr, 0, sizeof(DtmfThreadCtx_t));

    streamPtr->samplePcmConfig.sampleRate = 16000;
    streamPtr->samplePcmConfig.bitsPerSample = 16;
    streamPtr->samplePcmConfig.channelsCount = 1;
    streamPtr->samplePcmConfig.fileSize = -1;
    streamPtr->samplePcmConfig.pcmFormat = PCM_RAW;

    threadCtxPtr->duration = duration;
    threadCtxPtr->pause = pause;
    threadCtxPtr->sampleRate = 16000;
    threadCtxPtr->dtmfPtr = dtmfPtr;
    if (pipe(threadCtxPtr->pipefd) == -1)
    {
        LE_ERROR("Failed to create the pipe");
        le_mem_Release(threadCtxPtr);
        return LE_FAULT;
    }

    streamPtr->fd = threadCtxPtr->pipefd[0];

    if ((res=pa_audio_PlaySamples(streamPtr->audioInterface,
                                  streamPtr->fd,
                                  &streamPtr->samplePcmConfig)) == LE_OK)
    {
        LE_INFO("Spawn DTMF thread");
        if (DtmfTreadRef == NULL)
        {
            DtmfTreadRef = le_thread_Create("PlayDtmfs", PlayDtmfThread, threadCtxPtr);

            le_thread_AddChildDestructor(DtmfTreadRef,
                                        DestroyPlayDtmfThread,
                                        threadCtxPtr);

            le_thread_Start(DtmfTreadRef);
        }
    }
    else
    {
        le_mem_Release(threadCtxPtr);
        LE_ERROR("Cannot spawn DTMF thread!");
    }

    return res;
}
コード例 #13
0
ファイル: simToolkitTest.c プロジェクト: tegoo/legato-af
//--------------------------------------------------------------------------------------------------
static void SigHandler
(
    int sigNum
)
{
    le_sim_RemoveSimToolkitEventHandler(HandlerRef);

    LE_INFO("EXIT SIM Toolkit Test");
    exit(EXIT_SUCCESS);
}
コード例 #14
0
ファイル: mqttClient.c プロジェクト: CoRfr/mangOH-MqttClient
static void mqttClient_dataConnectionStateHandler(const char* intfName, bool isConnected, void* contextPtr)
{
  mqttClient_t* clientData = (mqttClient_t*)contextPtr;
  int32_t rc = LE_OK;

  LE_ASSERT(clientData);

  LE_DEBUG("interface('%s') connected(%u)", intfName, isConnected);
  if (isConnected)
  {
    if ((clientData->session.sock == MQTT_CLIENT_INVALID_SOCKET) && !clientData->session.isConnected)
    {
      LE_INFO("starting session");           
      rc = mqttClient_startSession(clientData);
      if (rc)
      {        
        LE_ERROR("mqttClient_startSession() failed(%d)", rc);
        goto cleanup;
      }
    }
    else
    {
        LE_INFO("No ongoing MQTT Connection request");
    }
  }
  else
  {
    LE_INFO("disconnected('%s')", intfName);
    mqttClient_disconnectData(clientData);
  }

cleanup:
  if (rc)
  {
    int32_t err = mqttClient_disconnectData(clientData);
    if (err)
    {        
      LE_ERROR("mqttClient_disconnectData() failed(%d)", err);
    }
  }

  return;
}
コード例 #15
0
ファイル: le_ecallTest.c プロジェクト: ekral85/legato-af
//--------------------------------------------------------------------------------------------------
static void SigHandler
(
    int sigNum
)
{
    LE_INFO("End and delete last test eCall");
    le_ecall_End(LastTestECallRef);
    le_ecall_Delete(LastTestECallRef);
    exit(EXIT_SUCCESS);
}
コード例 #16
0
ファイル: simTest.c プロジェクト: legatoproject/legato-af
//--------------------------------------------------------------------------------------------------
static void PrintApdu
(
    uint8_t* rsp,
    uint32_t rspLen
)
{
    LE_INFO("rspLen %d" , rspLen);
    char string[5*rspLen+1];
    uint32_t i = 0;
    memset(string,0,5*rspLen+1);

    while (i < rspLen)
    {
        sprintf(string+strlen(string),"0x%02X ", rsp[i] );
        i++;
    }

    LE_INFO("APDU response: %s", string );
}
コード例 #17
0
ファイル: dataAppMain.c プロジェクト: ekral85/legato-af
//--------------------------------------------------------------------------------------------------
static void Field_variableFloatOne_Handler
(
    le_avdata_AssetInstanceRef_t instRef,
    const char* fieldName,
    void* contextPtr
)
{
    LE_INFO("Registered handler called for %s", fieldName);
    le_avdata_SetFloat(instRef, "variableFloatOne", 532.212);
}
コード例 #18
0
ファイル: main.c プロジェクト: legatoproject/legato-af
//--------------------------------------------------------------------------------------------------
static void SimRefreshHandler
(
    le_sim_Id_t simId,
    le_sim_StkEvent_t stkEvent,
    void* contextPtr
)
{
    LE_INFO("SIM refresh performed");
    le_sem_Post(SimRefreshSemaphore);
}
コード例 #19
0
static void AVsessionHandler
(
	le_avc_Status_t     updateStatus,
	int32_t             totalNumBytes,
	int32_t             progress,
	void*               contextPtr
)
{
	LE_INFO("AVsessionHandler-callback: status %i", updateStatus);
}
コード例 #20
0
ファイル: clientMain.c プロジェクト: hakanernam/legato-af
//--------------------------------------------------------------------------------------------------
__attribute__((constructor)) static void InitClient
(
    void
)
{
    le_pos_StartClient("posDaemon.le_pos");
    le_pos_sample_StartClient("posDaemon.le_pos_sample");

    LE_INFO("Positioning Daemon Client is ready.");
}
コード例 #21
0
ファイル: voicePromptMcc2.c プロジェクト: tegoo/legato-af
//--------------------------------------------------------------------------------------------------
static void StopFilePlayback
(
    void
)
{
    LE_INFO("Stop file playback on fd.%d", AudioFileFd);
    LE_FATAL_IF((le_audio_Stop(PlayerRef) != LE_OK), "Cannot stop file");

    close(AudioFileFd);
}
コード例 #22
0
ファイル: le_pm.c プロジェクト: tegoo/legato-af
//--------------------------------------------------------------------------------------------------
static void OnClientDisconnect
(
    le_msg_SessionRef_t sessionRef,
    void *contextPtr
)
{
    Client_t *c;
    WakeupSource_t *ws;
    le_hashmap_It_Ref_t iter;

    // Find and remove client record from table
    c = to_Client_t(le_hashmap_Remove(PowerManager.clients, sessionRef));
    LE_INFO("Client pid %d disconnected.", c->pid);

    // Find and remove all wakeup sources held for this client
    iter = le_hashmap_GetIterator(PowerManager.locks);
    while (LE_OK == le_hashmap_NextNode(iter)) {
        ws = (WakeupSource_t*)le_hashmap_GetValue(iter);
        if (ws->pid != c->pid)
            // Does not belong to this client, skip
            continue;

        // Release wakeup source if taken
        if (ws->taken) {
            LE_WARN("Releasing wakeup source '%s' on behalf of pid %d.",
                    ws->name, ws->pid);
            le_pm_Relax((le_pm_WakeupSourceRef_t)ws->wsref);
        }

        // Delete wakeup source record, free memory
        LE_INFO("Deleting wakeup source '%s' on behalf of pid %d.",
                ws->name, ws->pid);
        le_hashmap_Remove(PowerManager.locks, ws->name);
        le_ref_DeleteRef(PowerManager.refs, ws->wsref);
        le_mem_Release(ws);
    }

    // Free client record
    le_mem_Release(c);

    return;
}
コード例 #23
0
ファイル: ctrlAppMain.c プロジェクト: tegoo/legato-af
//--------------------------------------------------------------------------------------------------
static void SimpleDownloadAndInstall
(
    le_avc_Status_t updateStatus
)
{
    le_avc_UpdateType_t updateType;

    switch ( updateStatus )
    {
        case LE_AVC_NO_UPDATE:
            LE_WARN("No action");
            break;

        case LE_AVC_DOWNLOAD_PENDING:
            if ( le_avc_GetUpdateType(&updateType) == LE_OK )
            {
                LE_INFO("Update type is %i", updateType);
            }
            else
            {
                LE_INFO("Update type is not available");
            }

            LE_WARN("Accept download");
            LE_ASSERT( le_avc_AcceptDownload() == LE_OK );
            break;

        case LE_AVC_INSTALL_PENDING:
            LE_WARN("Accept install");
            LE_ASSERT( le_avc_AcceptInstall() == LE_OK );
            break;

        case LE_AVC_UNINSTALL_PENDING:
            LE_WARN("Accept uninstall");
            LE_ASSERT( le_avc_AcceptUninstall() == LE_OK );
            break;

        default:
            LE_WARN("Update status %i not handled", updateStatus);
    }

}
コード例 #24
0
ファイル: audioCallPbRecApp.c プロジェクト: H-H-bin/legato-af
//--------------------------------------------------------------------------------------------------
static void SigHandler
(
    int sigNum
)
{
    LE_INFO("End audioCallPbRecApp test");
    DisconnectAllAudio();
    le_mcc_HangUpAll();

    exit(EXIT_SUCCESS);
}
コード例 #25
0
ファイル: httpGet.c プロジェクト: ekral85/legato-af
static void ConnectionStateHandler
(
    const char *intfName,
    bool isConnected,
    void *contextPtr
)
{
    if (isConnected)
    {
        WaitingForConnection = false;
        LE_INFO("Interface %s connected.", intfName);
        GetUrl();
        le_data_Release(ConnectionRef);
    }
    else
    {
        LE_INFO("Interface %s disconnected.", intfName);
    }

}
コード例 #26
0
ファイル: clientMain.c プロジェクト: H-H-bin/legato-af
void banner(char *testName)
{
    int i;
    char banner[41];

    for (i=0; i<sizeof(banner)-1; i++)
        banner[i]='=';
    banner[sizeof(banner)-1] = '\0';

    LE_INFO("\n%s %s %s", banner, testName, banner);
}
コード例 #27
0
//--------------------------------------------------------------------------------------------------
void UnsolicitedResponseHandler
(
    const char* unsolicitedRsp,
    void* contextPtr
)
{
    LE_INFO("Unsolicited received: %s", unsolicitedRsp);

    if (strncmp(unsolicitedRsp, "+COPS:", 6) == 0)
    {
        LE_INFO("Please send a sms to the module");

    }
    else if (strncmp(unsolicitedRsp, "+CMTI:", 6) == 0)
    {
        le_atClient_RemoveUnsolicitedResponseHandler(UnsolCmtiRef);
        LE_INFO("Please send again a sms to the module");
        LE_INFO("No indication should be displayed this time");
    }
}
コード例 #28
0
ファイル: forkJoinMutex.c プロジェクト: H-H-bin/legato-af
// -------------------------------------------------------------------------------------------------
static void IncrementCounter(void)
// -------------------------------------------------------------------------------------------------
{
    Lock();

    Counter++;

    LE_INFO("Thread '%s' incremented counter to %zu.", le_thread_GetMyName(), Counter);

    Unlock();
}
コード例 #29
0
ファイル: client.c プロジェクト: legatoproject/legato-af
//--------------------------------------------------------------------------------------------------
static void RxNewData
(
    int fd,      ///< [IN] File descriptor to read on
    short events ///< [IN] Event reported on fd
)
{
    char buffer[READ_BYTES];
    ssize_t count;

    SharedData_t* sharedDataPtr = le_fdMonitor_GetContextPtr();
    le_sem_Post(sharedDataPtr->semRef);

    memset(buffer, 0, sizeof(buffer));

    if (events & (POLLIN | POLLPRI))
    {
        count = read(fd, buffer, READ_BYTES);
        if (count == -1)
        {
            LE_ERROR("read error: %s", strerror(errno));
            return;
        }
        else if (count > 0)
        {
            if (strcmp(buffer, "AT+CREG?\r") == 0)
            {
                LE_INFO("Received AT command: %s", buffer);
                // Send the response of AT command
                write(fd, "\r\n\r\n+CREG: 0,1\r\n\r\n\r\nOK\r\n", 24);
                return;
            }
            else if (strcmp(buffer, "AT+CGSN\r") == 0)
            {
                LE_INFO("Received AT command: %s", buffer);
                // Send the response of AT command
                write(fd, "\r\n359377060033064\r\n\r\nOK\r\n", 25);
                return;
            }
        }
    }
}
コード例 #30
0
//--------------------------------------------------------------------------------------------------
le_result_t pa_ipsSimu_Init
(
    void
)
{
    // Create the event for signaling user handlers.
    VoltageThresholdEventId = le_event_CreateIdWithRefCounting("VoltageStatusEvent");

    LE_INFO("simulation pa_ips init - stub");

    return LE_OK;
}