1 //-----------------------------------------------------------------------------
2 //
3 //	Controller.cpp
4 //
5 //	Cross-platform, hardware-abstracted controller data interface
6 //
7 //	Copyright (c) 2010 Jason Frazier <frazierjason@gmail.com>
8 //
9 //	SOFTWARE NOTICE AND LICENSE
10 //
11 //	This file is part of OpenZWave.
12 //
13 //	OpenZWave is free software: you can redistribute it and/or modify
14 //	it under the terms of the GNU Lesser General Public License as published
15 //	by the Free Software Foundation, either version 3 of the License,
16 //	or (at your option) any later version.
17 //
18 //	OpenZWave is distributed in the hope that it will be useful,
19 //	but WITHOUT ANY WARRANTY; without even the implied warranty of
20 //	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 //	GNU Lesser General Public License for more details.
22 //
23 //	You should have received a copy of the GNU Lesser General Public License
24 //	along with OpenZWave.  If not, see <http://www.gnu.org/licenses/>.
25 //
26 //-----------------------------------------------------------------------------
27 #include "Defs.h"
28 #include "Driver.h"
29 #include "platform/Controller.h"
30 
31 namespace OpenZWave
32 {
33 	namespace Internal
34 	{
35 		namespace Platform
36 		{
37 
38 //-----------------------------------------------------------------------------
39 //	<Controller::Read>
40 //	Read from a controller
41 //-----------------------------------------------------------------------------
Read(uint8 * _buffer,uint32 _length)42 			uint32 Controller::Read(uint8* _buffer, uint32 _length)
43 			{
44 				// Fetch the data from the ring buffer (which is an all or nothing read)
45 				if (Get(_buffer, _length))
46 				{
47 					return _length;
48 				}
49 
50 				return 0;
51 			}
52 		} // namespace Platform
53 	} // namespace Internal
54 } // namespace OpenZWave
55