equal
deleted
inserted
replaced
|
1 /* |
|
2 * Copyright (c) 2005 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: Extended Phone RemCon Handler |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "btmcprotdatabuf.h" |
|
20 #include "debug.h" |
|
21 |
|
22 void TBtmcProtDataBuf::Reset() |
|
23 { |
|
24 iBuf.Zero(); |
|
25 } |
|
26 |
|
27 TInt TBtmcProtDataBuf::NextCommand(TDes8& aText) |
|
28 { |
|
29 TRACE_FUNC |
|
30 |
|
31 const TChar KCharReturn = '\r'; |
|
32 |
|
33 TInt pos = iBuf.Locate(KCharReturn); |
|
34 |
|
35 if (pos == KErrNotFound) |
|
36 { |
|
37 return KErrNotFound; |
|
38 } |
|
39 aText.Copy(iBuf.Left(pos)); |
|
40 iBuf.Delete(0, pos + 1); |
|
41 iBuf.TrimLeft(); |
|
42 return KErrNone; |
|
43 } |
|
44 |
|
45 // ------------------------------------------------------------------------------- |
|
46 // TBTAspATRemoteDataBuffer::Append |
|
47 // |
|
48 // Appends AT command characters to buffer. If buffer overflows, it is emptied |
|
49 // and function returns KErrOverflow. |
|
50 //------------------------------------------------------------------------------- |
|
51 // |
|
52 TInt TBtmcProtDataBuf::Append(const TDesC8& aText) |
|
53 { |
|
54 TRACE_FUNC |
|
55 if ( (aText.Length() + iBuf.Length()) > iBuf.MaxLength() ) |
|
56 { |
|
57 iBuf = KNullDesC8; |
|
58 return KErrOverflow; |
|
59 } |
|
60 iBuf.Append(aText); |
|
61 return KErrNone; |
|
62 } |
|
63 |
|
64 // End of file |