Changeset 11279


Ignore:
Timestamp:
Oct 22, 2016, 3:50:32 PM (3 years ago)
Author:
felixka
Message:

gbx:

  • Prepare code for more generalized OSD messages
  • renamed driver sh from goodnight.osd to msg.osd
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/globals.h

    r11277 r11279  
    390390//#define WITH_EXTENDED_CW 1
    391391
    392 #if defined(READER_DRE) || defined(READER_DRECAS)   || defined(READER_VIACCESS)
     392#if defined(READER_DRE) || defined(READER_DRECAS) || defined(READER_VIACCESS)
    393393#define MAX_ECM_SIZE 1024
    394394#define MAX_EMM_SIZE 1024
  • trunk/module-gbox.c

    r11278 r11279  
    109109}
    110110
    111 static void write_goodnight_to_osd_file(struct s_client *cli)
    112 {
    113     char *fext= FILE_GOODNIGHT_OSD;
     111static void write_msg_to_osd (struct s_client *cli, uint8_t msg_id)
     112{
     113    char *fext= FILE_MSG_OSD;
    114114    char *fname = get_gbox_tmp_fname(fext);
    115115    if (file_exists(fname))
    116116    {
    117     char buf[50];
    118     memset(buf, 0, sizeof(buf));
    119     snprintf(buf, sizeof(buf), "%s %s %s", fname, username(cli), cli->reader->device);
    120     cs_log_dbg(D_READER, "found file %s - write goodnight info from %s %s to OSD", fname, username(cli),cli->reader->device);
    121     char *cmd = buf;
    122               FILE *p;
    123               if ((p = popen(cmd, "w")) == NULL)
    124         {   
     117        char buf[50];
     118        memset(buf, 0, sizeof(buf));
     119        snprintf(buf, sizeof(buf), "%s %d %s %s", fname, msg_id, username(cli), cli->reader->device);
     120        cs_log_dbg(D_READER, "found driver %s - write msg (id= %d) from %s %s to OSD", fname, msg_id, username(cli),cli->reader->device);
     121        char *cmd = buf;
     122        FILE *p;
     123        if ((p = popen(cmd, "w")) == NULL)
     124            {
    125125            cs_log("Error %s",fname);
    126126            return;
    127         }
    128               pclose(p);
     127            }
     128        pclose(p);
    129129    }
    130130    return;
     
    652652            //This is a good night / reset packet (good night data[0xA] / reset !data[0xA]
    653653            cs_log("-> Good Night from %s %s",username(cli), cli->reader->device);
    654             write_goodnight_to_osd_file(cli);
     654            write_msg_to_osd(cli, MSGID_GOODNIGHT_OSD);
    655655            gbox_reinit_proxy(cli);
    656656        }
     
    12761276    cs_log_dbg(D_READER, "<- CW (<- %d) to %04X from %s:%d", ere->gbox_hops, ere->gbox_peer, cli->reader->label, cli->port);
    12771277}
    1278 /*
     1278/* // see r11270
    12791279void *gbox_rebroadcast_thread(struct gbox_rbc_thread_args *args)
    12801280{
     
    14631463        gbox_send(cli, send_buf_1, cont_1);
    14641464        cli->reader->last_s = time((time_t *) 0);
    1465 /* 
     1465/*  // see r11270
    14661466        if(er->gbox_ecm_status < GBOX_ECM_ANSWERED)
    14671467        {
     
    16471647        if (time_since_last > (HELLO_KEEPALIVE_TIME*3) && cl->gbox_peer_id != NO_GBOX_ID)   
    16481648        {
    1649             //gbox peer apparently died without saying goodbye
     1649            //gbox peer apparently died without saying goodnight
    16501650            peer = proxy->gbox;
    16511651            cs_writelock(__func__, &peer->lock);
  • trunk/module-gbox.h

    r11231 r11279  
    5555#define FILE_GBOX_PEER_ONL      "share.onl"
    5656#define FILE_STATS              "stats.info"
    57 #define FILE_GOODNIGHT_OSD      "goodnight.osd"
     57#define FILE_MSG_OSD            "msg.osd"
    5858#define FILE_LOCAL_CARDS_INFO   "sc.info"
     59
     60#define MSGID_GOODNIGHT_OSD     0
     61#define MSGID_GSMS1_OSD         1
     62#define MSGID_GSMS2_OSD         2
     63#define MSGID_GOODBYE_OSD       3
     64#define MSGID_PEERONLINE_OSD    4
    5965
    6066#define GBOX_STAT_HELLOL        0
Note: See TracChangeset for help on using the changeset viewer.