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

C++ AJ_ErrPrintf函数代码示例

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

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



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

示例1: AJ_Net_Connect

AJ_Status AJ_Net_Connect(AJ_NetSocket* netSock, uint16_t port, uint8_t addrType, const uint32_t* addr)
{
    int ret;

    IPAddress ip(*addr);

    AJ_InfoPrintf(("AJ_Net_Connect(nexSock=0x%p, port=%d., addrType=%d., addr=0x%p)\n", netSock, port, addrType, addr));

    AJ_InfoPrintf(("AJ_Net_Connect(): Connect to 0x%x:%u.\n", addr, port));;

    ret = g_client.connect(ip, port);

#ifdef NOTDEF
    Serial.print("Connecting to: ");
    Serial.print(ip);
    Serial.print(':');
    Serial.println(port);
#endif

    if (ret == -1) {
        AJ_ErrPrintf(("AJ_Net_Connect(): connect() failed: %d: status=AJ_ERR_CONNECT\n", ret));
        return AJ_ERR_CONNECT;
    } else {
        AJ_IOBufInit(&netSock->rx, rxData, sizeof(rxData), AJ_IO_BUF_RX, (void*)&g_client);
        netSock->rx.recv = AJ_Net_Recv;
        AJ_IOBufInit(&netSock->tx, txData, sizeof(txData), AJ_IO_BUF_TX, (void*)&g_client);
        netSock->tx.send = AJ_Net_Send;
        AJ_ErrPrintf(("AJ_Net_Connect(): connect() success: status=AJ_OK\n"));
        return AJ_OK;
    }
    AJ_ErrPrintf(("AJ_Net_Connect(): connect() failed: %d: status=AJ_ERR_CONNECT\n", ret));
    return AJ_ERR_CONNECT;
}
开发者ID:fonlabs,项目名称:ajtcl,代码行数:33,代码来源:aj_net.c


示例2: MatchProp

static AJ_Status MatchProp(const char* member, const char* prop, uint8_t op, const char** sig)
{
    const char* encoding = member;

    if (*encoding++ != '@') {
        AJ_ErrPrintf(("MatchProp(): AJ_ERR_NO_MATCH\n"));
        return AJ_ERR_NO_MATCH;
    }
    while (*prop) {
        if (*encoding++ != *prop++) {
            AJ_ErrPrintf(("MatchProp(): AJ_ERR_NO_MATCH\n"));
            return AJ_ERR_NO_MATCH;
        }
    }
    if ((op == AJ_PROP_GET) && (*encoding == WRITE_ONLY)) {
        AJ_ErrPrintf(("MatchProp(): AJ_ERR_DISALLOWED\n"));
        return AJ_ERR_DISALLOWED;
    }
    if ((op == AJ_PROP_SET) && (*encoding == READ_ONLY)) {
        AJ_ErrPrintf(("MatchProp(): AJ_ERR_DISALLOWED\n"));
        return AJ_ERR_DISALLOWED;
    }
    *sig = ++encoding;
    return AJ_OK;
}
开发者ID:jchuang1977,项目名称:alljoyn_14.02_thin_client,代码行数:25,代码来源:aj_introspect.c


示例3: ExportIfNeeded

static AJ_Status ExportIfNeeded(const char* dev, int deviceId, const char* root)
{
    int fd;
    DIR* dir;
    char buf[256];

    snprintf(buf, sizeof(buf), "%s%s", root, dev);
    dir = opendir(buf);
    if (dir) {
        closedir(dir);
        return AJ_OK;
    }
    if (errno != ENOENT) {
        AJ_ErrPrintf(("Failed opendir %d %s\n", errno, buf));
        return AJ_ERR_INVALID;
    }
    /*
     * Try to create the device entry
     */
    snprintf(buf, sizeof(buf), "%s%s", root, "export");
    fd = open(buf, O_WRONLY);
    if (fd >= 0) {
        size_t sz = snprintf(buf, sizeof(buf), "%d", deviceId);
        write(fd, buf, sz + 1);
        close(fd);
        return AJ_OK;
    } else {
        AJ_ErrPrintf(("Failed to open %s\n", buf));
        return AJ_ERR_INVALID;
    }
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:31,代码来源:io_gpio.c


示例4: AJ_ARDP_UDP_Send

static AJ_Status AJ_ARDP_UDP_Send(void* context, uint8_t* buf, size_t len, size_t* sent)
{
    AJ_Status status = AJ_OK;
    DWORD ret;
    NetContext* ctx = (NetContext*) context;
    WSAOVERLAPPED ov;
    DWORD flags = 0;
    WSABUF wsbuf;

    memset(&ov, 0, sizeof(ov));
    ov.hEvent = sendEvent;
    wsbuf.len = len;
    wsbuf.buf = buf;

    AJ_InfoPrintf(("AJ_ARDP_UDP_Send(buf=0x%p, len=%lu)\n", buf, len));

    ret = WSASend(ctx->udpSock, &wsbuf, 1, NULL, flags, &ov, NULL);
    if (ret == SOCKET_ERROR) {
        AJ_ErrPrintf(("AJ_ARDP_UDP_Send(): WSASend() failed. WSAGetLastError()=0x%x, status=AJ_ERR_WRITE\n", WSAGetLastError()));
        *sent = 0;
        return AJ_ERR_WRITE;
    }

    if (!WSAGetOverlappedResult(ctx->udpSock, &ov, sent, TRUE, &flags)) {
        AJ_ErrPrintf(("AJ_ARDP_UDP_Send(): WSAGetOverlappedResult() failed. WSAGetLastError()=0x%x, status=AJ_ERR_WRITE\n", WSAGetLastError()));
        return AJ_ERR_WRITE;
    }

    return status;
}
开发者ID:dengcj0,项目名称:QCA4010,代码行数:30,代码来源:aj_net.c


示例5: AJNS_Producer_CancelNotification

AJ_Status AJNS_Producer_CancelNotification(AJ_BusAttachment* busAttachment, uint32_t serialNum)
{
    AJ_Status status;
    uint16_t messageType = 0;

    AJ_InfoPrintf(("In CancelNotificationBySerialNum\n"));

    if (serialNum == 0) {
        AJ_ErrPrintf(("Could not cancel Message - no message to cancel\n"));
        return AJ_OK;
    }
    for (; messageType < AJNS_NUM_MESSAGE_TYPES; messageType++) {
        if (lastSentNotifications[messageType].serialNum == serialNum) {
            break;
        }
    }
    if (messageType >= AJNS_NUM_MESSAGE_TYPES) {
        AJ_ErrPrintf(("Could not find matching Message serial number - no message to cancel\n"));
        return AJ_OK;
    }

    status = AJ_BusCancelSessionless(busAttachment, serialNum);

    if (status != AJ_OK) {
        AJ_ErrPrintf(("Failed to send cancelation\n"));
        return status;
    }

    AJ_InfoPrintf(("***************** Message with Notification id %d and serialNum %u deleted successfully *****************\n", lastSentNotifications[messageType].notificationId, lastSentNotifications[messageType].serialNum));

    lastSentNotifications[messageType].notificationId = 0;
    lastSentNotifications[messageType].serialNum = 0;

    return status;
}
开发者ID:dengcj0,项目名称:QCA4010,代码行数:35,代码来源:NotificationProducer.c


示例6: AJNS_Producer_DeleteLastNotification

AJ_Status AJNS_Producer_DeleteLastNotification(AJ_BusAttachment* busAttachment, uint16_t messageType)
{
    AJ_Status status;
    uint32_t lastSentSerialNumber;

   // AJ_InfoPrintf(("In DeleteLastNotification\n"));
    if (messageType >= AJNS_NUM_MESSAGE_TYPES) 
	{
        AJ_ErrPrintf(("Could not delete Notification - MessageType is not valid\n"));
        return AJ_ERR_DISALLOWED;
    }

    lastSentSerialNumber = lastSentNotifications[messageType].serialNum;
    if (lastSentSerialNumber == 0) 
	{
        AJ_ErrPrintf(("Could not Delete Message - no message to delete\n"));
        return AJ_OK;
    }

    status = AJ_BusCancelSessionless(busAttachment, lastSentSerialNumber);

    if (status != AJ_OK) 
	{
        AJ_ErrPrintf(("Could not Delete Message\n"));
        return status;
    }

  //  AJ_InfoPrintf(("***************** Message with Notification id %d and serialNum %u deleted successfully *****************\n", lastSentNotifications[messageType].notificationId, lastSentNotifications[messageType].serialNum));

    lastSentNotifications[messageType].notificationId = 0;
    lastSentNotifications[messageType].serialNum = 0;

    return status;
}
开发者ID:marus-ka,项目名称:alljoyn_lsf_lamp,代码行数:34,代码来源:NotificationProducer.c


示例7: CPS_StartService

AJ_Status CPS_StartService(AJ_BusAttachment* bus, const char* busAddress, uint32_t timeout, uint8_t connected)
{
    AJ_Status status = AJ_OK;
    while (TRUE) {
        AJ_InfoPrintf(("Attempting to connect to bus '%s'\n", busAddress));

        status = AJ_Connect(bus, busAddress, timeout);
        if (status != AJ_OK) {
            AJ_ErrPrintf(("Failed to connect to bus '%s', sleeping for %d seconds...\n", busAddress, CPSC_CONNECT_PAUSE / 1000));
            AJ_Sleep(CPSC_CONNECT_PAUSE);
            continue;
        }

        AJ_InfoPrintf(("Connected successfully\n"));
        isBusConnected = TRUE;

        status = AJ_BusSetSignalRule(bus, CPSAnnounceMatch, AJ_BUS_SIGNAL_ALLOW);
        if (status != AJ_OK) {
            AJ_ErrPrintf(("Could not set Announcement Interface AddMatch\n"));
            return status;
        }
        break;
    }
    ;
    return status;
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:26,代码来源:ControlPanelClient.c


示例8: AJNS_Consumer_SendDismissRequest

AJ_Status AJNS_Consumer_SendDismissRequest(AJ_BusAttachment* busAttachment, uint16_t version, int32_t notificationId, const char* appId, const char* senderName, uint32_t sessionId)
{
    AJ_Status status = AJ_OK;

    if ((status == AJ_OK) && (sessionId != 0)) {
        AJ_Message dismissMsg;
        status = AJ_MarshalMethodCall(busAttachment, &dismissMsg, NOTIFICATION_PRODUCER_DISMISS_PROXY, senderName, sessionId, AJ_NO_FLAGS, AJ_CALL_TIMEOUT);
        if (status != AJ_OK) {
            AJ_ErrPrintf(("Could not marshal method call\n"));
            return status;
        }
        status = AJ_MarshalArgs(&dismissMsg, "i", notificationId);
        if (status != AJ_OK) {
            AJ_ErrPrintf(("Could not marshal arguments\n"));
            return status;
        }
        status = AJ_DeliverMsg(&dismissMsg);
        if (status != AJ_OK) {
            AJ_ErrPrintf(("Could not deliver message\n"));
            return status;
        }
        AJ_CloseMsg(&dismissMsg);
    }

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


示例9: AJ_Net_Connect

AJ_Status AJ_Net_Connect(AJ_BusAttachment* bus, const AJ_Service* service)
{
    int ret;
    IPAddress ip(service->ipv4);

    if (!(service->addrTypes & AJ_ADDR_TCP4)) {
        AJ_ErrPrintf(("AJ_Net_Connect(): only IPV4 TCP supported\n", ret));
        return AJ_ERR_CONNECT;
    }


    AJ_InfoPrintf(("AJ_Net_Connect(bus=0x%p, addrType=%d.)\n", bus, service->addrTypes));

    ret = g_client.connect(ip, service->ipv4port);


    if (ret != 1) {
        AJ_ErrPrintf(("AJ_Net_Connect(): connect() failed: %d: status=AJ_ERR_CONNECT\n", ret));
        return AJ_ERR_CONNECT;
    } else {
        AJ_IOBufInit(&bus->sock.rx, rxData, sizeof(rxData), AJ_IO_BUF_RX, (void*)&g_client);
        bus->sock.rx.recv = AJ_Net_Recv;
        AJ_IOBufInit(&bus->sock.tx, txData, sizeof(txData), AJ_IO_BUF_TX, (void*)&g_client);
        bus->sock.tx.send = AJ_Net_Send;
        AJ_ErrPrintf(("AJ_Net_Connect(): connect() success: status=AJ_OK\n"));
        return AJ_OK;
    }
    AJ_ErrPrintf(("AJ_Net_Connect(): connect() failed: %d: status=AJ_ERR_CONNECT\n", ret));
    return AJ_ERR_CONNECT;
}
开发者ID:durake,项目名称:core-ajtcl,代码行数:30,代码来源:aj_net.c


示例10: OpenSimIO

static void OpenSimIO()
{
    pthread_attr_t attr;
    struct sockaddr_un sa;

    memset(&sa, 0, sizeof(sa));
    sa.sun_family = AF_UNIX;
    memcpy(sa.sun_path, gui_server, sizeof(gui_server));

    sock = socket(AF_UNIX,  SOCK_STREAM, 0);
    if (sock >= 0) {
        pthread_t threadId;
        int ret = connect(sock, (struct sockaddr*)&sa, sizeof(sa));
        if (ret == -1) {
            AJ_ErrPrintf(("Failed to connect to I/O gui server\n"));
            close(sock);
            sock = -1;
        }
        /*
         * Create thread to handle reads
         */
        pthread_attr_init(&attr);
        ret = pthread_create(&threadId, NULL, SockRead, NULL);
        if (ret) {
            AJ_ErrPrintf(("Failed to create read thread\n"));
            close(sock);
            sock = -1;
        } else {
            pthread_detach(threadId);
            pthread_cond_init(&cond, NULL);
            pthread_mutex_init(&mutex, NULL);
        }
    }
}
开发者ID:anthony-ngu,项目名称:core-alljoyn-js,代码行数:34,代码来源:io_simulation.c


示例11: AJ_ARDP_UDP_Recv

static AJ_Status AJ_ARDP_UDP_Recv(void* context, uint8_t** data, uint32_t* recved, uint32_t timeout)
{
    NetContext* ctx = (NetContext*) context;
    DWORD ret = SOCKET_ERROR;
    WSAEVENT events[2];
    DWORD flags = 0;
    static uint8_t buffer[UDP_SEGBMAX];

    *data = NULL;

    if (wsaOverlapped.hEvent == INVALID_HANDLE_VALUE) {
        wsbuf.len = sizeof(buffer);
        wsbuf.buf = buffer;
        memset(&wsaOverlapped, 0, sizeof(WSAOVERLAPPED));
        wsaOverlapped.hEvent = recvEvent;
        ret = WSARecvFrom(ctx->udpSock, &wsbuf, 1, NULL, &flags, NULL, NULL, &wsaOverlapped, NULL);
        if ((ret == SOCKET_ERROR) && (WSAGetLastError() != WSA_IO_PENDING)) {
            AJ_ErrPrintf(("WSARecvFrom(): failed WSAGetLastError()=%d\n", WSAGetLastError()));
            return AJ_ERR_READ;
        }
    }

    events[0] = wsaOverlapped.hEvent;
    events[1] = interruptEvent;

    ret = WSAWaitForMultipleEvents(2, events, FALSE, timeout, TRUE);
    switch (ret) {
    case WSA_WAIT_EVENT_0:
        flags = 0;
        if (WSAGetOverlappedResult(ctx->udpSock, &wsaOverlapped, recved, TRUE, &flags)) {
            WSAResetEvent(wsaOverlapped.hEvent);
            wsaOverlapped.hEvent = INVALID_HANDLE_VALUE;
            *data = buffer;
            return AJ_OK;
        } else {
            AJ_ErrPrintf(("AJ_ARDP_UDP_Recv(): WSAGetOverlappedResult error; WSAGetLastError()=%d\n", WSAGetLastError()));
            return AJ_ERR_READ;
        }
        break;

    case WSA_WAIT_EVENT_0 + 1:
        WSAResetEvent(interruptEvent);
        return AJ_ERR_INTERRUPTED;

    case WSA_WAIT_TIMEOUT:
        return AJ_ERR_TIMEOUT;
        break;

    default:
        AJ_ErrPrintf(("AJ_ARDP_UDP_Recv(): WSAWaitForMultipleEvents error; WSAGetLastError()=%d\n", WSAGetLastError()));
        return AJ_ERR_READ;
    }
}
开发者ID:dengcj0,项目名称:QCA4010,代码行数:53,代码来源:aj_net.c


示例12: AJNS_Producer_ConnectedHandler

AJ_Status AJNS_Producer_ConnectedHandler(AJ_BusAttachment* busAttachment)
{
    AJ_Status status;
    AJ_SessionOpts sessionOpts = {
        AJ_SESSION_TRAFFIC_MESSAGES,
        AJ_SESSION_PROXIMITY_ANY,
        AJ_TRANSPORT_ANY,
        FALSE
    };
    uint8_t serviceStarted;
    AJ_Message msg;

    status = AJ_BusBindSessionPort(busAttachment, AJNS_NotificationProducerPort, &sessionOpts, 0);
    if (status != AJ_OK) {
        AJ_ErrPrintf(("Failed to send bind session port message\n"));
    }

    serviceStarted = FALSE;
    while (!serviceStarted && (status == AJ_OK)) {

        status = AJ_UnmarshalMsg(busAttachment, &msg, AJ_UNMARSHAL_TIMEOUT);
        if (status == AJ_ERR_NO_MATCH) {
            status = AJ_OK;
            continue;
        } else if (status != AJ_OK) {
            break;
        }

        switch (msg.msgId) {
        case AJ_REPLY_ID(AJ_METHOD_BIND_SESSION_PORT):
            if (msg.hdr->msgType == AJ_MSG_ERROR) {
                status = AJ_ERR_FAILURE;
            } else {
                serviceStarted = TRUE;
            }
            break;

        default:
            /*
             * Pass to the built-in bus message handlers
             */
            status = AJ_BusHandleBusMessage(&msg);
            break;
        }
        AJ_CloseMsg(&msg);
    }

    if (status != AJ_OK) {
        AJ_ErrPrintf(("AllJoyn disconnect bus status=%d\n", status));
        status = AJ_ERR_READ;
    }
    return status;
}
开发者ID:dengcj0,项目名称:QCA4010,代码行数:53,代码来源:NotificationProducer.c


示例13: AJ_BusLinkStateProc

AJ_Status AJ_BusLinkStateProc(AJ_BusAttachment* bus)
{
    AJ_Status status = AJ_OK;
    if (bus->isProbeRequired && busLinkTimeout) 
	{
        if (!busLinkWatcher.linkTimerInited) 
		{
            busLinkWatcher.linkTimerInited = TRUE;
            AJ_InitTimer(&(busLinkWatcher.linkTimer));
        }
		else
		{
            uint32_t eclipse = AJ_GetElapsedTime(&(busLinkWatcher.linkTimer), TRUE);
            if (eclipse >= busLinkTimeout) 
			{
                if (!busLinkWatcher.pingTimerInited) 
				{
                    busLinkWatcher.pingTimerInited = TRUE;
                    AJ_InitTimer(&(busLinkWatcher.pingTimer));
                    if (AJ_OK != AJ_SendLinkProbeReq(bus)) 
					{
                        AJ_ErrPrintf(("AJ_BusLinkStateProc(): AJ_SendLinkProbeReq() failure"));
                    }
                } 
				else
				{
                    eclipse = AJ_GetElapsedTime(&(busLinkWatcher.pingTimer), TRUE);
                    if (eclipse >=  AJ_BUS_LINK_PING_TIMEOUT) 
					{
                        if (++busLinkWatcher.numOfPingTimedOut < AJ_MAX_LINK_PING_PACKETS) 
						{
                            AJ_InitTimer(&(busLinkWatcher.pingTimer));
                            if (AJ_OK != AJ_SendLinkProbeReq(bus)) 
							{
                                AJ_ErrPrintf(("AJ_BusLinkStateProc(): AJ_SendLinkProbeReq() failure"));
                            }
                        } 
						else
						{
                            AJ_ErrPrintf(("AJ_BusLinkStateProc(): AJ_ERR_LINK_TIMEOUT"));
                            status = AJ_ERR_LINK_TIMEOUT;
                            // stop sending probe messages until next link timeout event
                            memset(&busLinkWatcher, 0, sizeof(AJ_BusLinkWatcher));
                        }
                    }
                }
            }
        }
    }
    return status;
}
开发者ID:marus-ka,项目名称:alljoyn_lsf_lamp,代码行数:51,代码来源:aj_link_timeout.c


示例14: AJ_Decrypt_CCM

/*
 * Implements AES-CCM (Counter with CBC-MAC) decryption as described in RFC 3610
 */
AJ_Status AJ_Decrypt_CCM(const uint8_t* key,
                         uint8_t* msg,
                         uint32_t msgLen,
                         uint32_t hdrLen,
                         uint8_t tagLen,
                         const uint8_t* nonce,
                         uint32_t nLen)
{
    AJ_Status status = AJ_OK;
    CCM_Context* context;

    if (!(context = InitCCMContext(nonce, nLen, hdrLen, msgLen, tagLen))) {
        AJ_ErrPrintf(("AJ_Decrypt_CCM(): AJ_ERR_RESOURCES\n"));
        return AJ_ERR_RESOURCES;
    }
    /*
     * Do any platform specific operations to enable AES
     */
    AJ_AES_Enable(key);
    /*
     * Decrypt the authentication field
     */
    AJ_AES_CTR_128(key, msg + msgLen, msg + msgLen, tagLen, context->ivec.data);
    /*
     * Decrypt message.
     */
    if (msgLen != hdrLen) {
        AJ_AES_CTR_128(key, msg + hdrLen, msg + hdrLen, msgLen - hdrLen, context->ivec.data);
    }
    /*
     * Compute and verify the authentication tag T.
     */
    Compute_CCM_AuthTag(key, context, msg, msgLen - hdrLen, hdrLen);
    /*
     * Balance the enable call above
     */
    AJ_AES_Disable();
    if (AJ_Crypto_Compare(context->T.data, msg + msgLen, tagLen) != 0) {
        /*
         * Authentication failed Clear the decrypted data
         */
        memset(msg, 0, msgLen + tagLen);
        AJ_ErrPrintf(("AJ_Decrypt_CCM(): AJ_ERR_SECURITY\n"));
        status = AJ_ERR_SECURITY;
    }
    /*
     * Done with the context
     */
    AJ_Free(context);
    return status;
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:54,代码来源:aj_crypto_aes.c


示例15: AJ_Net_Send

static AJ_Status AJ_Net_Send(AJ_IOBuffer* buf)
{
    DWORD ret;
    DWORD tx = AJ_IO_BUF_AVAIL(buf);

    AJ_InfoPrintf(("AJ_Net_Send(buf=0x%p)\n", buf));

    assert(buf->direction == AJ_IO_BUF_TX);

    if (tx > 0) {
        NetContext* ctx = (NetContext*) buf->context;
        WSAOVERLAPPED ov;
        DWORD flags = 0;
        WSABUF wsbuf;

        memset(&ov, 0, sizeof(ov));
        ov.hEvent = sendEvent;
        wsbuf.len = tx;
        wsbuf.buf = buf->readPtr;

        ret = WSASend(ctx->tcpSock, &wsbuf, 1, NULL, flags, &ov, NULL);
        if (!WSAGetOverlappedResult(ctx->tcpSock, &ov, &tx, TRUE, &flags)) {
            AJ_ErrPrintf(("AJ_Net_Send(): send() failed. WSAGetLastError()=0x%x, status=AJ_ERR_WRITE\n", WSAGetLastError()));
            return AJ_ERR_WRITE;
        }
        buf->readPtr += tx;
    }
    if (AJ_IO_BUF_AVAIL(buf) == 0) {
        AJ_IO_BUF_RESET(buf);
    }
    AJ_InfoPrintf(("AJ_Net_Send(): status=AJ_OK\n"));
    return AJ_OK;
}
开发者ID:dengcj0,项目名称:QCA4010,代码行数:33,代码来源:aj_net.c


示例16: 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


示例17: AJS_TargetIO_PinEnableTrigger

AJ_Status AJS_TargetIO_PinEnableTrigger(void* pinCtx, AJS_IO_PinTriggerMode trigger, int32_t* trigId, uint8_t debounce)
{
    GPIO* gpio = (GPIO*)pinCtx;

    if ((trigger != AJS_IO_PIN_TRIGGER_ON_RISE) && (trigger != AJS_IO_PIN_TRIGGER_ON_FALL)) {
        /*
         * Disable triggers for this pin
         */
        if (gpio->trigId != AJS_IO_PIN_NO_TRIGGER) {
            SendCmd('i', gpio, 0, 0);
            *trigId = gpio->trigId;
            BIT_CLR(trigSet, gpio->trigId);
            gpio->trigId = AJS_IO_PIN_NO_TRIGGER;
        } else {
            *trigId = AJS_IO_PIN_NO_TRIGGER;
        }
        return AJ_OK;
    }
    SendCmd('i', gpio, (trigger == AJS_IO_PIN_TRIGGER_ON_RISE) ? 1 : 2, 0);
    gpio->trigId = gpio->pinId;
    *trigId = gpio->trigId;

    AJ_ErrPrintf(("AJS_TargetIO_PinEnableTrigger pinId %d\n", gpio->pinId));
    return AJ_OK;
}
开发者ID:anthony-ngu,项目名称:core-alljoyn-js,代码行数:25,代码来源:io_simulation.c


示例18: SockRead

static void* SockRead(void* arg)
{
    while (sock != -1) {
        uint8_t buf[3];
        int ret = recv(sock, buf, sizeof(buf), MSG_WAITALL);
        if (ret != 3) {
            AJ_ErrPrintf(("Recv failed - closing socket\n"));
            close(sock);
            sock = -1;
            break;
        }
        if (buf[0] == 'r') {
            memcpy(recvBuf, buf, ret);
            pthread_mutex_lock(&mutex);
            pthread_cond_signal(&cond);
            pthread_mutex_unlock(&mutex);
        } else if (buf[0] == 'i') {
            /*
             * Record which trigger fired
             */
            BIT_SET(trigSet, buf[1] - 1);
            AJ_Net_Interrupt();
        }
    }
    pthread_cond_destroy(&cond);
    pthread_mutex_destroy(&mutex);
    return NULL;
}
开发者ID:anthony-ngu,项目名称:core-alljoyn-js,代码行数:28,代码来源:io_simulation.c


示例19: AJS_TargetIO_PinSet

void AJS_TargetIO_PinSet(void* pinCtx, uint32_t val)
{
    GPIO* gpio = (GPIO*)pinCtx;
    if (!SendCmd('w', gpio, (uint8_t)val, 0)) {
        AJ_ErrPrintf(("AJS_TargetIO_PinSet(%d, %d)\n", gpio->pinId, val));
    }
}
开发者ID:anthony-ngu,项目名称:core-alljoyn-js,代码行数:7,代码来源:io_simulation.c


示例20: CheckSignature

/*
 * Check that the signature in the message matches the encoded signature in the string
 */
static AJ_Status CheckSignature(const char* encoding, const AJ_Message* msg)
{
    const char* sig = msg->signature ? msg->signature : "";
    char direction = (msg->hdr->msgType == AJ_MSG_METHOD_CALL) ? IN_ARG : OUT_ARG;

    /*
     * Wild card in the message is ok.
     */
    if (*sig == '*') {
        return AJ_OK;
    }
    while (*encoding) {
        /*
         * Skip until we find a direction character
         */
        while (*encoding && (*encoding++ != direction)) {
        }
        /*
         * Match a single arg to the signature
         */
        while (*encoding && (*sig == *encoding)) {
            ++sig;
            ++encoding;
        }
        if (*encoding && (*encoding != ' ')) {
            AJ_ErrPrintf(("CheckSignature(): AJ_ERR_SIGNATURE\n"));
            return AJ_ERR_SIGNATURE;
        }
    }
    /*
     * On a match we should have consumed both strings
     */
    return (*encoding == *sig) ? AJ_OK : AJ_ERR_SIGNATURE;
}
开发者ID:jchuang1977,项目名称:alljoyn_14.02_thin_client,代码行数:37,代码来源:aj_introspect.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ AJ_InfoPrintf函数代码示例发布时间:2022-05-30
下一篇:
C++ AJ_DeliverMsg函数代码示例发布时间: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