【问题标题】:How to implement the DoPair method under google tv pairing protocol by C++C++如何在google tv配对协议下实现DoPair方法
【发布时间】:2013-04-30 01:57:06
【问题描述】:

有两种程序语言可以实现谷歌电视配对协议库:

  1. JAVA版本
  2. C++ 版本

我正在执行配对程序的连接任务。我找到了一些 JAVA 示例代码来调用配对库,就像 here 一样。

上述链接代码中'attemptToPair'方法下的定义:

PoloWireInterface protocol = 
              WireFormat.PROTOCOL_BUFFERS.getWireInterface(context);

我不知道如何通过调用C++版本库来实现这个定义。

因为'PoloWireInterface'类只是C++版本库下的一个抽象类。

此外,没有任何其他类扩展此库下的 PoloWireInterface。 (查看here

没有 PoloWireInterface 实例,我无法建立“ClientPairingSession”实例。


我的客户端部分配对任务如下代码,但它不起作用:'(

using namespace polo::pairing;

using namespace polo::wire;

using namespace polo::encoding;

X509* peer_cert = // peer side certificate, load by openssl

X509* local_cert = // local side certificate,  generate by openssl

PairingContext* context;

context = new PairingContext(local_cert,peer_cert,false);

// CPoloWireInterface extends abstract class PoloWireInterface
PoloWireInterface* protocol = new CPoloWireInterface(); 

PoloWireAdapter* wire = new protobuf::ProtobufWireAdapter(protocol);

PoloChallengeResponse* challenge;

challenge = new PoloChallengeResponse(local_cert,peer_cert);

ClientPairingSession* mClientPairingSession;

mClientPairingSession = new ClientPairingSession
    (wire, context, challenge, service_name, "AnyMote");

EncodingOption hexEnc(EncodingOption::kHexadecimal, 4);

mClientPairingSession->AddInputEncoding(hexEnc);

mClientPairingSession->AddOutputEncoding(hexEnc);

// CPairingListener extends abstract class PairingListener
PairingListener* listener = new CPairingListener(); 

mClientPairingSession->DoPair(listener);

【问题讨论】:

    标签: google-tv


    【解决方案1】:

    您不会在 java 和 c++ 库之间找到完全匹配的库。 您应该尝试使用本教程来使用 c++ 库:

    https://google-tv-chrome-extensions.googlecode.com/git/LearningExerciseInstructions/instructions.html

    【讨论】:

    • 你的意思是我不能直接调用google配对的库,因为它还没有准备好?我发现“google-tv-chrome-extension”的 API 与“google-tv-pairing-protocol”不同。我可以在“google-tv-chrome-extension”项目下获得 Anymote 库的源代码吗?我想重写一些配对任务的功能。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多