Пример #1
0
JNIEXPORT jboolean JNICALL Java_com_alecive_yarpdroid_yarpviewFragment_createBufferedImgPortL
  (JNIEnv *env, jobject obj, jstring _applicationName)
{
    __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, "I'm creating the image port");
    if (putenv("YARP_CONF=/data/data/com.alecive.yarpdroid/files/yarpconf"))
    {
        __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Putenv failed %d", errno);
    }

    DataProcessorImg* processor = new DataProcessorImg(env, javaObj);
    BufferedPort<ImageOf<PixelRgb> > *ImgPortL;
    ImgPortL = new BufferedPort<ImageOf<PixelRgb> >;
    ImgPortL->useCallback(*processor);

    std::string portName=env->GetStringUTFChars(_applicationName, 0);
    portName = portName + "/cam/left:i";
    if(!ImgPortL->open(portName.c_str()))
    {
        __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, "Error in opening image port!");
        delete ImgPortL;
        ImgPortL = 0;
        return (jboolean)false;
    }

    setHandle(env, javaObj, ImgPortL, "viewLeftHandle");
    return (jboolean)true;
}
Пример #2
0
 Echo() : mutex(1) {
     put = NULL;
     port.useCallback(*this);
     port.setStrict();
     muted = false;
     saving = false;
     samples = 0;
     channels = 0;
     put = NULL;
 }
Пример #3
0
int main() {
    Network yarp;
    
    DataProcessor processor;
    BufferedPort<Bottle> p;
    p.useCallback(processor);  // input should go to processor.onRead()
    p.open("/in");          // Give it a name on the network.
    while (true) {
        printf("main thread free to do whatever it wants\n");
        Time::delay(10);
    }
    
    return 0;
}
Пример #4
0
 virtual void testReaderHandler2() {
     report(0,"check reader handler, bufferedport style...");
     BufferedPort<Bottle> in;
     Port out;
     DelegatedCallback callback;
     in.setStrict();
     out.open("/out");
     in.open("/in");
     Network::connect("/out","/in");
     in.useCallback(callback);
     Bottle src("10 10 20");
     out.write(src);
     callback.produce.wait();
     checkEqual(callback.saved.size(),3,"object came through");
     in.disableCallback();
 }