Esempio n. 1
0
        public GsmCommMain OpenPort(string portName)
        {
            GsmCommMain comm = new GsmCommMain(portName, 115200, 300);

            try
            {                //comm = new GsmCommMain("COM22", 115200, 300);
                comm.Open();
                comm.EnablePermanentSmsBatchMode();
                comm.PhoneConnected    += Comm_PhoneConnected;
                comm.PhoneDisconnected += Comm_PhoneDisconnected;

                comm.MessageSendComplete += Comm_MessageSendComplete;
                comm.MessageSendFailed   += Comm_MessageSendFailed;
                comm.MessageSendStarting += Comm_MessageSendStarting;
                //comm.MessageReceived += Comm_MessageReceived;
            }
            catch (Exception ex)
            {
                message = portName + "Openining Port Exception: " + ex.Message;
                AddLog(EventLevel.Warning.ToString(), DateTime.Now, EventSource.AddModem.ToString(), message);
            }
            return(comm);
        }