Results 1 to 3 of 3

Thread: Infra red remote controll?

  1. #1

    Thread Starter
    Frenzied Member Ultimasnake's Avatar
    Join Date
    Feb 2002
    Location
    Amsterdam, holland
    Posts
    1,172

    Infra red remote controll?

    How can i use my infrared remote controll in my application?

    my infra red device is not connected to a com-port but to my Medion Tv-Radio card (a MD2819 TV-card equipted with a phillips 7134 chipset (or so))
    For my PC and MS Smartphone 2003 software visit
    http://www.ultimasoftware.nl

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    You are going to have to get with the manufacturer and get an API for your hardware, or instructions from them on how to integrate with the hardware.

  3. #3

    Thread Starter
    Frenzied Member Ultimasnake's Avatar
    Join Date
    Feb 2002
    Location
    Amsterdam, holland
    Posts
    1,172
    well there seems to be an public api for this or so.. this C code can read button presses (i guess not sure though) but its written in c(++) can somebody convert this to vb? :S


    VB Code:
    1. //AVerTV Studio Girder plugin by Pavel Chromy
    2. //based on plugin written by Michal Milczewski
    3.  
    4. #include <stdio.h>
    5. #include <windows.h>
    6. #include <winuser.h>
    7. #include "girder.h"
    8. #pragma argsused
    9.  
    10. #define AVERDEVICENUM 28
    11. #define INT_POLE 100 //Remote Poling Interval (ms)
    12.  
    13. typedef void __cdecl (CALLBACK *THWInit)(void);
    14. typedef int  __cdecl (CALLBACK *TGetRemoteData)(void);
    15. //typedef void __cdecl (CALLBACK *TSetRemoteData)(int);
    16. //typedef int  __cdecl (CALLBACK *TGetRemoteFlag)(void);
    17. //typedef void __cdecl (CALLBACK *TSetRemoteFlag)(int);
    18. //typedef int  __cdecl (CALLBACK *TIsRemoteDataReady)(void);
    19.  
    20. #pragma data_seg(".SHARDATA")
    21. static HINSTANCE DllH = NULL;
    22. static THWInit HWInit;
    23. static TGetRemoteData GetRemoteData;
    24. //static TSetRemoteData SetRemoteData;
    25. //static TGetRemoteFlag GetRemoteFlag;
    26. //static TSetRemoteFlag SetRemoteFlag;
    27. //static TIsRemoteDataReady IsRemoteDataReady;
    28. #pragma data_seg()
    29.  
    30. int PoleTimer=0;
    31. bool IsDriverOK = false;
    32.  
    33. t_functions gir_sf;
    34.  
    35. VOID CALLBACK TimerProc(HWND hwnd,UINT uMsg,UINT idEvent,DWORD dwTime);
    36.  
    37. /*=========================================================*/
    38.  
    39. bool LoadDll(HINSTANCE &DllH)
    40. {
    41.   CoInitialize(NULL);
    42.  
    43.   DllH=LoadLibrary("averapi.dll"); // try to load "averapi.dll" - win2k/me
    44.  
    45.  
    46.   if (DllH==NULL) {
    47.     MessageBox(GetForegroundWindow(),"The 'averapi.dll' library can't be found.\nYou have to install Medion software first.","Medion Girder plugin error",MB_OK | MB_ICONHAND| MB_SYSTEMMODAL);
    48.     return false;
    49.   }
    50.   HWInit=(THWInit)GetProcAddress(DllH, "AVER_HWInit");
    51.   GetRemoteData=(TGetRemoteData)GetProcAddress(DllH, "AVER_GetRemoteData");
    52.   //SetRemoteData=(TSetRemoteData)GetProcAddress(DllH, "AVER_SetRemoteData");
    53.   //GetRemoteFlag=(TGetRemoteFlag)GetProcAddress(DllH, "AVER_GetRemoteFlag");
    54.   //SetRemoteFlag=(TSetRemoteFlag)GetProcAddress(DllH, "AVER_SetRemoteFlag");
    55.   //IsRemoteDataReady=(TIsRemoteDataReady)GetProcAddress(DllH, "AVER_IsRemoteDataReady");
    56.  
    57.   if (!HWInit || !GetRemoteData) {
    58.     MessageBox(GetForegroundWindow(),"Error during importing functions from Medion library.","Medion Girder plugin error",MB_OK | MB_ICONHAND| MB_SYSTEMMODAL);
    59.     return false;
    60.   }
    61.  
    62.   // hardware init
    63.   HWInit(); //it takes a while with win9x drivers
    64.     return true;
    65. }
    66.  
    67. bool  UnloadDll(HINSTANCE &DllH)
    68. {
    69.   CoUninitialize();
    70.   bool result = FreeLibrary(DllH);
    71.   DllH = NULL;
    72.    return result;
    73. }
    74.                          
    75.    void StartTimer(int msec)
    76. {
    77.      if (PoleTimer) KillTimer(NULL,PoleTimer);
    78.   PoleTimer=SetTimer(NULL,0,msec,(int(__stdcall *)())TimerProc);
    79.   }
    80.  
    81. void StopTimer(void)
    82. {
    83.   if (PoleTimer) {
    84.     KillTimer(NULL,PoleTimer);
    85.     PoleTimer=0;
    86.   }
    87. }
    88.  
    89. void SendKey(int key)
    90. {
    91.     char payload='\0';
    92.     char eventstr[16];
    93.     sprintf(eventstr,"AVER_%02X",key);
    94.     gir_sf.send_event(eventstr,&payload,1,AVERDEVICENUM);
    95. }
    96.  
    97. VOID CALLBACK TimerProc(HWND hwnd,UINT uMsg,UINT idEvent,DWORD dwTime)
    98. {
    99.   static int key;
    100.  
    101.   //AVerTV Studio - the IsRemoteDataReady() function does not behave as expected
    102.   if ((key=GetRemoteData())&2) {
    103.             SendKey(key);
    104.   }
    105. }
    106.  
    107. //grinder callings
    108. /*=========================================================*/
    109.  
    110. extern "C" __declspec(dllexport) void CALLBACK gir_version(char *data, int size)
    111. {
    112.   strncpy(data,"2.0",size);
    113. }
    114.  
    115.  
    116. extern "C" __declspec(dllexport) void CALLBACK gir_name(char *data, int size)
    117. {
    118.   strncpy(data,"Medion remote controler",size);
    119. }
    120.  
    121.  
    122. extern "C" __declspec(dllexport) void CALLBACK gir_description(char *data, int size)
    123. {
    124.   strncpy(data,"Captures IR events from medion md2819",size);
    125. }
    126.  
    127.  
    128. extern "C" __declspec(dllexport) int CALLBACK gir_devicenum()
    129. {
    130.   return AVERDEVICENUM;
    131. }
    132.  
    133.  
    134. extern "C" __declspec(dllexport) int CALLBACK gir_requested_api(int max_api)
    135. {
    136.   return 1;
    137. }
    138.  
    139.  
    140. extern "C" __declspec(dllexport) int CALLBACK gir_open
    141.   (int gir_major_ver, int gir_minor_ver, int gir_micro_ver, p_functions p)
    142. {
    143.   if (p->size!=sizeof(s_functions))
    144.     return GIR_FALSE;
    145.  
    146.   memcpy((void *)(&gir_sf), p, sizeof(s_functions));
    147.  
    148.          if (IsDriverOK=LoadDll(DllH))  return GIR_TRUE;
    149.           return GIR_FALSE;
    150. }
    151.  
    152.  
    153. extern "C" __declspec(dllexport) int CALLBACK gir_close()
    154. {
    155.   UnloadDll(DllH);
    156.   return GIR_TRUE;
    157. }
    158.  
    159.  
    160. extern "C" __declspec(dllexport) int CALLBACK gir_start()
    161. {
    162.   if (!IsDriverOK) return GIR_FALSE;
    163.  
    164.   StartTimer(INT_POLE);
    165.   return GIR_TRUE;
    166. }
    167.  
    168.  
    169. extern "C" __declspec(dllexport) int CALLBACK gir_stop()
    170. {
    171.   if (!IsDriverOK) return GIR_FALSE;
    172.  
    173.   StopTimer();
    174.   return GIR_TRUE;
    175. }
    176.  
    177. /*=========================================================*/

    For my PC and MS Smartphone 2003 software visit
    http://www.ultimasoftware.nl

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width