Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 #ifdef LINUX
00029 typedef int SOCKET;
00030 typedef int WSAEVENT;
00031 #endif
00032 
00033 
00034 #define PROTOCOL_VERSION        209
00035 
00036 #define MAX_IR_DEVICES  256
00037 
00038 
00039 #define COMMAND_SEND            1
00040 #define COMMAND_LRNREM          2
00041 #define COMMAND_LRNTIM          3
00042 #define COMMAND_LRNCOM          4
00043 #define COMMAND_CLOSE           5
00044 #define COMMAND_STATUS          6
00045 #define COMMAND_RESEND          7
00046 #define COMMAND_LRNRAW          8
00047 #define COMMAND_LRNRPT          9
00048 #define COMMAND_LRNTOG          10
00049 #define COMMAND_SETSTAT         11
00050 #define COMMAND_LRNLONG         12
00051 #define COMMAND_LRNRAWRPT       13
00052 #define COMMAND_RELOAD          14
00053 #define COMMAND_LCD                     15
00054 #define COMMAND_LEARNSTAT       16
00055 #define COMMAND_TEMP            17
00056 #define COMMAND_GETREMOTES      18
00057 #define COMMAND_GETCOMMANDS     19
00058 #define COMMAND_STORETRANS      20
00059 #define COMMAND_LOADTRANS       21
00060 #define COMMAND_SAVETRANS       22
00061 #define COMMAND_FLASHTRANS      23
00062 #define COMMAND_FUNCTIONS       24
00063 #define COMMAND_TESTCOM         25
00064 #define COMMAND_LONGSEND        26
00065 #define COMMAND_SHUTDOWN        27
00066 #define COMMAND_SENDCCF         28
00067 #define COMMAND_LCDINIT         29
00068 #define COMMAND_SETSWITCH       30
00069 #define COMMAND_STATUSEX        31
00070 #define COMMAND_RESET           32
00071 #define COMMAND_DEVICEDATA      33
00072 #define COMMAND_STARTCLOCK      34
00073 #define COMMAND_LCDSTATUS       35
00074 #define COMMAND_FUNCTIONEX      36
00075 #define COMMAND_MCE_CHARS       37
00076 #define COMMAND_SUSPEND         38
00077 #define COMMAND_RESUME          39
00078 #define COMMAND_DELETECOM       40
00079 #define COMMAND_EMPTY           41
00080 #define COMMAND_SETSTAT2        42
00081 #define COMMAND_STATUSEXN       43
00082 #define COMMAND_BRIGHTNESS      44
00083 #define COMMAND_DEFINECHAR      45
00084 #define COMMAND_STOREIRDB       46
00085 #define COMMAND_FLASHIRDB       47
00086 #define COMMAND_SAVEIRDB        48
00087 #define COMMAND_LOADIRDB        49
00088 #define COMMAND_LED                     50
00089 #define COMMAND_TRANSFILE       51
00090 #define COMMAND_IRDBFILE        52
00091 #define COMMAND_LISTBUS         53
00092 #define COMMAND_SENDCCFSTR      54
00093 #define COMMAND_LEARNDIRECT     55
00094 #define COMMAND_TESTCOMEX       56
00095 #define COMMAND_SENDCCFSTRS     57
00096 #define COMMAND_SETSTATEX       58
00097 #define COMMAND_DELETEREM       59
00098 #define COMMAND_READ_ANALOG 60
00099 #define COMMAND_RS232_SEND      61
00100 #define COMMAND_SENDCCFLONG     62
00101 #define COMMAND_STORETIMER      63
00102 #define COMMAND_LOADIRDBFILE    64
00103 #define COMMAND_ASCII           65
00104 #define COMMAND_LRNREMEX        66
00105 #define COMMAND_CLIENTLOG       67
00106 #define COMMAND_LEARNCCF        68
00107 #define COMMAND_STATUSEX2       69
00108 #define COMMAND_SETSTATEX2      70
00109 #define COMMAND_SENDSTRING      's' // 115
00110 
00111 
00112 
00113 
00114 #define STATUS_MESSAGE                  1
00115 #define STATUS_TIMING                   2
00116 #define STATUS_DEVICEMODE               3
00117 #define STATUS_RECEIVE                  4
00118 #define STATUS_LEARN                    5
00119 #define STATUS_REMOTELIST               6
00120 #define STATUS_COMMANDLIST              7
00121 #define STATUS_TRANSLATE                8
00122 #define STATUS_FUNCTION                 9
00123 #define STATUS_DEVICEMODEEX             10
00124 #define STATUS_DEVICEDATA               11
00125 #define STATUS_LCDDATA                  12
00126 #define STATUS_FUNCTIONEX               13
00127 #define STATUS_DEVICEMODEEXN    14
00128 #define STATUS_IRDB                             15
00129 #define STATUS_TRANSLATIONFILE  16
00130 #define STATUS_IRDBFILE                 17
00131 #define STATUS_BUSLIST                  18
00132 #define STATUS_LEARNDIRECT              19
00133 #define STATUS_IRDBFLASH                20
00134 #define STATUS_ANALOGINPUT              21
00135 #define STATUS_RECEIVE_ASCII    22
00136 #define STATUS_LOG                              23
00137 #define STATUS_DEVICEMODEEX2    24
00138 
00139 #define STATUS_ASCII                    65
00140 
00141 #define FILE_MODE_SAVE                  0
00142 #define FILE_MODE_SAVEAS                1
00143 #define FILE_MODE_OVERWRITE             2
00144 
00145 
00146 #pragma pack(1)
00147 
00148 typedef struct {
00149         uint32_t clientid;
00150         int16_t statuslen;
00151         int16_t statustype;
00152         int16_t adress;
00153     uint8_t align[2];
00154         IRDATA ird;
00155 } IRDATA_BUFFER;
00156 
00157 typedef struct {
00158         uint8_t mode;
00159         uint8_t time_cnt;
00160         uint8_t ir_repeat;
00161         uint8_t repeat_pause;
00162         uint16_t pause_len[TIME_LEN];
00163         uint16_t pulse_len[TIME_LEN];
00164         uint8_t data[CODE_LEN];
00165 } TIMINGDATA;
00166 
00167 typedef struct {
00168         uint8_t netcommand;
00169         uint8_t mode;
00170         uint16_t timeout;
00171         int32_t adress;
00172         int8_t remote[80];
00173         int8_t command[20];
00174         uint8_t trasmit_freq;
00175 } OLD_NETWORKCOMMAND;
00176 
00177 
00178 typedef struct {
00179         uint8_t netcommand;
00180         uint8_t mode;
00181         uint8_t lcdcommand;
00182         uint8_t timeout;
00183         int32_t adress;
00184         uint8_t wid;
00185         uint8_t hgt;
00186         int8_t framebuffer[200];
00187 } OLD_LCDCOMMAND;
00188 
00189 
00190 typedef struct {
00191         uint8_t netcommand;
00192         uint8_t mode;
00193         uint16_t timeout;
00194         int32_t adress;
00195         int32_t protocol_version;
00196         int8_t remote[80];
00197         int8_t command[20];
00198         uint8_t trasmit_freq;
00199 } NETWORKCOMMAND;
00200 
00201 typedef struct {
00202         uint8_t netcommand;
00203         uint8_t mode;
00204         uint16_t timeout;
00205         int32_t adress;
00206         int32_t protocol_version;
00207         int8_t remote[80];
00208         int8_t command[20];
00209         int8_t ccf_data[5400];
00210 } CCFLEARNCOMMAND;
00211 
00212 
00213 typedef struct {
00214         uint8_t netcommand;
00215         uint8_t mode;
00216         uint16_t timeout;
00217         int32_t adress;
00218         int32_t protocol_version;
00219         uint8_t num;
00220         uint8_t tim_mode;
00221     uint8_t status;
00222     uint8_t year;
00223     uint8_t month;
00224     uint8_t day;
00225     uint8_t hour;
00226     uint8_t min;
00227     uint8_t weekday;
00228         uint8_t remote[81];
00229         uint8_t ircommand[21];
00230         uint8_t ledselect;
00231         uint16_t targetmask;
00232 } TIMERCOMMAND;
00233 
00234 typedef struct {
00235         uint8_t         netcommand;
00236         uint8_t         mode;
00237         uint16_t        timeout;
00238         int32_t         adress;
00239         int32_t         protocol_version;
00240         int8_t          hotremote[80];
00241         int8_t          hotcommand[20];
00242         int8_t          hotremote_2[80];
00243         int8_t          hotcommand_2[20];
00244         int32_t         targetmask;
00245         uint8_t         extmode;
00246         uint8_t         extmode_2;
00247         uint8_t         extmode_3;
00248         uint8_t         extmode_4;
00249         uint8_t         wakeup_mac[6];
00250 } MODUSCOMMAND;
00251 
00252 typedef struct {
00253         uint8_t         netcommand;
00254         uint8_t         mode;
00255         uint16_t        timeout;
00256         int32_t         adress;
00257         int32_t         protocol_version;
00258         int8_t          hotremote[80];
00259         int8_t          hotcommand[20];
00260         int8_t          hotremote_2[80];
00261         int8_t          hotcommand_2[20];
00262         int32_t         targetmask;
00263         uint8_t         extmode;
00264         uint8_t         extmode_2;
00265         uint8_t         wakeup_mac[6];
00266         uint8_t         extmode_ex[8];
00267 } MODUSCOMMAND_EX;
00268 
00269 
00270 
00271 
00272 
00273 
00274 
00275 
00276 
00277 
00278 
00279 
00280 
00281 
00282 
00283 
00284 
00285 
00286 typedef struct {
00287         uint32_t        clientid;
00288         int16_t         statuslen;
00289         int16_t         statustype;
00290         int8_t          memsize[32];
00291         int8_t          flashsize[8];
00292         int8_t          remotes[8];
00293         int8_t          commands[8];
00294         int8_t          actions[8];
00295 } IRDB_FLASHINFO;
00296 
00297 
00298 typedef struct {
00299         uint8_t netcommand;
00300         uint8_t mode;
00301         uint16_t timeout;
00302         int32_t adress;
00303         int32_t protocol_version;
00304         uint8_t len;
00305         uint8_t align;
00306         uint16_t align2;
00307         uint8_t data[256];
00308 } SERCOMMAND;
00309 
00310 
00311 typedef struct {
00312         uint8_t netcommand;
00313         uint8_t mode;
00314         uint16_t timeout;
00315         int32_t adress;
00316         int32_t protocol_version;
00317         uint16_t ccf_data[256];
00318 } CCFCOMMAND;
00319 
00320 typedef struct {
00321         uint8_t netcommand;
00322         uint8_t mode;
00323         uint16_t timeout;
00324         int32_t adress;
00325         int32_t protocol_version;
00326         uint16_t ccf_data[450];
00327 } LONGCCFCOMMAND;
00328 
00329 
00330 typedef struct {
00331         uint8_t netcommand;
00332         uint8_t mode;
00333         uint16_t timeout;
00334         int32_t adress;
00335         int32_t protocol_version;
00336         char ccf_data[1100];
00337         byte repeatmode;
00338 } CCFSTRINGCOMMAND;
00339 
00340 typedef struct {
00341         uint8_t netcommand;
00342         uint8_t mode;
00343         uint16_t timeout;
00344         int32_t adress;
00345         int32_t protocol_version;
00346         char ccf_data[980];
00347         byte repeatmode;
00348 } CCFSTRINGCOMMAND_SHORT;
00349 
00350 
00351 typedef struct {
00352         uint8_t netcommand;
00353         uint8_t mode;
00354         uint8_t lcdcommand;
00355         uint8_t timeout;
00356         int32_t adress;
00357         int32_t protocol_version;
00358         uint8_t wid;
00359         uint8_t hgt;
00360         int8_t framebuffer[200];
00361 } LCDCOMMAND;
00362 
00363 
00364 typedef struct {
00365         uint8_t netcommand;
00366         uint8_t mode;
00367         uint16_t timeout;
00368         int32_t adress;
00369         int32_t protocol_version;
00370         int32_t number;
00371         uint8_t setup;
00372         uint8_t type;
00373         uint8_t accelerator_timeout;
00374         uint8_t accelerator_repeat;
00375     uint16_t wait_timeout;
00376     uint8_t remote_num;
00377     uint8_t group_num;
00378         int8_t remote[80];
00379         int8_t command[20];
00380         int32_t source_mask;
00381         int32_t target_mask;
00382     uint8_t multi_num;
00383     uint8_t include_names;
00384         uint8_t dummy[2];
00385 } TRANSLATECOMMAND;
00386 
00387 
00388 typedef struct {
00389     int32_t send_mask;
00390     uint8_t device_mode;
00391     uint8_t extended_mode;
00392     uint8_t extended_mode2;
00393     uint8_t align;
00394         uint16_t switch_mode;
00395     uint16_t align2;
00396         uint32_t features;
00397     uint16_t align3;
00398     int8_t version[10];
00399         int8_t remote[80];
00400         int8_t command[20];
00401 } MODELINE;
00402 
00403 typedef struct {
00404     int32_t send_mask;
00405     uint8_t device_mode;
00406     uint8_t extended_mode;
00407     uint8_t extended_mode2;
00408     uint8_t align;
00409         uint16_t switch_mode;
00410     uint16_t switch_mode2;
00411         uint32_t features;
00412     uint8_t extended_mode3;
00413     uint8_t extended_mode4;
00414     int8_t version[10];
00415         int8_t remote[80];
00416         int8_t command[20];
00417         int8_t remote2[80];
00418         int8_t command2[20];
00419 } MODELINEN;
00420 
00421 typedef struct {
00422     int32_t send_mask;                                  
00423     uint8_t device_mode;                                
00424     uint8_t extended_mode;                              
00425     uint8_t extended_mode2;                             
00426     uint8_t align;                                              
00427         uint16_t switch_mode;                           
00428     uint16_t switch_mode2;                              
00429         uint32_t features;                                      
00430         uint32_t features2;                                     
00431         uint32_t features3;                                     
00432         uint32_t features4;                                     
00433     uint8_t extended_mode_ex[8];                
00434     int8_t version[10];                                 
00435         int8_t remote[80];                                      
00436         int8_t command[20];                                     
00437         int8_t remote2[80];                                     
00438         int8_t command2[20];                            
00439         uint8_t align2[2];                                      
00440 } MODELINEEX;                                                   
00441 
00442 typedef struct {
00443         uint32_t clientid;
00444         int16_t statuslen;
00445         int16_t statustype;
00446         int16_t adress;
00447     uint8_t align[2];
00448         int8_t data[32768];
00449 } STATUSBUFFER;
00450 
00451 typedef struct {
00452         uint32_t clientid;
00453         int16_t statuslen;
00454         int16_t statustype;
00455         int16_t adress;
00456     uint8_t align[2];
00457         int8_t data[256];
00458 } DATABUFFER;
00459 
00460 typedef struct {
00461         uint32_t clientid;
00462         int16_t statuslen;
00463         int16_t statustype;
00464         int32_t serno;
00465         int32_t functions;
00466 } FUNCTIONBUFFER;
00467 
00468 typedef struct {
00469         uint32_t clientid;
00470         int16_t statuslen;
00471         int16_t statustype;
00472         ANALOG_INPUTS inputs;
00473 
00474 } ANALOGBUFFER;
00475 
00476 typedef struct {
00477         uint32_t clientid;
00478         int16_t statuslen;
00479         int16_t statustype;
00480         int32_t serno;
00481         int32_t functions;
00482         int8_t version[8];
00483 } FUNCTIONBUFFEREX;
00484 
00485 
00486 
00487 
00488 
00489 
00490 
00491 
00492 
00493 typedef struct {
00494         uint32_t clientid;
00495         int16_t statuslen;
00496         int16_t statustype;
00497     int16_t offset;
00498     int16_t count_buffer;
00499         int16_t count_total;
00500         int16_t count_remaining;
00501         REMOTELINE remotes[40];
00502 } REMOTEBUFFER;
00503 
00504 typedef struct {
00505         uint32_t clientid;
00506         int16_t statuslen;
00507         int16_t statustype;
00508     int16_t offset;
00509     int16_t count_buffer;
00510         int16_t count_total;
00511         int16_t count_remaining;
00512         BUSLINE bus[40];
00513 } BUSBUFFER;
00514 
00515 typedef struct {
00516         uint32_t clientid;
00517         int16_t statuslen;
00518         int16_t statustype;
00519     int16_t offset;
00520     int16_t count_buffer;
00521         int16_t count_total;
00522         int16_t count_remaining;
00523         int8_t commands[200][20];
00524 } COMMANDBUFFER;
00525 
00526 typedef struct {
00527         uint32_t clientid;
00528         int16_t statuslen;
00529         int16_t statustype;
00530     int16_t offset;
00531     int16_t count_buffer;
00532         int16_t count_total;
00533         int16_t count_remaining;
00534         TRANSLATECOMMAND trdata[30];
00535 } TRANSLATEBUFFER;
00536 
00537 
00538 typedef struct {
00539         uint8_t netcommand;                                     
00540         uint8_t mode;                                           
00541         uint16_t timeout;                                       
00542         int32_t adress;                                         
00543         int32_t protocol_version;                       
00544         int32_t number;                                         
00545         uint8_t relais;                                         
00546         uint8_t type;                                           
00547         uint8_t action_type;                            
00548         uint8_t action_len;                                     
00549         int32_t remote_num;                                     
00550         int32_t command_num;                            
00551         uint32_t ip;                                            
00552         uint16_t port;                                          
00553         uint16_t align;                                         
00554         int8_t remote[80];                                      
00555         int8_t command[20];                                     
00556         uint8_t action[256];                            
00557 } IRDBCOMMAND;                                                  
00558 
00559 typedef struct {
00560         uint8_t netcommand;                                     
00561         uint8_t mode;                                           
00562         uint16_t timeout;                                       
00563         int32_t adress;                                         
00564         int32_t protocol_version;                       
00565         int32_t number;                                         
00566         uint8_t active;                                         
00567         uint8_t type;                                           
00568         word    port;                                           
00569         uint8_t default_action[100];            
00570         uint8_t err_status[20];                         
00571         uint8_t ok_status[20];                          
00572         uint8_t inputmode[4];                           
00573         uint8_t min[4];                                         
00574         uint8_t max[4];                                         
00575         uint8_t hyst[4];                                        
00576         uint8_t minledsel[4];                           
00577         uint8_t maxledsel[4];                           
00578         int32_t minmask[4];                                     
00579         int32_t maxmask[4];                                     
00580         int8_t minremote[4][80];                        
00581         int8_t mincommand[4][50];                       
00582         int8_t maxremote[4][80];                        
00583         int8_t maxcommand[4][50];                       
00584         uint32_t ip;                                            
00585         uint8_t rs232_config[4];                        
00586 } IRDBHEADER;                                                   
00587 
00588 
00589 
00590 typedef struct {
00591         uint32_t clientid;
00592         int16_t statuslen;
00593         int16_t statustype;
00594     int16_t offset;
00595     int16_t count_buffer;
00596         int16_t count_total;
00597         int16_t count_remaining;
00598         IRDBCOMMAND dbdata[12];
00599 } IRDBBUFFER;
00600 
00601 typedef struct {
00602         uint32_t clientid;
00603         int16_t statuslen;
00604         int16_t statustype;
00605     int16_t offset;
00606     int16_t count_buffer;
00607         int16_t count_total;
00608         int16_t count_remaining;
00609         IRDBHEADER header;
00610 } IRDBHEADERBUFFER;
00611 
00612 typedef struct {
00613         uint32_t clientid;
00614         int16_t statuslen;
00615         int16_t statustype;
00616         int16_t adress;
00617     uint8_t align[2];
00618     MODELINE stat[16];
00619 } NETWORKMODE;
00620 
00621 typedef struct {
00622         uint32_t clientid;
00623         int16_t statuslen;
00624         int16_t statustype;
00625         int16_t adress;
00626     uint8_t align;
00627         uint8_t count;
00628         uint8_t dev_adr[8];
00629     MODELINE stat[8][16];
00630 } NETWORKMODEEX;
00631 
00632 typedef struct {
00633         uint32_t clientid;
00634         int16_t statuslen;
00635         int16_t statustype;
00636         int16_t adress;
00637     uint8_t offset;
00638         uint8_t count;
00639         uint8_t dev_adr[8];
00640     MODELINEN stat[8][16];
00641 } NETWORKMODEEXN;
00642 
00643 typedef struct {
00644         uint32_t clientid;
00645         int16_t statuslen;
00646         int16_t statustype;
00647         int16_t adress;
00648     uint8_t offset;
00649         uint8_t count;
00650         uint8_t dev_adr[8];
00651     MODELINEEX stat[8][16];
00652 } NETWORKMODEEX2;
00653 
00654 typedef struct {
00655         uint32_t clientid;
00656         int16_t statuslen;
00657         int16_t statustype;
00658         int16_t adress;
00659         uint16_t netstatus;
00660         uint16_t statuslevel;
00661     uint8_t align[2];
00662         int8_t message[256];
00663 } NETWORKSTATUS;
00664 
00665 typedef struct {
00666         uint32_t clientid;
00667         int16_t statuslen;
00668         int16_t statustype;
00669         int16_t adress;
00670     uint8_t align[2];
00671         int8_t message[4096];
00672 } NETWORKLOG;
00673 
00674 
00675 typedef struct {
00676         uint32_t clientid;
00677         int16_t statuslen;
00678         int16_t statustype;
00679         int16_t adress;
00680         uint16_t netstatus;
00681         uint16_t statuslevel;
00682     uint8_t align;
00683         uint8_t virtual_col;
00684         uint8_t numcol;
00685         uint8_t numrows;
00686         uint8_t clockflag;
00687 } NETWORKLCDSTAT;
00688 
00689 typedef struct {
00690         uint32_t clientid;
00691         int16_t statuslen;
00692         int16_t statustype;
00693         int16_t adress;
00694     uint8_t align[2];
00695         TIMINGDATA timing;
00696 } NETWORKTIMING;
00697 
00698 typedef struct {
00699         uint32_t clientid;
00700         int16_t statuslen;
00701         int16_t statustype;
00702         int16_t adress;
00703     uint16_t command_num;
00704         int8_t remote[80];
00705         int8_t command[20];
00706         int8_t data[200];
00707 } NETWORKRECV;
00708 
00709 
00710 typedef struct {
00711         uint32_t clientid;
00712         int16_t statuslen;
00713         int16_t statustype;
00714         int16_t adress;
00715         uint8_t learnok;
00716         uint8_t carrier;
00717         int8_t remote[80];
00718         int16_t num_timings;
00719         int16_t num_commands;
00720         int8_t received[CODE_LEN];
00721 } NETWORKLEARNSTAT;
00722 
00723 
00724 typedef struct {
00725         SOCKET fd;
00726         int32_t type;
00727         int32_t mode;
00728         uint32_t clientid;
00729         uint32_t callno;
00730         int8_t ip[20];
00731         WSAEVENT event;
00732         FILE *fp;
00733         char filename[84];
00734         int32_t timing;
00735         uint8_t resend_load;
00736         IRDATA ird;
00737         NETWORKLEARNSTAT learnstatus;
00738         int8_t restdata[sizeof (LCDCOMMAND)];
00739         int32_t restlen;
00740         int32_t restread;
00741         uint8_t msg_mode;
00742 } NETWORKCLIENT;
00743 
00744 
00745 #define MODE_ASCII              1
00746 
00747 
00748 #define TCP_PORT                21000
00749 #define IRTRANS_PORT    21000
00750 #define LIRC_PORT               8765
00751 #define UDP_PORT                21000
00752 #define WEB_PORT                80
00753 #define ALTERNATE_WEB   8080
00754 #define XAP_PORT                3639
00755 
00756 
00757 #ifdef WIN32
00758 #define CLIENT_COUNT    MAXIMUM_WAIT_OBJECTS - 3
00759 #endif
00760 
00761 #ifdef LINUX
00762 #define CLIENT_COUNT    64
00763 #endif
00764 
00765 
00766