Example #1
0
 public GoIpStateEventArgs(string message, GoIpStatePacket packet, string host, int port)
 {
     Message = message;
     Packet  = packet;
     Host    = host;
     Port    = port;
 }
Example #2
0
        private void State(string data, string host, int port)
        {
            _logger.LogDebug("Start GoIp State");

            GoIpStatePacket packet = new GoIpStatePacket(data);

            // if auth error
            if (packet.authid != _options.AuthId || packet.password != _options.AuthPassword)
            {
                // TODO: log?
                _logger.LogInformation("GoIp state report authentication error. Data: {0}", data);
                Send(ACKPacketFactory.ACK("STATE", packet.receiveid.ToString(), "State authentication error!"), host, port);
                OnStateChange?.Invoke(this, new GoIpStateEventArgs("GoIp state authentication error!", packet, host, port));
                return;
            }

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

            _logger.LogInformation("Received GoIp state. ReceiveId: {0} : Gsm state: {1}", packet.receiveid, packet.gsm_remain_state);

            Send(ACKPacketFactory.ACK("STATE", packet.receiveid.ToString(), ""), host, port);
            OnStateChange?.Invoke(this, new GoIpStateEventArgs("OK", packet, host, port));
        }