コード例 #1
0
 public bool initialize(String port)
 {
     if (gsmComm == null)
     {
         gsmComm = new GSM_SMS();
     }
     try
     {
         gsmComm.initializePort(port);
         if( gsmComm.setMessageMode(GSM_SMS.MessageMode.TEXT) == false)
             return false;
     }
     catch (GSM_SMSException g)
     {
         MessageBox.Show(g.message, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
         return false;
     }
     return true;
 }
コード例 #2
0
        public bool initialize()
        {
            try
            {
                gsmComm = new GSM_SMS();



                logger("Finding GSM Communication Port...");

                gsmComm.initialize();
                gsmComm.setMessageMode(GSM_SMS.MessageMode.TEXT);


//                int? commPort = findGSMCommPort();


                if( gsmComm.ComPort == String.Empty)
            

                //if (commPort == null)
                {
                    logger("None Found");
                    return false;
                }


                //logger("Found on port number :" + commPort.Value.ToString());

                logger("Found on port :" + gsmComm.ComPort);

                //logger("Setting GSM Port ....");

//                comm = new GsmCommMain(commPort.Value, gsmBaudRate, gsmTimeOut);
//                comm.Open();
                

//                comm.MessageReceived += new MessageReceivedEventHandler(comm_MessageReceived);
////                comm.EnableMessageNotifications();

//                comm.MessageSendComplete += new GsmCommMain.MessageEventHandler(comm_MessageSendComplete);

//                smscAddress = comm.GetSmscAddress().Address;




                //logger("Successful");

                return true;
            }
            catch (Exception e)
            {
                comm = null;
                logger(" Failure ....");
                return false;
            }
        }