|
1 /* |
|
2 * Copyright (c) 2005-2006 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: Class for storing virtual traffic streams. |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 1 % |
|
20 */ |
|
21 |
|
22 #ifndef CORE_VIRTUAL_TRAFFIC_STREAM_LIST_H |
|
23 #define CORE_VIRTUAL_TRAFFIC_STREAM_LIST_H |
|
24 |
|
25 #include "core_type_list.h" |
|
26 #include "core_virtual_traffic_stream.h" |
|
27 |
|
28 /** |
|
29 * This is a storage class for virtual traffic streams. |
|
30 * |
|
31 * @since S60 v3.2 |
|
32 */ |
|
33 NONSHARABLE_CLASS( core_virtual_traffic_stream_list_c ) |
|
34 { |
|
35 |
|
36 friend class core_virtual_traffic_stream_list_iter_c; |
|
37 |
|
38 public: |
|
39 |
|
40 /** |
|
41 * Structure for storing virtual traffic streams. |
|
42 */ |
|
43 struct entry_s |
|
44 { |
|
45 /** Data of the AP. */ |
|
46 core_virtual_traffic_stream_c* traffic_stream; |
|
47 }; |
|
48 |
|
49 /** |
|
50 * Constructor. |
|
51 */ |
|
52 core_virtual_traffic_stream_list_c(); |
|
53 |
|
54 /** |
|
55 * Destructor. |
|
56 */ |
|
57 virtual ~core_virtual_traffic_stream_list_c(); |
|
58 |
|
59 /** |
|
60 * Return the amount of entries in the list. |
|
61 * |
|
62 * @since S60 v5.1 |
|
63 * @return The amount of entries in the list. |
|
64 */ |
|
65 u32_t count() const; |
|
66 |
|
67 /** |
|
68 * Add a copy of the given entry to the list. |
|
69 * |
|
70 * @since S60 v5.1 |
|
71 * @param stream Entry to copy. |
|
72 * @return core_error_ok if successful, an error code otherwise. |
|
73 */ |
|
74 core_error_e add_traffic_stream( |
|
75 const core_virtual_traffic_stream_c& stream ); |
|
76 |
|
77 /** |
|
78 * Add an entry to the list. |
|
79 * |
|
80 * @since S60 v5.1 |
|
81 * @param requested_tid TID the virtual traffic stream was requested with. |
|
82 * @param tid Current TID of the virtual traffic stream. |
|
83 * @param user_priority User Priority of the virtual traffic stream. |
|
84 * @param is_automatic_stream Whether the virtual traffic stream |
|
85 * has been created automatically. |
|
86 * @param params Parameters of the virtual traffic stream. |
|
87 * @param id Contains the ID assigned to the stream if successfully added. |
|
88 * @param stream_status Status of the virtual traffic stream. |
|
89 * @return core_error_ok if successful, an error code otherwise. |
|
90 */ |
|
91 core_error_e add_traffic_stream( |
|
92 u8_t requested_tid, |
|
93 u8_t tid, |
|
94 u8_t user_priority, |
|
95 bool_t is_automatic_stream, |
|
96 const core_traffic_stream_params_s& params, |
|
97 u32_t& stream_id, |
|
98 core_traffic_stream_status_e stream_status ); |
|
99 |
|
100 /** |
|
101 * Remove entry with a matching TID. |
|
102 * |
|
103 * @since S60 v5.1 |
|
104 * @param tid TID to match against. |
|
105 */ |
|
106 void remove_traffic_stream_by_tid( |
|
107 u8_t tid ); |
|
108 |
|
109 /** |
|
110 * Remove entry with a matching stream ID. |
|
111 * |
|
112 * @since S60 v5.1 |
|
113 * @param stream_id ID to match against. |
|
114 */ |
|
115 void remove_traffic_stream_by_id( |
|
116 u32_t stream_id ); |
|
117 |
|
118 /** |
|
119 * Return the traffic mode of the given AC. |
|
120 * |
|
121 * @since S60 v5.1 |
|
122 * @return The traffic mode of the given AC. |
|
123 */ |
|
124 core_access_class_traffic_mode_e traffic_mode_by_ac( |
|
125 core_access_class_e access_class ); |
|
126 |
|
127 /** |
|
128 * Print the contents of the list. |
|
129 */ |
|
130 void print_contents(); |
|
131 |
|
132 /** |
|
133 * Get the next free TID. |
|
134 * |
|
135 * @return The next free TID, MAX_TRAFFIC_STREAM_TID if no available. |
|
136 */ |
|
137 u8_t next_tid(); |
|
138 |
|
139 private: // data |
|
140 |
|
141 /** |
|
142 * List of virtual traffic streams. |
|
143 */ |
|
144 core_type_list_c<entry_s> ts_list_m; |
|
145 |
|
146 /** |
|
147 * Contains the next stream ID to be used. |
|
148 */ |
|
149 u32_t next_stream_id_m; |
|
150 |
|
151 }; |
|
152 |
|
153 #endif // CORE_VIRTUAL_TRAFFIC_STREAM_LIST_H |