Pygate and Fake GPS (part 2)



  • Re: Pygate and Fake GPS

    Hi, I suspect that the problem is more deeper than just adding these lines.... here are my observations:

    1. TCPDUMP records from my others GWs.....

    STATs packet from RAK831 and RAK7249

    E.....@.?..;...G...3......7:.....'....x.{"stat":{"time":"2020-08-24 17:33:33 GMT","lati":45.94744,"long":-73.56501,"alti":68,"rxnb":26,"rxok":26,"rxfw":26,"ackr":100.0,"dwnb":0,"txnb":0}}

    E.....@.?..o...G...3..........o..'....x.{"stat":{"time":"2020-08-24 17:34:03 GMT","lati":45.94749,"long":-73.56503,"alti":69,"rxnb":25,"rxok":25,"rxfw":25,"ackr":100.0,"dwnb":0,"txnb":0}}

    STATs packet from PYGATE
    E....+....:#...J.........|....i.p..I....{"stat":{"time":"2020-08-24 17:34:24 GMT","rxnb":26,"rxok":26,"rxfw":26,"ackr":100.0,"dwnb":0,"txnb":0}}

    has we can see the geolocation fields are not part of the stats packet (latitude, longitude and altitude) into the PYGATE record.
    2. According to the info displayed in the PYGATE console, it use the *** Packet Forwarder for Lora PicoCell Gateway *** codes... and if and I say if this code code came from: "https://github.com/Lora-net/picoGW_packet_forwarder/blob/master/lora_pkt_fwd/src/lora_pkt_fwd.c":

        /* generate a JSON report (will be sent to server by upstream thread) */
        pthread_mutex_lock(&mx_stat_rep);
        snprintf(status_report, STATUS_SIZE, "\"stat\":{\"time\":\"%s\",\"rxnb\":%u,\"rxok\":%u,\"rxfw\":%u,\"ackr\":%.1f,\"dwnb\":%u,\"txnb\":%u}", stat_timestamp, cp_nb_rx_rcv, cp_nb_rx_ok, cp_up_pkt_fwd, 100.0 * up_ack_ratio, cp_dw_dgram_rcv, cp_nb_tx_ok);
        report_ready = true;
        pthread_mutex_unlock(&mx_stat_rep);
    

    the code should be updated to include the gps info into the stats packet, like: "https://github.com/Lora-net/packet_forwarder/blob/master/lora_pkt_fwd/src/lora_pkt_fwd.c"

        /* generate a JSON report (will be sent to server by upstream thread) */
        pthread_mutex_lock(&mx_stat_rep);
        if (((gps_enabled == true) && (coord_ok == true)) || (gps_fake_enable == true)) {
            snprintf(status_report, STATUS_SIZE, "\"stat\":{\"time\":\"%s\",\"lati\":%.5f,\"long\":%.5f,\"alti\":%i,\"rxnb\":%u,\"rxok\":%u,\"rxfw\":%u,\"ackr\":%.1f,\"dwnb\":%u,\"txnb\":%u}", stat_timestamp, cp_gps_coord.lat, cp_gps_coord.lon, cp_gps_coord.alt, cp_nb_rx_rcv, cp_nb_rx_ok, cp_up_pkt_fwd, 100.0 * up_ack_ratio, cp_dw_dgram_rcv, cp_nb_tx_ok);
        } else {
            snprintf(status_report, STATUS_SIZE, "\"stat\":{\"time\":\"%s\",\"rxnb\":%u,\"rxok\":%u,\"rxfw\":%u,\"ackr\":%.1f,\"dwnb\":%u,\"txnb\":%u}", stat_timestamp, cp_nb_rx_rcv, cp_nb_rx_ok, cp_up_pkt_fwd, 100.0 * up_ack_ratio, cp_dw_dgram_rcv, cp_nb_tx_ok);
        }
        report_ready = true;
        pthread_mutex_unlock(&mx_stat_rep);
    

    The result of this problem is in the UPLINK record, the location fields (latitude, longitude, altitude) are all 0.

    Has anyone else experienced this?

    Regards.

    Richard.



  • Ok Thank you.

    Richard.


  • Global Moderator

    In the meantime, I tested adding this line to the status report, but Im not sure what functionality this adds and Im not able to find it anywhere in the TTN console?


  • Global Moderator

    You are correct, I did not notice this in my initial review. This was not included in our initial port of the Pygate source. We will have the sourcecode out very soon, so you should be able to adapt this line yourself. I will take care it ends up in the original source
    Best,
    Gijs


Log in to reply
 

Pycom on Twitter