public GoIpRemainEventArgs(string message, GoIpRemainPacket packet, string host, int port)
 {
     Message = message;
     Packet  = packet;
     Host    = host;
     Port    = port;
 }
Exemple #2
0
        private void RemainData(string data, string host, int port)
        {
            _logger.LogDebug("Start GoIp Remain event");

            GoIpRemainPacket packet = new GoIpRemainPacket(data);

            // if auth error
            if (packet.authid != _options.AuthId || packet.password != _options.AuthPassword)
            {
                // TODO: log?
                _logger.LogInformation("GoIp remain event authentication error. Data: {0}", data);
                Send(ACKPacketFactory.ACK("REMAIN", packet.receiveid.ToString(), "Remain event authentication error!"), host, port);
                OnRemain?.Invoke(this, new GoIpRemainEventArgs("GoIp remain event authentication error!", packet, host, port));
                return;
            }

            packet.password = "";  // Delete password for security reasons

            _logger.LogInformation("Received GoIp record event. ReceiveId: {0} Remain time: {1}", packet.receiveid, packet.gsm_remain_time);

            Send(ACKPacketFactory.ACK("REMAIN", packet.receiveid.ToString(), ""), host, port);
            OnRemain?.Invoke(this, new GoIpRemainEventArgs("OK", packet, host, port));
        }