Page 1 of 1

Managing multiple USB-UIRT in c#

PostPosted: Thu Feb 09, 2006 3:44 pm
by thibault2405
Hello,

Is anybody succeded in the way of managing multiple USB-UIRT with the managed Wrapper in c#, or the DLL in Visual Basic ?

If so, I would be interested to know how to.

Regards.

Thibault.

I have the code in c++ but don't know how to write it in C# or VB.

UUIRTDRV_API HUUHANDLE PASCAL UUIRTOpenEx(char *devName, DWORD dwFlagsAndAttributes, void *reserved0, void *reserved1);

typedef HUUHANDLE (WINAPI *pfn_UUIRTOpenEx) (char *devName, DWORD dwFlagsAndAttributes, void *reserved0, void *reserved1);


Handle = UUIRTOpenEx("USB-UIRT", 0, NULL, NULL); for the normal unit

Handle2 = UUIRTOpenEx("USB-UIRT-2", 0, NULL, NULL); for the second unit, Etc

PostPosted: Fri Feb 15, 2008 3:54 pm
by avalanche333
Can anyone confirm that the C++ code posted below works?

I am trying the following and it is still sending to all IR Blasters:

Code: Select all
JNIEXPORT jboolean JNICALL Java_com_tvworks_tools_PersonalKeyserver_IR_USBUIRTCommunicator_transmitIREx( JNIEnv *env, jobject obj, jstring irCode, jstring deviceName )
{
   jboolean      retVal= JNI_FALSE;
   if (hinstLib != NULL)
   {
      /* Convert to a usable C string */
      char *pIRCode = (char*) (*env).GetStringUTFChars( irCode, 0 );
      char *pDeviceName = (char*) (*env).GetStringUTFChars( deviceName, 0 );
      if( pIRCode != NULL ) {
         HUUHANDLE handle = fnUUIRTOpenEx(pDeviceName, 0, NULL, NULL);
         BOOL bTransmitOK = fn_UUIRTTransmitIR(handle, pIRCode, UUIRTDRV_IRFMT_PRONTO, 1, 0, NULL, NULL, NULL);
         if (bTransmitOK) {
            retVal = JNI_TRUE;                                                 
         }
         fnUUIRTClose(handle);
      }                                                                           

      /* Free as a bird.... */                                               
      (*env).ReleaseStringUTFChars( irCode, pIRCode );
      (*env).ReleaseStringUTFChars( deviceName, pDeviceName);
   }                                                                             
   return retVal;                                                               
}
[/code]

PostPosted: Fri Feb 15, 2008 4:05 pm
by avalanche333
My bad, this does actually work. Because the IR blasters were so close to each other, one blaster was picking up the signal of the other and flashing. Once I moved them far enough apart I could see it working properly.