none
How to get the SMS teleservice id or the SMS header message? RRS feed

  • 질문

  • I have struggled to get the SMS teleservice id and more generally the SMS header message in my Windows Mobile Phone(Samsung Omnia Phone),
    but I have not succeeded yet.

    I have developed a customized message rule client(DLL) with VS2008 C++, Windows Mobile SDK 6.1.
    The dll can receive incoming SMS messages and can also deal with those for any purpose,
    but it can only for SMS body(text).

    I have tried to get the SMS header message by calling the IMessage::GetProps() function with properties such as PR_TRANSPORT_MESSAGE_HEADERS, PR_CE_SMS_RAW_HEADER, PR_CONTENT_IDENTIFIER.
    The GetProps() returns S_OK, but the ulPropTag member in the out parameter lppPropArray is not same with the given property.
    It is always PT_ERROR for the properties.

    Could you please help me for this problem?
    Thanks in advance :)
    • 이동됨 Alicia CalesMicrosoft employee 2010년 4월 14일 수요일 오전 6:57 Forums Consolidation (이전 위치:Smart Devices Native C++ Development)
    2009년 6월 18일 목요일 오전 11:36

모든 응답

  • 네트워크 직렬화 참조 cs

    using System;
    [Serializable]
    public class Serial
    {
     public int id;
     public string name;
     public int kor;
     public int math;
     public int eng;
     public DateTime date;
     
     public SerialExample(){
     this.id = 0;
     this.name = null;
     this.kor = 0;
     this.math = 0;
     this.eng = 0;
     this.date = DateTime.Now;
     }
    }

    network.cs

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Net; 
    using System.Net.Sockets;
    using System.Threading;

    namespace MainChat
    {
        class Network
        {
               Form1 wnd = null;
               Socket server = null;
               Socket client = null;
            Thread th = null;

      public Network(Form1 wnd) {   
           this.wnd = wnd;   
      }

              
      public void ServerStart(){
           try{  
                  IPEndPoint ipep = new IPEndPoint(IPAddress.Any, 7000);
                 
                   server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                server.Bind(ipep);
              server.Listen(10);
              wnd.Add_MSG("채팅 서버 시작...");

                client = server.Accept();
                       
                         
                IPEndPoint ip = (IPEndPoint)client.RemoteEndPoint;
                wnd.Add_MSG(ip.Address + "접속...");
                          
                        
                th = new Thread(new ThreadStart(Receive));
                th.Start();
              }
           catch(Exception ex){
                         wnd.Add_MSG(ex.Message);
           }
      }

              
      public void ServerStop(){
           try{ 
                if(client != null)
                {
                 if( client.Connected){ 
                      client.Close(); 
        if(th.IsAlive)
                       th.Abort(); 
                  }
              }      
              server.Close();
           catch(Exception ex){
                wnd.Add_MSG(ex.Message);
           }   
      }

        // 채팅 서버와 연결
        public bool Connect(string ip){
           try{  
                 IPEndPoint ipep = new IPEndPoint(IPAddress.Parse(ip), 7000);
                    client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
              client.Connect(ipep);
              wnd.Add_MSG(ip+ "서버에 접속 성공...");
                 th = new Thread(new ThreadStart(Receive));
              th.Start(); 
              return true;
           }
           catch(Exception ex){
                wnd.Add_MSG(ex.Message);
             return false;
           }
      }
      
              
      public void DisConnect(){
           try{
                if(client != null){
                  if( client.Connected )
                      client.Close();
        
                  if(th.IsAlive)
                      th.Abort();
              }
                 wnd.Add_MSG("채팅 서버 연결 종료!");
           }
           catch(Exception ex){
                wnd.Add_MSG(ex.Message);
           }
      }

              
         public void Receive(){
           try{
                while( client != null && client.Connected ){
                    
                     byte [] data = ReceiveData();
                        wnd.Add_MSG ("[상대방]"+ Encoding.Default.GetString(data));
                        
                } 
              }
           catch(Exception ex){
                wnd.Add_MSG(ex.Message);
           }
        }
    // 상대방에게 데이터 송신
      public void Send(string msg){
             try
             {
                 if (client.Connected)
                 {
                    
                     byte[] data = Encoding.Default.GetBytes(msg);
                     SendData(data);    
                 }
                 else
                 {
                     wnd.Add_MSG("메시지 전송 실패!");
                 }
             }
             catch (Exception ex)
             {
                 wnd.Add_MSG(ex.Message);
             }
      }
      
         private void SendData(byte[] data){
           try{  
                int total = 0;
                int size = data.Length;
               int left_data = size ;
              int send_data = 0;

             
              byte [] data_size =new byte[4];
              data_size = BitConverter.GetBytes(size);
              send_data = client.Send(data_size);  

             
              while(total < size){ 
                          send_data  = client.Send(data, total, left_data, SocketFlags.None);
                   total += send_data;
                   left_data -= send_data;
                 }
            }
            catch(Exception ex) {
              wnd.Add_MSG(ex.Message);
               }
       }
     
          private byte[] ReceiveData(){
            try{
                int total = 0;
              int size = 0;
              int left_data = 0;
              int recv_data = 0;

             
               byte[] data_size = new byte[4]; 
              recv_data = client.Receive(data_size, 0, 4, SocketFlags.None);
              size = BitConverter.ToInt32(data_size, 0);
              left_data = size;

              byte [] data = new byte[size];
              
              while(total < size) {
                       recv_data = client.Receive(data, total, left_data, SocketFlags.None);
                          if (recv_data == 0) break;
                    total += recv_data ;
                    left_data -= recv_data;
              }
              return data;
                }
             catch(Exception ex) {
            wnd.Add_MSG(ex.Message);
            return null;
             }
       }  
     
               
       public string Get_MyIP(){
                IPHostEntry host = Dns.Resolve(Dns.GetHostName());
              string myip = host.AddressList[0].ToString();
              return myip;
       }
        }
    }

     

    2009년 12월 9일 수요일 오전 3:53