Exemplo n.º 1
0
        // When the callback thead exist the native message will be destroy. To avoid such beh. we copy
        // the message for asyn. use
        internal MyXcapMessage(XcapMessage message)
        {
            if (message == null)
            {
                this.code        = -1;
                this.phrase      = String.Empty;
                this.contentType = String.Empty;
            }
            else
            {
                this.code        = message.getCode();
                this.phrase      = message.getPhrase();
                this.contentType = message.getXcapHeaderValue("Content-Type");

                uint clen = message.getXcapContentLength();
                if (clen > 0)
                {
                    this.content = new byte[clen];
                    message.getXcapContent(this.content, clen);
                }
                else
                {
                    this.content = null;
                }
            }
        }
Exemplo n.º 2
0
 internal MyXcapMessage(XcapMessage message)
 {
     if (message == null)
     {
         this.code        = -1;
         this.phrase      = string.Empty;
         this.contentType = string.Empty;
     }
     else
     {
         this.code        = message.getCode();
         this.phrase      = message.getPhrase();
         this.contentType = message.getXcapHeaderValue("Content-Type");
         uint clen = message.getXcapContentLength();
         if (clen > 0u)
         {
             this.content = new byte[clen];
             System.IntPtr ptr = System.Runtime.InteropServices.Marshal.AllocHGlobal((int)clen);
             message.getXcapContent(ptr, clen);
             System.Runtime.InteropServices.Marshal.Copy(ptr, this.content, 0, this.content.Length);
             System.Runtime.InteropServices.Marshal.FreeHGlobal(ptr);
         }
         else
         {
             this.content = null;
         }
     }
 }
Exemplo n.º 3
0
            public override int onEvent(XcapEvent e)
            {
                XcapMessage message = e.getXcapMessage();
                String      content_type;

                if (message == null)
                {
                    Console.WriteLine("Invalid Xcap message");
                    return(-1);
                }

                Console.WriteLine("code={0} and Phrase={1}", message.getCode(), message.getPhrase());

                if ((content_type = message.getXcapHeaderValue("Content-Type")) != null)
                {
                    Console.WriteLine("Content-Type={0}", content_type);
                    uint clen = message.getXcapContentLength();
                    if (clen > 0)
                    {
                        byte[] content = new byte[clen];
                        uint   read    = message.getXcapContent(content, (uint)content.Length);
                        Console.WriteLine("Content-Value ==> {0}", Encoding.UTF8.GetString(content));
                    }
                }



                return(base.onEvent(e));
            }