public SendUssdRequestBody(byte port, DwgUssdType type, string content)
 {
     Port          = port;
     Content       = content;
     Type          = type;
     ContentLength = (short)Encoding.ASCII.GetByteCount(content);
     Length        = 4 + ContentLength;
 }
Esempio n. 2
0
        /// <summary>
        /// Send USSD request
        /// </summary>
        /// <param name="port">DWG port to send from</param>
        /// <param name="type">USSD type</param>
        /// <param name="ussd">USSD request content</param>
        /// <returns>Result of sending USSD to network</returns>
        public DwgSendUssdResult SendUssd(byte port, DwgUssdType type, string ussd)
        {
            if (State != DwgSmsServerState.Connected)
            {
                throw new NotSupportedException("Can't send SMS from not connected server");
            }
            if (port > PortsCount || PortsStatuses[port] != DwgPortStatus.Works)
            {
                throw new NotSupportedException("Port should be in \"Works\" status");
            }

            SendToDwg(new SendUssdRequestBody(port, type, ussd));

            _sendUssdEvent.WaitOne();

            return(_sendUssdResult);
        }