|
1 /* |
|
2 * Copyright (c) 2004-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 using System; |
|
19 using System.Collections.Generic; |
|
20 using System.Text; |
|
21 using CrashDebuggerLib.Structures.KernelObjects; |
|
22 using CrashDebuggerLib.Structures.Common; |
|
23 using CrashDebuggerLib.Structures.Process; |
|
24 |
|
25 namespace CrashDebuggerLib.Structures.MessageQueue |
|
26 { |
|
27 public class DMsgQueue : DObject |
|
28 { |
|
29 #region Enumerations |
|
30 [System.ComponentModel.TypeConverter( typeof( SymbianParserLib.TypeConverters.SymbianEnumConverter ) )] |
|
31 public enum TQueueState |
|
32 { |
|
33 EUnknown = -1, |
|
34 EEmpty, |
|
35 EPartial, |
|
36 EFull |
|
37 } |
|
38 #endregion |
|
39 |
|
40 #region Constructors |
|
41 public DMsgQueue( CrashDebuggerInfo aCrashDebugger ) |
|
42 : base( aCrashDebugger, TObjectType.EMsgQueue ) |
|
43 { |
|
44 iWaitSpaceInfo = new MsgQueueWaitInfo( MsgQueueWaitInfo.TType.EWaitTypeSpace, CrashDebugger ); |
|
45 iWaitDataInfo = new MsgQueueWaitInfo( MsgQueueWaitInfo.TType.EWaitTypeData, CrashDebugger ); |
|
46 } |
|
47 #endregion |
|
48 |
|
49 #region API |
|
50 public static TQueueState StateByString( string aState ) |
|
51 { |
|
52 TQueueState ret = TQueueState.EUnknown; |
|
53 // |
|
54 switch ( aState.ToUpper() ) |
|
55 { |
|
56 case "EMPTY": |
|
57 ret = TQueueState.EEmpty; |
|
58 break; |
|
59 case "PARTIAL": |
|
60 ret = TQueueState.EPartial; |
|
61 break; |
|
62 case "FULL": |
|
63 ret = TQueueState.EFull; |
|
64 break; |
|
65 default: |
|
66 break; |
|
67 } |
|
68 // |
|
69 return ret; |
|
70 } |
|
71 #endregion |
|
72 |
|
73 #region Properties |
|
74 public MsgQueuePoolInfo PoolInfo |
|
75 { |
|
76 get { return iPoolInfo; } |
|
77 } |
|
78 |
|
79 public MsgQueueSlotInfo SlotInfo |
|
80 { |
|
81 get { return iSlotInfo; } |
|
82 } |
|
83 |
|
84 public int MaxMessageLength |
|
85 { |
|
86 get { return iMaxMessageLength; } |
|
87 set { iMaxMessageLength = value; } |
|
88 } |
|
89 |
|
90 public TQueueState State |
|
91 { |
|
92 get { return iState; } |
|
93 set { iState = value; } |
|
94 } |
|
95 |
|
96 public string StateString |
|
97 { |
|
98 get |
|
99 { |
|
100 string ret = "Unknown"; |
|
101 // |
|
102 switch ( iState ) |
|
103 { |
|
104 default: |
|
105 case TQueueState.EUnknown: |
|
106 break; |
|
107 case TQueueState.EEmpty: |
|
108 ret = "Empty"; |
|
109 break; |
|
110 case TQueueState.EPartial: |
|
111 ret = "Partial"; |
|
112 break; |
|
113 case TQueueState.EFull: |
|
114 ret = "Full"; |
|
115 break; |
|
116 } |
|
117 // |
|
118 return ret; |
|
119 } |
|
120 } |
|
121 |
|
122 public MsgQueueWaitInfo WaitSpace |
|
123 { |
|
124 get { return iWaitSpaceInfo; } |
|
125 } |
|
126 |
|
127 public MsgQueueWaitInfo WaitData |
|
128 { |
|
129 get { return iWaitDataInfo; } |
|
130 } |
|
131 #endregion |
|
132 |
|
133 #region Internal methods |
|
134 #endregion |
|
135 |
|
136 #region Internal constants |
|
137 #endregion |
|
138 |
|
139 #region From System.Object |
|
140 public override string ToString() |
|
141 { |
|
142 return base.ToString(); |
|
143 } |
|
144 #endregion |
|
145 |
|
146 #region Data members |
|
147 private readonly MsgQueueWaitInfo iWaitSpaceInfo; |
|
148 private readonly MsgQueueWaitInfo iWaitDataInfo; |
|
149 private MsgQueuePoolInfo iPoolInfo = new MsgQueuePoolInfo(); |
|
150 private MsgQueueSlotInfo iSlotInfo = new MsgQueueSlotInfo(); |
|
151 private int iMaxMessageLength = 0; |
|
152 private TQueueState iState = TQueueState.EUnknown; |
|
153 #endregion |
|
154 } |
|
155 } |