Skip to content

Instantly share code, notes, and snippets.

@caruizdiaz
Last active December 22, 2015 03:09
Show Gist options
  • Save caruizdiaz/6408251 to your computer and use it in GitHub Desktop.
Save caruizdiaz/6408251 to your computer and use it in GitHub Desktop.
implementation of events handlers
static void HandleGatewayUSSDReceived (string gatewayIP, int port, dwg_ussd_result_code status, string message)
{
Console.WriteLine("USSD response {0} at port {1}, status {2}", gatewayIP,port, Enum.GetName(typeof(dwg_ussd_result_code), status));
Console.WriteLine(message);
}
static void HandleGatewaySMSReceived (string gatewayIP, string number, string text, int port, string timestamp)
{
if (text == null)
text = string.Empty;
Debug.Info("IP:", gatewayIP, " | SMS from:", number, ", text:", text);
Database.Database.RegisterIncomingSMS(gatewayIP, Database.Database.FixMobileNumber(number), text, port);
}
static void HandleGatewaySentSMSStatus (string gatewayIP, string number, int port, dwg_sms_result_code status)
{
Debug.Info("IP:", gatewayIP, " | Number:", number, ", port:", port.ToString(), ", status:", Enum.GetName(typeof(dwg_sms_result_code), status));
Database.Database.RegisterSentSMS(number, gatewayIP, port, (int) status);
}
static void HandleGatewayStatusChanged (string gatewayIP, dwg_port_status_value[] portsStatus)
{
int i = 0;
foreach(dwg_port_status_value port in portsStatus)
Debug.Info(string.Format("Status changed on port {0}: {1}", i++, Enum.GetName(typeof(dwg_port_status_value), port)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment