/// <summary>
 /// Add a new command to the queue. This method will block until the command is transmitted
 /// and completely processed by the phone. 
 /// </summary>
 /// <param name="cmd">The command you would like to transmit</param>
 /// <returns>The result string received from the phone in response to the command</returns>
 public String AddCommand(ATCommand cmd)
 {
     // place the new command into the queue
     commands.Enqueue(cmd);
     // and try to submit it - If there is already a command running, this call has no effect
     TransmitNextCommmand();
     // wait for the command to finish
     cmd.WaitForResult();
     // and extract the result
     String result = cmd.Result;
     return result;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// This method launches the application on the phone. There is however no
 /// feedback about the launch succeeding or not.
 /// </summary>
 public void Start()
 {
     ATCommand cmd = new ATCommand("AT*EJAVA=4,"+this._appid);
     PhonePort.AddCommand(cmd);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Retrieve a list of all installed Java applications.
        /// </summary>
        /// <returns>
        /// A collection of <c>JavaApplication</c> objects.
        /// </returns>
        public ICollection GetApplications()
        {
            ATCommand cmd = new ATCommand("AT*EJAVA=1");
            String result = PhonePort.AddCommand(cmd);

            ArrayList list = new ArrayList();

            // A result line looks like this:
            //               name            vendor       ver    id   ??
            // *EJAVA: "Aero Mission 3D","Sony Ericsson","1.1",65539,3
            // The documentation does not tell anything about this either,
            // it does not even mention anything except for name and id
            foreach(String l in result.Split('\n')) {
                Match m = reApp.Match(l);
                if (m.Success) {
                    String name = m.Groups[1].Value;
                    String vendor = m.Groups[2].Value;
                    String version = m.Groups[3].Value;
                    int id = int.Parse(m.Groups[4].Value);
                    JavaApplication app = new JavaApplication(this.PhonePort, name, vendor, version, id);
                    list.Add(app);
                }
            }
            return list;
        }