• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ AJ_StatusText函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: OnAboutMatch

static uint8_t OnAboutMatch(uint16_t version, uint16_t port, const char* peerName, const char* objPath)
{
    AJ_Status status;

    strncpy(serviceObjPath, objPath, sizeof(serviceObjPath));
    serviceObjPath[sizeof(serviceObjPath) - 1] = 0;

    strncpy(serviceName, peerName, sizeof(serviceName));
    serviceName[sizeof(serviceName) - 1] = 0;

    status = AJ_BusJoinSession(&bus, peerName, port, NULL);
    if (status != AJ_OK) {
        AJ_ErrPrintf(("JoinSession failed %s\n", AJ_StatusText(status)));
    }

    return TRUE;
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:17,代码来源:basic_client.c


示例17: 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();

  //  printf("AJ_Net_RecvFrom(): len %d, rx %d, timeout %d\n", len, rx, timeout);
	
  //  rx = min(rx, len);

   while ((sock_rx_state==0) && (millis() - Recv_lastCall < timeout))
    {
		//printf("millis() - Recv_lastCall = %d \n", (millis() - Recv_lastCall));
		recv(rx_socket, udp_data_rx, MAIN_WIFI_M2M_BUFFER_SIZE, 0);
		m2m_wifi_handle_events(NULL);
		
   }
   ret=sock_rx_state;
  // printf("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) 
	{
        printf("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;
     //   printf("AJ_Net_RecvFrom(): status=AJ_OK\n");
        status = AJ_OK;
    }
    printf("AJ_Net_RecvFrom(): status=%s\n", AJ_StatusText(status));
    return /*sock_rx_state;*/status;
}
开发者ID:marus-ka,项目名称:alljoyn_lsf_lamp,代码行数:44,代码来源:aj_net.c


示例18: SetTriggerCallback

static int SetTriggerCallback(duk_context* ctx, int pinFunc, int debounce)
{
    AJ_Status status;
    int32_t trigId;
    AJS_IO_PinTriggerCondition condition = (AJS_IO_PinTriggerCondition)duk_require_int(ctx, 0);

    if (condition == AJS_IO_PIN_TRIGGER_DISABLE) {
        /*
         * For backwards compatibility
         */
        return ClearTriggerCallback(ctx, pinFunc, condition);
    }
    if (!duk_is_function(ctx, 1)) {
        duk_error(ctx, DUK_ERR_TYPE_ERROR, "Trigger function required");
    }
    /*
     * Enable the trigger
     */
    status = AJS_TargetIO_PinEnableTrigger(PinCtxPtr(ctx), pinFunc, condition, &trigId, debounce);
    if (status != AJ_OK) {
        duk_error(ctx, DUK_ERR_INTERNAL_ERROR, "Error %s", AJ_StatusText(status));
    }
    duk_get_global_string(ctx, AJS_IOObjectName);
    duk_get_prop_string(ctx, -1, AJS_HIDDEN_PROP("trigs"));
    /*
     * Set the callback function on the pin object
     */
    duk_push_this(ctx);
    duk_dup(ctx, 1);
    duk_put_prop_string(ctx, -2, "trigger");
    /*
     * Add the pin object to the triggers array.
     */
    duk_put_prop_index(ctx, -2, trigId);
    duk_pop_2(ctx);
    /*
     * Leave pin object on the stack
     */
    return 1;
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:40,代码来源:ajs_io.c


示例19: AJ_Main

int AJ_Main(void)
{
    AJ_Status status = AJ_ERR_INVALID;

    AJ_NVRAM_Init();

    AJ_Printf("\nAllJoyn Release: %s\n\n", AJ_GetVersion());

    /*
     * The very first thing the test application does is to follow the trail of
     * breadcrumbs, if available.
     */
    status = FollowTrailOfBreadcrumbs();
    if (AJ_OK == status) {
        AJ_Printf("PASS: Successfully read the known message from NVRAM and "
                  "it is as expected. Done with the test.\n");

        return status;
    } else {
        AJ_Printf("INFO: No old remnants of a previous test run found.\n");
    }

    /*
     * The very last thing the test application does is to create the trail of
     * breadcrumbs, to be compared upon start.
     */
    status = CreateTrailOfBreadcrumbs();
    if (AJ_OK == status) {
        AJ_Printf("INFO: Successfully wrote the known message to NVRAM.\n");

        AJ_Reboot(); /* Reboot the target, if available */
    } else {
        AJ_Printf("ERROR: CreateTrailOfBreadcrumbs failed: %s (code: %u)\n", AJ_StatusText(status), status);
    }

    AJ_Printf("INFO: Completed running the test. Exiting...\n");

    return status;
}
开发者ID:durake,项目名称:core-ajtcl,代码行数:39,代码来源:nvrampersistencetest.c


示例20: SendPing

AJ_Status SendPing(AJ_BusAttachment* bus, uint32_t sessionId, const char* serviceName, unsigned int num)
{
    AJ_Status status;
    AJ_Message msg;

    /*
     * Since the object path on the proxy object entry was not set in the proxy object table above
     * it must be set before marshalling the method call.
     */
    status = AJ_SetProxyObjectPath(ProxyObjects, PRX_MY_PING, testObj);
    if (status == AJ_OK) {
        status = AJ_MarshalMethodCall(bus, &msg, PRX_MY_PING, serviceName, sessionId, 0, METHOD_TIMEOUT);
    }
    if (status == AJ_OK) {
        status = AJ_MarshalArgs(&msg, "s", PingString);
    }
    if (status == AJ_OK) {
        status = AJ_DeliverMsg(&msg);
    } else {
        AJ_AlwaysPrintf(("SendPing %s\n", AJ_StatusText(status)));
    }
    return status;
}
开发者ID:gwgoliath,项目名称:learnalljoyn,代码行数:23,代码来源:clientlite.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AKLOGE函数代码示例发布时间:2022-05-30
下一篇:
C++ AJ_InfoPrintf函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap