当前位置: 首页>>代码示例>>C++>>正文


C++ AJ_StatusText函数代码示例

本文整理汇总了C++中AJ_StatusText函数的典型用法代码示例。如果您正苦于以下问题:C++ AJ_StatusText函数的具体用法?C++ AJ_StatusText怎么用?C++ AJ_StatusText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了AJ_StatusText函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AnonymousAuthAdvance

/**
 * Since the routing node expects any of its clients to use SASL with Anonymous
 * or PINX in order to connect, this method will send the necessary SASL
 * Anonymous exchange in order to connect.  PINX is no longer supported on the
 * Thin Client.  All thin clients will connect as untrusted clients to the
 * routing node.
 */
static AJ_Status AnonymousAuthAdvance(AJ_IOBuffer* rxBuf, AJ_IOBuffer* txBuf)
{
    AJ_Status status = AJ_OK;
    AJ_GUID localGuid;
    char buf[40];

    /* initiate the SASL exchange with AUTH ANONYMOUS */
    status = WriteLine(txBuf, "AUTH ANONYMOUS\n");
    ResetRead(rxBuf);

    if (status == AJ_OK) {
        /* expect server to send back OK GUID */
        status = ReadLine(rxBuf);
        if (status == AJ_OK) {
            if (memcmp(rxBuf->readPtr, "OK", 2) != 0) {
                return AJ_ERR_ACCESS_ROUTING_NODE;
            }
        }
    }

    if (status == AJ_OK) {
        status = WriteLine(txBuf, "INFORM_PROTO_VERSION 10\n");
        ResetRead(rxBuf);
    }

    if (status == AJ_OK) {
        /* expect server to send back INFORM_PROTO_VERSION version# */
        status = ReadLine(rxBuf);
    }

    if (status == AJ_OK) {
        if (memcmp(rxBuf->readPtr, "INFORM_PROTO_VERSION", strlen("INFORM_PROTO_VERSION")) != 0) {
            status = AJ_ERR_ACCESS_ROUTING_NODE;
        }
    }

    if (status == AJ_OK) {
        routingProtoVersion = atoi((const char*)(rxBuf->readPtr + strlen("INFORM_PROTO_VERSION") + 1));
        if (routingProtoVersion < AJ_GetMinProtoVersion()) {
            AJ_InfoPrintf(("AnonymousAuthAdvance():: Found version %u but minimum %u required", routingProtoVersion, AJ_GetMinProtoVersion()));
            status = AJ_ERR_OLD_VERSION;
        }
    }

    if (status == AJ_OK) {
        /* send BEGIN LocalGUID to server */
        AJ_GetLocalGUID(&localGuid);
        strcpy(buf, "BEGIN ");
        status = AJ_GUID_ToString(&localGuid, buf + strlen(buf), 33);
        strcat(buf, "\n");
        status = WriteLine(txBuf, buf);
        ResetRead(rxBuf);
    }

    if (status != AJ_OK) {
        AJ_ErrPrintf(("AnonymousAuthAdvance(): status=%s\n", AJ_StatusText(status)));
    }

    return status;
}
开发者ID:gwgoliath,项目名称:learnalljoyn,代码行数:67,代码来源:aj_connect.c

示例2: SendEvent

static AJ_Status SendEvent(AJ_BusAttachment* busAttachment, uint32_t eventId)
{
    AJ_Status status = AJ_OK;
    AJ_Message msg;

    status = AJ_MarshalSignal(busAttachment, &msg, eventId, NULL, 0, AJ_FLAG_SESSIONLESS, 0);
    if (status != AJ_OK) {
        goto ErrorExit;
    }
    status = AJ_DeliverMsg(&msg);
    if (status != AJ_OK) {
        goto ErrorExit;
    }
    status = AJ_CloseMsg(&msg);
    if (status != AJ_OK) {
        goto ErrorExit;
    }
    AJ_AlwaysPrintf(("Event sent successfully\n"));
    return status;

ErrorExit:

    AJ_AlwaysPrintf(("Event sending failed with status=%s\n", AJ_StatusText(status)));
    return status;
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:25,代码来源:EventsAndActionsSample.c

示例3: NativePWM

static int NativePWM(duk_context* ctx)
{
    AJ_Status status;
    double dutyCycle = duk_require_number(ctx, 0);
    uint32_t freq = 0;

    if (dutyCycle > 1.0 || dutyCycle < 0.0) {
        duk_error(ctx, DUK_ERR_RANGE_ERROR, "Duty cycle must be in the range 0.0 to 1.0");
    }
    /*
     * Frequency is optional. If not specified zero is passed into the target code and the default
     * target PWM frequency is used.
     */
    if (!duk_is_undefined(ctx, 1)) {
        freq = duk_require_int(ctx, 1);
        if (freq == 0) {
            duk_error(ctx, DUK_ERR_RANGE_ERROR, "Frequency cannot be zero Hz");
        }
    }
    status = AJS_TargetIO_PinPWM(PinCtxPtr(ctx), dutyCycle, freq);
    if (status != AJ_OK) {
        if (status == AJ_ERR_RESOURCES) {
            duk_error(ctx, DUK_ERR_RANGE_ERROR, "Too many PWM pins");
        } else {
            duk_error(ctx, DUK_ERR_INTERNAL_ERROR, "Error setting PWM %s", AJ_StatusText(status));
        }
    }
    return 0;
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:29,代码来源:ajs_io.c

示例4: NativeI2cTransfer

static int NativeI2cTransfer(duk_context* ctx)
{
    AJ_Status status;
    uint8_t addr = duk_require_int(ctx, 0);
    uint8_t* txBuf = NULL;
    uint8_t* rxBuf = NULL;
    duk_size_t txLen = 0;
    duk_size_t rxLen = 0;
    uint8_t rxBytes = 0;

    if (duk_is_undefined(ctx, 2)) {
        duk_push_undefined(ctx);
    } else {
        rxLen = duk_require_uint(ctx, 2);
        rxBuf = duk_push_dynamic_buffer(ctx, rxLen);
    }
    if (duk_is_null(ctx, 1)) {
        duk_push_undefined(ctx);
    } else {
        txBuf = SerializeToBuffer(ctx, 1, &txLen);
    }
    status = AJS_TargetIO_I2cTransfer(PinCtxPtr(ctx), addr, txBuf, txLen, rxBuf, rxLen, &rxBytes);
    if (status != AJ_OK) {
        duk_error(ctx, DUK_ERR_INTERNAL_ERROR, "I2C transfer failed %s\n", AJ_StatusText(status));
    }
    duk_pop(ctx);
    if (rxLen) {
        duk_resize_buffer(ctx, -1, rxBytes);
    }
    return 1;
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:31,代码来源:ajs_io.c

示例5: AJ_Net_RecvFrom

AJ_Status AJ_Net_RecvFrom(AJ_IOBuffer* buf, uint32_t len, uint32_t timeout)
{
    AJ_InfoPrintf(("AJ_Net_RecvFrom(buf=0x%p, len=%d., timeout=%d.)\n", buf, len, timeout));

    AJ_Status status = AJ_OK;
    int ret;
    uint32_t rx = AJ_IO_BUF_SPACE(buf);
    unsigned long Recv_lastCall = millis();

    AJ_InfoPrintf(("AJ_Net_RecvFrom(): len %d, rx %d, timeout %d\n", len, rx, timeout));

    rx = min(rx, len);

    while ((g_clientUDP.parsePacket() == 0) && (millis() - Recv_lastCall < timeout)) {
        delay(10); // wait for data or timeout
    }

    AJ_InfoPrintf(("AJ_Net_RecvFrom(): millis %d, Last_call %d, timeout %d, Avail %d\n", millis(), Recv_lastCall, timeout, g_clientUDP.available()));
    ret = g_clientUDP.read(buf->writePtr, rx);
    AJ_InfoPrintf(("AJ_Net_RecvFrom(): read() returns %d, rx %d\n", ret, rx));

    if (ret == -1) {
        AJ_InfoPrintf(("AJ_Net_RecvFrom(): read() fails. status=AJ_ERR_READ\n"));
        status = AJ_ERR_READ;
    } else {
        if (ret != -1) {
            AJ_DumpBytes("AJ_Net_RecvFrom", buf->writePtr, ret);
        }
        buf->writePtr += ret;
        AJ_InfoPrintf(("AJ_Net_RecvFrom(): status=AJ_OK\n"));
        status = AJ_OK;
    }
    AJ_InfoPrintf(("AJ_Net_RecvFrom(): status=%s\n", AJ_StatusText(status)));
    return status;
}
开发者ID:durake,项目名称:core-ajtcl,代码行数:35,代码来源:aj_net.c

示例6: AJApp_ConnectedHandler

static AJ_Status AJApp_ConnectedHandler(AJ_BusAttachment* busAttachment)
{
    AJ_Status status = AJ_OK;

    if (AJ_GetUniqueName(busAttachment)) {
        if (currentServicesInitializationState == nextServicesInitializationState) {
            switch (currentServicesInitializationState) {
            case INIT_SERVICES:
                status = AJSVC_ConnectedHandler(busAttachment);
                if (status != AJ_OK) {
                    goto ErrorExit;
                }
                currentServicesInitializationState = nextServicesInitializationState = INIT_FINISHED;
                break;

            case INIT_FINISHED:
            default:
                break;
            }
        }
    }
    return status;

ErrorExit:

    AJ_ErrPrintf(("Application ConnectedHandler returned an error %s\n", (AJ_StatusText(status))));
    return status;
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:28,代码来源:NotificationConsumerSample.c

示例7: AJOBS_ControllerAPI_StartSoftAPIfNeededOrConnect

AJ_Status AJOBS_ControllerAPI_StartSoftAPIfNeededOrConnect(AJOBS_Info* obInfo)
{
    AJ_Status status = AJ_OK;

    // Check if just started
    if (bFirstStart) {
        // Check if already Onboarded or in SoftAP mode
        if (AJOBS_ControllerAPI_IsWiFiClient() || AJOBS_ControllerAPI_IsWiFiSoftAP()) {
            AJ_InfoPrintf(("CONFIGURE_WIFI_UPON_START was set\n"));
            return status;
        }
        bFirstStart = FALSE;
        if (obInfo->state == AJOBS_STATE_CONFIGURED_RETRY) {
            obInfo->state = AJOBS_STATE_CONFIGURED_VALIDATED;
        }
    }
    while (1) {
        status = AJOBS_ControllerAPI_GotoIdleWiFi(TRUE); // Go into IDLE mode, reset wifi and perfrom scan
        if (status != AJ_OK) {
            break;
        }
        // Check if require to switch into SoftAP mode.
        if ((obInfo->state == AJOBS_STATE_NOT_CONFIGURED || obInfo->state == AJOBS_STATE_CONFIGURED_ERROR || obInfo->state == AJOBS_STATE_CONFIGURED_RETRY)) {
            AJ_InfoPrintf(("Establishing SoftAP with ssid=%s%s auth=%s\n", obSettings->AJOBS_SoftAPSSID, (obSettings->AJOBS_SoftAPIsHidden ? " (hidden)" : ""), obSettings->AJOBS_SoftAPPassphrase == NULL ? "OPEN" : obSettings->AJOBS_SoftAPPassphrase));
            if (obInfo->state == AJOBS_STATE_CONFIGURED_RETRY) {
                AJ_InfoPrintf(("Retry timer activated\n"));
                status = AJ_EnableSoftAP(obSettings->AJOBS_SoftAPSSID, obSettings->AJOBS_SoftAPIsHidden, obSettings->AJOBS_SoftAPPassphrase, obSettings->AJOBS_WAIT_BETWEEN_RETRIES);
            } else {
                status = AJ_EnableSoftAP(obSettings->AJOBS_SoftAPSSID, obSettings->AJOBS_SoftAPIsHidden, obSettings->AJOBS_SoftAPPassphrase, obSettings->AJOBS_WAIT_FOR_SOFTAP_CONNECTION);
            }
            if (status != AJ_OK) {
                if (AJ_ERR_TIMEOUT == status) {
                    //check for timer elapsed for retry
                    if (obInfo->state == AJOBS_STATE_CONFIGURED_RETRY) {
                        AJ_InfoPrintf(("Retry timer elapsed at %ums\n", obSettings->AJOBS_WAIT_BETWEEN_RETRIES));
                        obInfo->state = AJOBS_STATE_CONFIGURED_VALIDATED;
                        status = (*obWriteInfo)(obInfo);
                        if (status == AJ_OK) {
                            continue; // Loop back and connect in client mode
                        }
                    }
                }
                AJ_WarnPrintf(("Failed to establish SoftAP with status=%s\n", AJ_StatusText(status)));
            }
        } else { // Otherwise connect to given configuration and according to error code returned map to relevant onboarding state and set value for LastError and ConnectionResult.
            status = DoConnectWifi(obInfo);
            if (status == AJ_OK) {
                if (obInfo->state == AJOBS_STATE_CONFIGURED_ERROR || obInfo->state == AJOBS_STATE_CONFIGURED_RETRY) {
                    continue; // Loop back and establish SoftAP mode
                }
            } else {
                AJ_WarnPrintf(("Failed to establish connection with current configuration status=%s\n", AJ_StatusText(status)));
            }
        }
        break; // Either connected to (as client) or connected from (as SoftAP) a station
    }
    return status;
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:58,代码来源:OnboardingManager.c

示例8: AJApp_ConnectedHandler

static AJ_Status AJApp_ConnectedHandler(AJ_BusAttachment* busAttachment)
{
    AJ_Status status = AJ_OK;

    if (AJ_GetUniqueName(busAttachment)) {
        if (currentServicesInitializationState == nextServicesInitializationState) {
            switch (currentServicesInitializationState) {
            case INIT_SERVICES:
                status = AJSVC_ConnectedHandler(busAttachment);
                if (status != AJ_OK) {
                    goto ErrorExit;
                }
                currentServicesInitializationState = nextServicesInitializationState = INIT_SERVICES_PORT;
                break;

            case INIT_SERVICES_PORT:
                status = AJ_BusBindSessionPort(busAttachment, AJ_ABOUT_SERVICE_PORT, NULL, 0);
                if (status != AJ_OK) {
                    goto ErrorExit;
                }
                nextServicesInitializationState = INIT_ADVERTISE_NAME;
                break;

            case INIT_ADVERTISE_NAME:
                status = AJ_BusAdvertiseName(busAttachment, AJ_GetUniqueName(busAttachment), AJ_TRANSPORT_ANY, AJ_BUS_START_ADVERTISING, 0);
                if (status != AJ_OK) {
                    goto ErrorExit;
                }
                currentServicesInitializationState = nextServicesInitializationState = INIT_ABOUT;
                break;

            case INIT_ABOUT:
                status = AJ_AboutInit(busAttachment, AJ_ABOUT_SERVICE_PORT);
                if (status != AJ_OK) {
                    goto ErrorExit;
                }
                currentServicesInitializationState = nextServicesInitializationState = INIT_CHECK_ANNOUNCE;
                break;

            case INIT_CHECK_ANNOUNCE:
                status = AJ_AboutAnnounce(busAttachment);
                if (status != AJ_OK) {
                    goto ErrorExit;
                }
                break;

            default:
                break;
            }
        }
    }
    return status;

ErrorExit:

    AJ_ErrPrintf(("Application ConnectedHandler returned an error %s\n", (AJ_StatusText(status))));
    return status;
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:58,代码来源:ControlleeSample.c

示例9: DismissActionCompleted

static void DismissActionCompleted(AJ_Status status, void* context)
{
    AJ_AlwaysPrintf(("DismissActionCompleted() with status=%s\n", AJ_StatusText(status)));
    if (!inputMode) {
        nextAction = CONSUMER_ACTION_NOTHING;
    }
    processingAction = FALSE;
    savedNotification.version = 0;
    return;
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:10,代码来源:SimpleNotificationConsumerSample.c

示例10: AJServices_ConnectedHandler

AJ_Status AJServices_ConnectedHandler(AJ_BusAttachment* busAttachment)
{
    AJ_BusSetPasswordCallback(busAttachment, PasswordCallback);
    /* Configure timeout for the link to the Router bus */
    AJ_SetBusLinkTimeout(busAttachment, 60);     // 60 seconds

    AJ_Status status = AJ_OK;

    status = AJ_About_ConnectedHandler(busAttachment);
    if (status != AJ_OK) {
        goto ErrorExit;
    }
#ifdef CONFIG_SERVICE

    status = AJCFG_ConnectedHandler(busAttachment);
    if (status != AJ_OK) {
        goto ErrorExit;
    }
#endif
#ifdef ONBOARDING_SERVICE

    status = AJOBS_ConnectedHandler(busAttachment);
    if (status != AJ_OK) {
        goto ErrorExit;
    }
#endif
#ifdef NOTIFICATION_SERVICE_PRODUCER

    status = AJNS_Producer_ConnectedHandler(busAttachment);
    if (status != AJ_OK) {
        goto ErrorExit;
    }
#endif
#ifdef CONTROLPANEL_SERVICE

    status = AJCPS_ConnectedHandler(busAttachment);
    if (status != AJ_OK) {
        goto ErrorExit;
    }
#endif
#ifdef NOTIFICATION_SERVICE_CONSUMER

    status = AJNS_Consumer_ConnectedHandler(busAttachment);
    if (status != AJ_OK) {
        goto ErrorExit;
    }
#endif
    return status;

ErrorExit:

    AJ_AlwaysPrintf(("Service ConnectedHandler returned an error %s\n", (AJ_StatusText(status))));
    return status;
}
开发者ID:narcijie,项目名称:alljoyn-triton,代码行数:54,代码来源:Services_Handlers.cpp

示例11: AJOBS_EstablishWiFi

AJ_Status AJOBS_EstablishWiFi()
{
    AJ_Status status;

    AJOBS_Info obInfo;
    status = (*obReadInfo)(&obInfo);
    AJ_InfoPrintf(("ReadInfo status: %s\n", AJ_StatusText(status)));

    status = AJOBS_ControllerAPI_StartSoftAPIfNeededOrConnect(&obInfo);

    return status;
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:12,代码来源:OnboardingManager.c

示例12: ReadLine

static AJ_Status ReadLine(AJ_IOBuffer* rxBuf)
{
    /*
     * All the authentication messages end in a CR/LF so read until we get a newline
     */
    AJ_Status status = AJ_OK;
    while ((AJ_IO_BUF_AVAIL(rxBuf) == 0) || (*(rxBuf->writePtr - 1) != '\n')) {
        status = rxBuf->recv(rxBuf, AJ_IO_BUF_SPACE(rxBuf), 3500);
        if (status != AJ_OK) {
            AJ_ErrPrintf(("ReadLine(): status=%s\n", AJ_StatusText(status)));
            break;
        }
    }
    return status;
}
开发者ID:gwgoliath,项目名称:learnalljoyn,代码行数:15,代码来源:aj_connect.c

示例13: AJOBS_ConnectWiFiHandler

AJ_Status AJOBS_ConnectWiFiHandler(AJ_Message* msg)
{
    AJ_Status status = AJ_OK;

    AJ_InfoPrintf(("Handling ConnectWiFi request\n"));
    AJOBS_Info obInfo;
    status = AJOBS_GetInfo(&obInfo);
    if (status != AJ_OK) {
        return status;
    }
    AJ_InfoPrintf(("ReadInfo status: %s\n", AJ_StatusText(status)));
    status = AJ_ERR_RESTART;     // Force disconnect of AJ and services and reconnection of WiFi on restart of message lopp

    return status;
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:15,代码来源:OnboardingService.c

示例14: SendGetProp

AJ_Status SendGetProp(AJ_BusAttachment* bus, uint32_t sessionId, const char* serviceName)
{
    AJ_Status status;
    AJ_Message msg;

    status = AJ_MarshalMethodCall(bus, &msg, PRX_GET_PROP, serviceName, sessionId, 0, METHOD_TIMEOUT);
    if (status == AJ_OK) {
        status = AJ_MarshalPropertyArgs(&msg, PRX_GET_INT);
    }
    if (status == AJ_OK) {
        status = AJ_DeliverMsg(&msg);
    } else {
        AJ_AlwaysPrintf(("SendGetProp %s\n", AJ_StatusText(status)));
    }
    return status;
}
开发者ID:gwgoliath,项目名称:learnalljoyn,代码行数:16,代码来源:clientlite.c

示例15: AJOBS_SwitchToRetry

void AJOBS_SwitchToRetry()
{
    AJ_Status status = AJ_OK;

    AJOBS_Info obInfo;
    status = (*obReadInfo)(&obInfo);
    if (status != AJ_OK) {
        return;
    }
    obInfo.state = AJOBS_STATE_CONFIGURED_RETRY;
    status = (*obWriteInfo)(&obInfo);
    if (status != AJ_OK) {
        return;
    }

    AJ_InfoPrintf(("SwitchToRetry status: %s\n", AJ_StatusText(status)));
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:17,代码来源:OnboardingManager.c


注:本文中的AJ_StatusText函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。