1 /*
2  * $Id: proto_debug.cpp,v 1.1 2004/04/12 11:30:04 bozo Exp $
3  *
4  * G N A P P L E T
5  *
6  * gnapplet is a gnbus protocol driver for symbian phones.
7  *
8  * This file is part of gnokii.
9  *
10  * Gnokii is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * Gnokii is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with gnokii; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23  *
24  * Copyright (C) 2004 BORBELY Zoltan
25  *
26  * This file contains the debugging message handler.
27  *
28  */
29 
30 #include "proto.h"
31 
32 
Debug(TRefByValue<const TDesC> fmt,...)33 void Debug(TRefByValue<const TDesC> fmt, ...)
34 {
35 	TBuf8<1100> buf;
36 	TBuf<512> msg;
37 	PktBuf pkt;
38 	VA_LIST ap;
39 
40 	VA_START(ap, fmt);
41 	msg.FormatList(fmt, ap);
42 	VA_END(ap);
43 
44 	buf.Zero();
45 	pkt.Set(buf.Ptr(), 1100);
46 
47 	pkt << (TUint16)GNAPPLET_MSG_DEBUG_NOTIFICATION;
48 	pkt << (TUint16)GN_ERR_NONE;
49 	pkt << msg;
50 
51 	buf.SetLength(pkt.GetOffs());
52 	WritePacketL(g->current_device, GNAPPLET_MSG_DEBUG, buf);
53 }
54 
55 
HandleDebugMsg(PktBuf & in,PktBuf & out)56 void HandleDebugMsg(PktBuf &in, PktBuf &out)
57 {
58 	TUint16 code;
59 
60 	in >> code;
61 	switch (code) {
62 
63 	default:
64 		out << (TUint16)((code + 1) & ~1);
65 		out << (TUint16)GN_ERR_NOTSUPPORTED;
66 		break;
67 	}
68 }
69