1 |
/***************************************************************************
|
2 |
nullchan.cxx
|
3 |
|
4 |
Copyright (c) 2002-2003 Vladimir Toncar
|
5 |
|
6 |
The contents of this file are subject to the Mozilla Public License
|
7 |
Version 1.1 (the "License"); you may not use this file except in
|
8 |
compliance with the License. You may obtain a copy of the License at
|
9 |
http://www.mozilla.org/MPL/
|
10 |
|
11 |
Software distributed under the License is distributed on an "AS IS"
|
12 |
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
|
13 |
See the License for the specific language governing rights and
|
14 |
limitations under the License.
|
15 |
|
16 |
The Original Code is oh323tut.
|
17 |
|
18 |
The Initial Developer of the Original Code is Vladimir Toncar.
|
19 |
All Rights Reserved.
|
20 |
|
21 |
Contributor(s): ______________________________________.
|
22 |
|
23 |
***************************************************************************/
|
24 |
|
25 |
#include "nullchan.h"
|
26 |
|
27 |
|
28 |
// ***********************************************************************
|
29 |
|
30 |
NullChannel::NullChannel(): isOpen(true)
|
31 |
{
|
32 |
PTRACE(1, "Creating NULL channel");
|
33 |
}
|
34 |
|
35 |
|
36 |
// ***********************************************************************
|
37 |
|
38 |
NullChannel::~NullChannel()
|
39 |
{
|
40 |
PTRACE(1, "Deleting NULL channel");
|
41 |
}
|
42 |
|
43 |
|
44 |
// ***********************************************************************
|
45 |
|
46 |
BOOL NullChannel::Close()
|
47 |
{
|
48 |
isOpen = false;
|
49 |
return true;
|
50 |
}
|
51 |
|
52 |
|
53 |
// ***********************************************************************
|
54 |
|
55 |
BOOL NullChannel::Write(const void *buf, PINDEX len)
|
56 |
{
|
57 |
lastWriteCount = len;
|
58 |
writeDelay.Delay(len/2/8);
|
59 |
return true;
|
60 |
}
|
61 |
|
62 |
|
63 |
// ***********************************************************************
|
64 |
|
65 |
BOOL NullChannel::Read(void *buf, PINDEX len)
|
66 |
{
|
67 |
memset(buf, 0, len);
|
68 |
lastReadCount = len;
|
69 |
readDelay.Delay(len/2/8);
|
70 |
return true;
|
71 |
}
|
72 |
|
73 |
|
74 |
// ***********************************************************************
|
75 |
|