예제 #1
0
void MyService::getStreamIdList(::google::protobuf::RpcController* controller,
    const ::OstProto::PortId* request,
    ::OstProto::StreamIdList* response,
    ::google::protobuf::Closure* done)
{
    int portId;

    qDebug("In %s", __PRETTY_FUNCTION__);

    portId = request->id();
    if ((portId < 0) || (portId >= portInfo.size()))
        goto _invalid_port;

    response->mutable_port_id()->set_id(portId);
    portLock[portId]->lockForRead();
    for (int i = 0; i < portInfo[portId]->streamCount(); i++)
    {
        OstProto::StreamId    *s;

        s = response->add_stream_id();
        s->set_id(portInfo[portId]->streamAtIndex(i)->id());
    }
    portLock[portId]->unlock();

    done->Run();
    return;

_invalid_port:
    controller->SetFailed("Invalid Port Id");
    done->Run();
}
예제 #2
0
void Port::getDeletedStreamsSinceLastSync(
    OstProto::StreamIdList &streamIdList)
{
    streamIdList.clear_stream_id();
    for (int i = 0; i < mLastSyncStreamList.size(); i++)
    {
        int j;

        for (j = 0; j < mStreams.size(); j++)
        {
            if (mLastSyncStreamList[i] == mStreams[j]->id())
                break;
        }

        if (j < mStreams.size())
        {
            // stream still exists!
            continue;
        }    
        else
        {
            // stream has been deleted since last sync
            OstProto::StreamId    *s;

            s = streamIdList.add_stream_id();
            s->set_id(mLastSyncStreamList.at(i));
        }
    }
}
예제 #3
0
void Port::getNewStreamsSinceLastSync(
    OstProto::StreamIdList &streamIdList)
{
    streamIdList.clear_stream_id();
    for (int i = 0; i < mStreams.size(); i++)
    {
        if (mLastSyncStreamList.contains(mStreams[i]->id()))
        {
            // existing stream!
            continue;
        }
        else
        {
            // new stream!
            OstProto::StreamId    *s;

            s = streamIdList.add_stream_id();
            s->set_id(mStreams[i]->id());
        }
    }
}
예제 #4
0
void PortGroup::getStreamConfigList()
{
    qDebug("requesting stream config list ...");

    for (int portIndex = 0; portIndex < numPorts(); portIndex++)
    {
        OstProto::StreamIdList *streamIdList = new OstProto::StreamIdList;
        OstProto::StreamConfigList *streamConfigList 
                = new OstProto::StreamConfigList;
        PbRpcController *controller = new PbRpcController(
                streamIdList, streamConfigList);

        streamIdList->mutable_port_id()->set_id(mPorts[portIndex]->id());
        for (int j = 0; j < mPorts[portIndex]->numStreams(); j++)
        {
            OstProto::StreamId *s = streamIdList->add_stream_id();
            s->set_id(mPorts[portIndex]->streamByIndex(j)->id());
        }

        serviceStub->getStreamConfig(controller, streamIdList, streamConfigList,
                NewCallback(this, &PortGroup::processStreamConfigList, 
                    portIndex, controller));
    }
}