1 | /* $Id: hmcomm.cpp,v 1.3 1999-11-27 12:48:26 achimha Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
5 | *
|
---|
6 | * Win32 COM device access class
|
---|
7 | *
|
---|
8 | * 1999 Achim Hasenmueller <achimha@innotek.de>
|
---|
9 | *
|
---|
10 | */
|
---|
11 |
|
---|
12 | #include <odin.h>
|
---|
13 | #include <win32type.h>
|
---|
14 | #include <misc.h>
|
---|
15 | #include "handlemanager.h"
|
---|
16 | #include "hmdevice.h"
|
---|
17 | #include "hmcomm.h"
|
---|
18 | #include "oslibdos.h"
|
---|
19 |
|
---|
20 |
|
---|
21 | HMDeviceCommClass::HMDeviceCommClass(LPCSTR lpDeviceName) : HMDeviceHandler(lpDeviceName)
|
---|
22 | {
|
---|
23 | dprintf(("HMDeviceCommClass: Register COM1 to COM4 with Handle Manager\n"));
|
---|
24 | HMDeviceRegister("COM1", this);
|
---|
25 | HMDeviceRegister("COM2", this);
|
---|
26 | HMDeviceRegister("COM3", this);
|
---|
27 | HMDeviceRegister("COM4", this);
|
---|
28 |
|
---|
29 | }
|
---|
30 |
|
---|
31 |
|
---|
32 |
|
---|
33 | DWORD HMDeviceCommClass::CreateFile(LPCSTR lpFileName,
|
---|
34 | PHMHANDLEDATA pHMHandleData,
|
---|
35 | PVOID lpSecurityAttributes,
|
---|
36 | PHMHANDLEDATA pHMHandleDataTemplate)
|
---|
37 | {
|
---|
38 | dprintf(("HMComm: Serial communication port %s open request\n", lpFileName));
|
---|
39 |
|
---|
40 | pHMHandleData->hHMHandle = 0;
|
---|
41 |
|
---|
42 | //AH: TODO parse Win32 security handles
|
---|
43 | pHMHandleData->hHMHandle = OSLibDosOpen((char*)lpFileName,
|
---|
44 | OSLIB_ACCESS_READWRITE |
|
---|
45 | OSLIB_ACCESS_SHAREDENYREAD |
|
---|
46 | OSLIB_ACCESS_SHAREDENYWRITE);
|
---|
47 | if (pHMHandleData->hHMHandle != 0)
|
---|
48 | return 0;
|
---|
49 | else
|
---|
50 | return -1;
|
---|
51 | }
|
---|
52 |
|
---|
53 |
|
---|
54 | /* this is a handler method for calls to CloseHandle() */
|
---|
55 | DWORD HMDeviceCommClass::CloseHandle(PHMHANDLEDATA pHMHandleData)
|
---|
56 | {
|
---|
57 | dprintf(("HMComm: Serial communication port close request\n"));
|
---|
58 | return OSLibDosClose(pHMHandleData->hHMHandle);
|
---|
59 | }
|
---|
60 |
|
---|
61 | /*****************************************************************************
|
---|
62 | * Name : DWORD HMDeviceHandler::SetupComm
|
---|
63 | * Purpose : set com port parameters (queue)
|
---|
64 | * Variables :
|
---|
65 | * Result :
|
---|
66 | * Remark :
|
---|
67 | * Status :
|
---|
68 | *
|
---|
69 | * Author : Achim Hasenmueller
|
---|
70 | *****************************************************************************/
|
---|
71 |
|
---|
72 | BOOL HMDeviceCommClass::SetupComm(PHMHANDLEDATA pHMHandleData, DWORD dwInQueue, DWORD dwOutQueue)
|
---|
73 | {
|
---|
74 | dprintf(("HMDeviceCommClass::SetupComm unimplemented stub!"));
|
---|
75 |
|
---|
76 |
|
---|
77 | return(TRUE);
|
---|
78 | }
|
---|