public CallParticipant(string number, string displayName, CallStates callState, long timeInitiated)
 {
     Number        = number;
     DisplayName   = displayName;
     CallState     = callState;
     TimeInitiated = timeInitiated;
 }
        private void HandleCallStatus(ArrayList calls)
        {
            List <Call> callList = new List <Call>();

            foreach (Hashtable call in calls)
            {
                string     callId     = (string)call[CMessageParser.ApiStringConstants.CallStatusResponse.Id];
                HoldStates holdStatus = StringToHoldState((string)call[CMessageParser.ApiStringConstants.CallStatusResponse.HoldStatus]);

                List <CallParticipant> callParticipantList = new List <CallParticipant>();

                ArrayList participants = call[CMessageParser.ApiStringConstants.CallStatusResponse.Participants] as ArrayList;
                foreach (Hashtable participant in participants)
                {
                    string     number        = (string)participant[CMessageParser.ApiStringConstants.CallParticipant.Number];
                    string     displayName   = (string)participant[CMessageParser.ApiStringConstants.CallParticipant.DisplayName];
                    CallStates state         = StringToCallState((string)participant[CMessageParser.ApiStringConstants.CallParticipant.State]);
                    long       timeInitiated = System.Convert.ToInt64((string)participant[CMessageParser.ApiStringConstants.CallParticipant.TimeInitiated]);

                    CallParticipant callParticipant = new CallParticipant(number, displayName, state, timeInitiated);
                    callParticipantList.Add(callParticipant);
                }

                Call callData = new Call(callId, holdStatus, callParticipantList);
                callList.Add(callData);
            }

            if (OnCallStatus != null)
            {
                OnCallStatus(this, new CallStatusEventArgs(callList));
            }
        }
Ejemplo n.º 3
0
        public string CallStateToColor(CallStates state)
        {
            switch (state)
            {
            case CallStates.Active:
                return("#008000");

            case CallStates.Closed:
                return("#808080");

            case CallStates.Cancelled:
                return("#000000");

            case CallStates.Unfounded:
                return("#000000");

            default:
                return("#000000");
            }
        }
Ejemplo n.º 4
0
        public string CallStateToString(CallStates state)
        {
            switch (state)
            {
            case CallStates.Active:
                return("Active");

            case CallStates.Closed:
                return("Closed");

            case CallStates.Cancelled:
                return("Cancelled");

            case CallStates.Unfounded:
                return("Unfounded");

            default:
                return("Unknown");
            }
        }
Ejemplo n.º 5
0
        public void RefreshState()
        {
            String refStr = "";
            String cmd    = "-s " + androidID + " shell dumpsys telephony.registry";

            if (simSlotNumber == 1) //SIM 2
            {
                cmd += "2";
            }
            ADB_Process.RunAdbCommand(cmd, ref refStr, false);
            foreach (String spilitedStr in refStr.Split('\n'))
            {
                String   line         = spilitedStr.Trim();
                String[] spilitedLine = line.Split(new char[] { '=', ' ' });
                int      keywordIndex = 0;
                int      valueIndex   = 1;
                try
                {
                    switch (spilitedLine[keywordIndex])
                    {
                        #region CallState
                    case "mCallState":
                        valueIndex = 1;
                        if (spilitedLine.Length > valueIndex && spilitedLine[valueIndex] != null)
                        {
                            callstate = (CallStates)Enum.ToObject(typeof(CallStates), Convert.ToInt32(spilitedLine[valueIndex]));
                        }
                        else
                        {
                            callstate = CallStates.IDLE;
                        }
                        break;

                        #endregion CallState
                        #region Incoming Number
                    case "mCallIncomingNumber":
                        valueIndex = 1;
                        if (spilitedLine.Length > valueIndex && spilitedLine[valueIndex] != null)
                        {
                            incommingCallNumber = spilitedLine[valueIndex];
                        }
                        else
                        {
                            incommingCallNumber = "";
                        }
                        break;

                        #endregion Incoming Number
                        #region Service State & Mibile Mode
                    case "mServiceState":
                        if (spilitedLine.Length > 1)
                        {
                            if (spilitedLine[1].ToUpper().StartsWith("SIM"))
                            {
                                valueIndex = 2;
                            }
                            else
                            {
                                valueIndex = 1;
                            }
                            if (spilitedLine.Length > valueIndex && spilitedLine[valueIndex] != null)
                            {
                                serviceState = (ServiceStates)Enum.ToObject(typeof(ServiceStates), Convert.ToInt32(spilitedLine[valueIndex]));
                            }
                            if (line.Contains("LTE") ||
                                line.Contains("WIMAX"))
                            {
                                MobileMoode |= MobileModes._4G;
                            }
                            if (line.Contains("CDMA") ||
                                line.Contains("UMTS") ||
                                line.Contains("EvDO") ||
                                line.Contains("HSDPA") ||
                                line.Contains("HSUPA") ||
                                line.Contains("HSPA"))

                            {
                                MobileMoode |= MobileModes._3G;
                            }
                            if (line.Contains("GPRS") ||
                                line.Contains("EDGE") ||
                                line.Contains("GSM"))
                            {
                                MobileMoode |= MobileModes._2G;
                            }
                        }
                        break;

                        #endregion Service State & Mibile Mode
                        #region Signal Strength
                    case "mSignalStrength":
                        if (spilitedLine.Length > 1)
                        {
                            int strength = -999;
                            try
                            {
                                if (spilitedLine[1].ToUpper().Contains("SIM"))      //MTK Dual SIM Solution
                                {
                                    valueIndex = spilitedLine.Length - 3;
                                    strength   = Convert.ToInt32(spilitedLine[valueIndex]);
                                    strength   = (int)strength / 4;
                                }
                                else
                                {
                                    valueIndex = spilitedLine.Length - 6;
                                    strength   = Convert.ToInt32(spilitedLine[valueIndex]);
                                }
                            }
                            catch
                            {
                                strength = -999;
                            }
                            signalStrength = strength;
                        }
                        break;

                        #endregion Signal Strength
                        #region DataActivity
                    case "mDataActivity":
                        valueIndex = 1;
                        if (spilitedLine.Length > valueIndex && spilitedLine[valueIndex] != null)
                        {
                            dataActivity = (DataActivities)Enum.ToObject(typeof(DataActivities), Convert.ToInt32(spilitedLine[valueIndex]));
                        }
                        break;

                        #endregion DataActivity
                        #region DataConnectionState
                    case "mDataConnectionState":
                        valueIndex = 1;
                        if (spilitedLine.Length > valueIndex && spilitedLine[valueIndex] != null)
                        {
                            dataConnectionState = (DataConnectionStates)Enum.ToObject(typeof(DataConnectionStates), Convert.ToInt32(spilitedLine[valueIndex]));
                        }
                        else
                        {
                            dataConnectionState = DataConnectionStates.UNKNOW;
                        }
                        break;

                        #endregion DataConnectionState
                        #region APN
                    case "mDataConnectionApn":
                        valueIndex = 1;
                        if (spilitedLine.Length > valueIndex && spilitedLine[valueIndex] != null)
                        {
                            apnName = spilitedLine[valueIndex];
                        }
                        else
                        {
                            apnName = "";
                        }
                        break;
                        #endregion APN
                        //#region
                        //case "":
                        //    valueIndex = 1;
                        //    if(spilitedLine.Length>valueIndex && spilitedLine[valueIndex] != null){

                        //    }
                        //    break;
                        //#endregion
                    }
                }
                catch
                {
                }
            }
        }