xref: /haiku/headers/private/print/PrintAddOnServer.h (revision 837b16251d4b2b6249ebcaa19bb319cbe82c6126)
1 /*
2  * Copyright 2010 Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Michael Pfeiffer
7  */
8 #ifndef PRINT_ADD_ON_SERVER_H
9 #define PRINT_ADD_ON_SERVER_H
10 
11 
12 #include <Directory.h>
13 #include <Entry.h>
14 #include <Message.h>
15 #include <Messenger.h>
16 #include <Path.h>
17 #include <String.h>
18 #include <SupportDefs.h>
19 
20 
21 class PrintAddOnServer
22 {
23 public:
24 						PrintAddOnServer(const char* driver);
25 	virtual				~PrintAddOnServer();
26 
27 			status_t	AddPrinter(const char* spoolFolderName);
28 			status_t	ConfigPage(BDirectory* spoolFolder,
29 							BMessage* settings);
30 			status_t	ConfigJob(BDirectory* spoolFolder,
31 							BMessage* settings);
32 			status_t	DefaultSettings(BDirectory* spoolFolder,
33 							BMessage* settings);
34 			status_t	TakeJob(const char* spoolFile,
35 							BDirectory* spoolFolder);
36 
37 	static	status_t	FindPathToDriver(const char* driver, BPath* path);
38 
39 private:
40 			const char*	Driver() const;
41 
42 			status_t	Launch(BMessenger& messenger);
43 			bool		IsLaunched();
44 			void		Quit();
45 
46 			void		AddDirectory(BMessage& message, const char* name,
47 							BDirectory* directory);
48 			void		AddEntryRef(BMessage& message, const char* name,
49 							const entry_ref* entryRef);
50 			status_t	SendRequest(BMessage& request, BMessage& reply);
51 			status_t	GetResult(BMessage& reply);
52 			status_t	GetResultAndUpdateSettings(BMessage& reply,
53 							BMessage* settings);
54 
55 	BString		fDriver;
56 	status_t	fLaunchStatus;
57 	BMessenger	fMessenger;
58 };
59 
60 
61 
62 #endif
63