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


C++ AJ_DeliverMsg函数代码示例

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


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

示例1: AJ_PeerAuthenticate

AJ_Status AJ_PeerAuthenticate(AJ_BusAttachment* bus, const char* peerName, AJ_PeerAuthenticateCallback callback, void* cbContext)
{
    AJ_Message msg;
    char guidStr[33];
    AJ_GUID localGuid;
    uint32_t version = REQUIRED_AUTH_VERSION;

    /*
     * Check there isn't an authentication in progress
     */
    if (authContext.callback || authContext.peerGuid) {
        /*
         * The existing authentication may have timed-out
         */
        if (AJ_GetElapsedTime(&authContext.timer, TRUE) < MAX_AUTH_TIME) {
            return AJ_ERR_RESOURCES;
        }
        /*
         * Report the failed authentication
         */
        PeerAuthComplete(AJ_ERR_TIMEOUT);
    }
    authContext.callback = callback;
    authContext.cbContext = cbContext;
    authContext.peerName = peerName;
    AJ_InitTimer(&authContext.timer);
    /*
     * Kick off autnetication with an ExchangeGUIDS method call
     */
    AJ_MarshalMethodCall(bus, &msg, AJ_METHOD_EXCHANGE_GUIDS, peerName, 0, AJ_NO_FLAGS, CALL_TIMEOUT);
    AJ_GetLocalGUID(&localGuid);
    AJ_GUID_ToString(&localGuid, guidStr, sizeof(guidStr));
    AJ_MarshalArgs(&msg, "su", guidStr, version);
    return AJ_DeliverMsg(&msg);
}
开发者ID:bigzero,项目名称:ajtcl,代码行数:35,代码来源:aj_peer.c

示例2: AppHandleCat

AJ_Status AppHandleCat(AJ_Message* msg)
{
    AJ_Status status = AJ_OK;
    AJ_Message reply;
    char* partA;
    char* partB;
    char* totalString;
    AJ_AlwaysPrintf(("%s:%d:%s %d\n", __FILE__, __LINE__, __FUNCTION__, 0));

    AJ_UnmarshalArgs(msg, "ss", &partA, &partB);

    totalString = (char*) AJ_Malloc(strlen(partA) + strlen(partB) + 1);
    if (!totalString) {
        return AJ_ERR_RESOURCES;
    }
    strcpy(totalString, partA);
    strcpy(totalString + strlen(partA), partB);

    AJ_MarshalReplyMsg(msg, &reply);
    AJ_MarshalArgs(&reply, "s", totalString);

    status = AJ_DeliverMsg(&reply);
    AJ_Free(totalString);
    return status;
}
开发者ID:fonlabs,项目名称:ajtcl,代码行数:25,代码来源:bastress2.c

示例3: EventsAndActionsMessageProcessor

AJSVC_ServiceStatus EventsAndActionsMessageProcessor(AJ_BusAttachment* busAttachment, AJ_Message* msg, AJ_Status* msgStatus)
{
    AJ_Message reply;
    AJSVC_ServiceStatus serviceStatus = AJSVC_SERVICE_STATUS_HANDLED;

    switch (msg->msgId) {
    case EVENTSANDACTIONS_GET_PROP:
        *msgStatus = AJ_BusPropGet(msg, EventsAndActionsPropGetHandler, NULL);
        break;

    case EVENTSANDACTIONS_SET_PROP:
        *msgStatus = AJ_BusPropSet(msg, EventsAndActionsPropSetHandler, NULL);
        break;

    case ACTIONS_SETMODETOAUTO:
    case ACTIONS_SETMODETOCOOL:
    case ACTIONS_SETMODETOHEAT:
    case ACTIONS_SETMODETOFAN:
    case ACTIONS_SETMODETOOFF:
        AJ_MarshalReplyMsg(msg, &reply);
        setCurrentMode((msg->msgId & 0xFF) - (ACTIONS_SETMODETOAUTO & 0xFF));
        *msgStatus = AJ_DeliverMsg(&reply);
        break;

    default:
        serviceStatus = AJSVC_SERVICE_STATUS_NOT_HANDLED;
        break;
    }

    return serviceStatus;
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:31,代码来源:EventsAndActionsSample.c

示例4: AJ_BusSetSignalRuleSerial

AJ_Status AJ_BusSetSignalRuleSerial(AJ_BusAttachment* bus, const char* ruleString, uint8_t rule, uint8_t flags, uint32_t* serialNum)
{
    AJ_Status status;
    AJ_Message msg;
    uint32_t msgId = (rule == AJ_BUS_SIGNAL_ALLOW) ? AJ_METHOD_ADD_MATCH : AJ_METHOD_REMOVE_MATCH;

    AJ_InfoPrintf(("AJ_BusSetSignalRuleSerial(bus=0x%p, ruleString=\"%s\", rule=%d.)\n", bus, ruleString, rule));

    status = AJ_MarshalMethodCall(bus, &msg, msgId, AJ_DBusDestination, 0, flags, AJ_METHOD_TIMEOUT);
    if (status == AJ_OK) {
        uint32_t sz = 0;
        uint8_t nul = 0;
        if (serialNum) {
            *serialNum = msg.hdr->serialNum;
        }
        sz = (uint32_t)strlen(ruleString);
        status = AJ_DeliverMsgPartial(&msg, sz + 5);
        AJ_MarshalRaw(&msg, &sz, 4);
        AJ_MarshalRaw(&msg, ruleString, strlen(ruleString));
        AJ_MarshalRaw(&msg, &nul, 1);
    }
    if (status == AJ_OK) {
        status = AJ_DeliverMsg(&msg);
    }
    return status;
}
开发者ID:durake,项目名称:core-ajtcl,代码行数:26,代码来源:aj_bus.c

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

示例6: AppHandleCat

static AJ_Status AppHandleCat(AJ_Message* msg)
{
#define BUFFER_SIZE 256
    const char* string0;
    const char* string1;
    char buffer[BUFFER_SIZE];
    AJ_Message reply;
    AJ_Arg replyArg;

    AJ_UnmarshalArgs(msg, "ss", &string0, &string1);
    AJ_MarshalReplyMsg(msg, &reply);

    /* We have the arguments. Now do the concatenation. */
    strncpy(buffer, string0, BUFFER_SIZE);
    buffer[BUFFER_SIZE - 1] = '\0';
    strncat(buffer, string1, BUFFER_SIZE - strlen(buffer));
    buffer[BUFFER_SIZE - 1] = '\0';

    AJ_InitArg(&replyArg, AJ_ARG_STRING, 0, buffer, 0);
    AJ_MarshalArg(&reply, &replyArg);

    return AJ_DeliverMsg(&reply);

#undef BUFFER_SIZE
}
开发者ID:CasyWang,项目名称:Triton,代码行数:25,代码来源:basic_service.cpp

示例7: AJ_BusAddSignalRule

AJ_Status AJ_BusAddSignalRule(AJ_BusAttachment* bus, const char* signalName, const char* interfaceName, uint8_t rule)
{
    AJ_Status status;
    AJ_Message msg;
    const char* str[5];
    uint32_t msgId = (rule == AJ_BUS_SIGNAL_ALLOW) ? AJ_METHOD_ADD_MATCH : AJ_METHOD_REMOVE_MATCH;

    AJ_InfoPrintf(("AJ_BusAddSignalRule(bus=0x%p, signalName=\"%s\", interfaceName=\"%s\", rule=%d.)\n", bus, signalName, interfaceName, rule));

    str[0] = "type='signal',member='";
    str[1] = signalName;
    str[2] = "'interface='";
    str[3] = interfaceName;
    str[4] = "'";

    status = AJ_MarshalMethodCall(bus, &msg, msgId, AJ_DBusDestination, 0, 0, AJ_METHOD_TIMEOUT);
    if (status == AJ_OK) {
        size_t i;
        uint32_t sz = 0;
        uint8_t nul = 0;
        for (i = 0; i < ArraySize(str); ++i) {
            sz += (uint32_t)strlen(str[i]);
        }
        status = AJ_DeliverMsgPartial(&msg, sz + 5);
        AJ_MarshalRaw(&msg, &sz, 4);
        for (i = 0; i < ArraySize(str); ++i) {
            AJ_MarshalRaw(&msg, str[i], strlen(str[i]));
        }
        AJ_MarshalRaw(&msg, &nul, 1);
    }
    if (status == AJ_OK) {
        status = AJ_DeliverMsg(&msg);
    }
    return status;
}
开发者ID:jchuang1977,项目名称:alljoyn_14.02_thin_client,代码行数:35,代码来源:aj_bus.c

示例8: ExecuteAction

AJ_Status ExecuteAction(AJ_Message* msg, uint32_t msgId, ExecuteActionContext* context)
{
    AJ_Message reply;
    AJ_MarshalReplyMsg(msg, &reply);

    switch (msgId) {
    case EN_MYDEVICE_OVENACTION_EXEC:
    case DE_AT_MYDEVICE_OVENACTION_EXEC:
        {
            AJ_InfoPrintf(("Starting the Oven. Execute was called\n"));
        }
        break;

    case EN_MYDEVICE_LIGHTCONFIRM_EXEC_ACTION1:
    case DE_AT_MYDEVICE_LIGHTCONFIRM_EXEC_ACTION1:
        {
            AJ_InfoPrintf(("Execute Action1 was called\n"));
        }
        break;

    case EN_MYDEVICE_LIGHTCONFIRM_EXEC_ACTION2:
    case DE_AT_MYDEVICE_LIGHTCONFIRM_EXEC_ACTION2:
        {
            AJ_InfoPrintf(("Execute Action2 was called\n"));
        }
        break;

    case EN_MYDEVICE_LIGHTCONFIRM_EXEC_ACTION3:
    case DE_AT_MYDEVICE_LIGHTCONFIRM_EXEC_ACTION3:
        {
            AJ_InfoPrintf(("Execute Action3 was called\n"));
        }
        break;

    case EN_MYDEVICE_AREYOUSURE_EXEC_ACTION1:
    case DE_AT_MYDEVICE_AREYOUSURE_EXEC_ACTION1:
        {
            AJ_InfoPrintf(("Execute Action1 was called\n")); addDismissSignal(context, MYDEVICE_NOTIFICATION_ACTION_AREYOUSURE_SIGNAL_DISMISS);
        }
        break;

    case EN_MYDEVICE_AREYOUSURE_EXEC_ACTION2:
    case DE_AT_MYDEVICE_AREYOUSURE_EXEC_ACTION2:
        {
            AJ_MarshalErrorMsg(msg, &reply, AJ_ErrServiceUnknown);
        }
        break;

    case EN_MYDEVICE_AREYOUSURE_EXEC_ACTION3:
    case DE_AT_MYDEVICE_AREYOUSURE_EXEC_ACTION3:
        {
            AJ_MarshalErrorMsg(msg, &reply, AJ_ErrServiceUnknown);
        }
        break;


    }

    return AJ_DeliverMsg(&reply);
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:60,代码来源:ControlPanelGenerated.c

示例9: AJNS_Producer_SendNotifySignal

/**
 * Send notify signal
 */
static AJ_Status AJNS_Producer_SendNotifySignal(AJ_BusAttachment* busAttachment, AJNS_Notification* notification, uint32_t ttl, uint32_t* messageSerialNumber)
{
    AJ_Status status;
    AJ_Message msg;
    uint32_t serialNum;

//    AJ_InfoPrintf(("In SendNotifySignal\n"));
    status = AJNS_Producer_MarshalNotificationMsg(busAttachment, &msg, notification, ttl);
    if (status != AJ_OK) 
	{
 //       AJ_InfoPrintf(("Could not Marshal Message\n"));
        return status;
    }
    serialNum = msg.hdr->serialNum;
    status = AJ_DeliverMsg(&msg);
    if (status != AJ_OK) 
	{
        AJ_ErrPrintf(("Could not Deliver Message\n"));
        return status;
    }
 //   AJ_InfoPrintf(("***************** Notification id %d delivered successfully with serial number %u *****************\n", notification->notificationId, serialNum));
    if (messageSerialNumber != NULL)
	{
        *messageSerialNumber = serialNum;
    }

    AJ_CloseMsg(&msg);

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

示例10: CPS_IdleConnectedHandler

void CPS_IdleConnectedHandler(AJ_BusAttachment*bus)
{
    if (runningTestNum == lastTestRun || CPSsessionId == 0) {
        return;
    }

    if (runningTestNum == numTests) {
        runningTestNum = 0;
        AJ_InfoPrintf(("Finished running all the tests\n"));
        exit(0);
    }

    AJ_Status status;
    AJ_Message msg;

    status = AJ_MarshalMethodCall(&busAttachment, &msg, testsToRun[runningTestNum].msgId,
                                  announceSender, CPSsessionId, 0, CPSC_CONNECT_TIMEOUT);

    uint16_t numParam;
    for (numParam = 0; numParam < testsToRun[runningTestNum].numParams; numParam++) {
        if (status == AJ_OK) {
            status = AJ_MarshalArgs(&msg, "q", testsToRun[runningTestNum].param[numParam]);
        }
    }

    if (status == AJ_OK) {
        status = AJ_DeliverMsg(&msg);
        lastTestRun = runningTestNum;
    }

    AJ_InfoPrintf(("MakeMethodCall() test number %i resulted in a status of %s.\n", lastTestRun + 1, AJ_StatusText(status)));
}
开发者ID:avernon,项目名称:asl_distribution,代码行数:32,代码来源:ControlPanelClient.c

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

示例12: AppHandlePing

static AJ_Status AppHandlePing(AJ_Message* msg)
{
    AJ_Status status;
    AJ_Message reply;
    AJ_Arg arg;

    status = AJ_UnmarshalArg(msg, &arg);

    if (AJ_OK == status) {

        if (arg.typeId == AJ_ARG_STRING) {
            AJ_Printf("Received ping request '%s'.\n", arg.val.v_string);
        } else {
            AJ_Printf("Unexpected arg type '%d' in ping request.\n", arg.typeId);
        }

        status = AJ_MarshalReplyMsg(msg, &reply);

        if (AJ_OK == status) {
            /*
             * Just return the arg we received
             */
            status = AJ_MarshalArg(&reply, &arg);

            if (AJ_OK == status) {
                status = AJ_DeliverMsg(&reply);
            }
        }
    }

    return status;
}
开发者ID:CasyWang,项目名称:Triton,代码行数:32,代码来源:SecureService.cpp

示例13: SendPing

AJ_Status SendPing(AJ_BusAttachment* bus, uint32_t sessionId)
{
    AJ_Status status;
    AJ_Message msg;

    AJ_AlwaysPrintf(("Sending ping request '%s'.\n", pingString));

    status = AJ_MarshalMethodCall(bus,
                                  &msg,
                                  PRX_PING,
                                  fullServiceName,
                                  sessionId,
                                  AJ_FLAG_ENCRYPTED,
                                  METHOD_TIMEOUT);
    if (AJ_OK == status) {
        status = AJ_MarshalArgs(&msg, "s", pingString);
    } else {
        AJ_InfoPrintf(("In SendPing() AJ_MarshalMethodCall() status = %d.\n", status));
    }

    if (AJ_OK == status) {
        status = AJ_DeliverMsg(&msg);
    } else {
        AJ_InfoPrintf(("In SendPing() AJ_MarshalArgs() status = %d.\n", status));
    }

    if (AJ_OK != status) {
        AJ_InfoPrintf(("In SendPing() AJ_DeliverMsg() status = %d.\n", status));
    }

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

示例14: AJCFG_GetConfigurationsHandler

AJ_Status AJCFG_GetConfigurationsHandler(AJ_Message* msg)
{
    AJ_Status status = AJ_OK;
    AJ_Message reply;
    char* language;
    int8_t langIndex = AJSVC_PROPERTY_STORE_ERROR_LANGUAGE_INDEX;
    AJSVC_PropertyStoreCategoryFilter filter;

    AJ_InfoPrintf(("Handling GetConfigurations request\n"));

    memset(&filter, 0, sizeof(AJSVC_PropertyStoreCategoryFilter));
    filter.bit1Config = TRUE;
    status = AJ_UnmarshalArgs(msg, "s", &language);
    if (status != AJ_OK) {
        return status;
    }
    if (AJSVC_IsLanguageSupported(msg, &reply, language, &langIndex)) {
        status = AJ_MarshalReplyMsg(msg, &reply);
        if (status != AJ_OK) {
            return status;
        }
        status = AJSVC_PropertyStore_ReadAll(&reply, filter, langIndex);
        if (status != AJ_OK) {
            return status;
        }
    }
    status = AJ_DeliverMsg(&reply);
    if (status != AJ_OK) {
        return status;
    }

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

示例15: AJSUSI_VgaGetBacklightBrightness_Handler

AJ_Status AJSUSI_VgaGetBacklightBrightness_Handler(AJ_Message* msg)
{
    AJ_Status status = AJ_OK;
    AJ_Message reply;
    AJ_Arg replyArg;
    uint32_t id, bright;

    //Get Args
    status = AJ_UnmarshalArgs(msg, "u", &id);
    if (status != AJ_OK) {
        return status;
    }
    AJ_InfoPrintf(("%s : id=%d\n", __func__, id));

    //SUSI API
    if (AJ_SusiVgaGetBacklightBrightness(id, &bright)) {
        AJ_MarshalErrorMsg(msg, &reply, AJ_ErrFeatureNotAvailable);
        return AJ_DeliverMsg(&reply);
    }

    //Status Reply
    AJ_InfoPrintf(("%s : ret=0x%x\n", __func__, bright));
    AJ_InitArg(&replyArg, AJ_ARG_UINT32, 0, &bright, 0);
    return SendReplyMsg(msg, &replyArg);
}
开发者ID:ADVANTECH-Corp,项目名称:AlljoynSusiService,代码行数:25,代码来源:SusiVGA.c


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