1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: chlist.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org 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 version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include <tools/urlobj.hxx>
35 #include <tools/datetime.hxx>
36 #include <tools/string.hxx>
37 #include <vcl/timer.hxx>
38 #include <tools/list.hxx>
39 #ifndef _INETSES_HXX //autogen
40 #include <inet/inetsess.hxx>
44 class ChannelAgentItem
;
46 class ChannelItemList
;
47 class ChannelAgentItemList
;
61 DateTime aLastDataDate
;
62 DateTime aLastUpdDate
;
67 DECLARE_LIST(UiAgentList
, UiAgentItem
*)
68 DECLARE_LIST(NotifyList
, NotifyItem
*)
72 #define _TOOLS_STRINGLIST
73 #include <tools/sstring.hxx>
76 ///////////////////////////////////////////////////////////////////////////////
79 #define JOBID_DOWNLOAD_AGENT 1
80 #define JOBID_UPDATE_AGENT 2
81 #define JOBID_CHECK_TRANSMITTER 3
87 ULONG nTransferStatus
;
88 String aLocalFileName
;
91 ///////////////////////////////////////////////////////////////////////////////
97 ChannelAgentItemList
* pAgentList
;
98 ChannelItemList
* pChannelList
;
99 NotifyList
* pNotifyList
;
100 GetChObjList
* pGetChObjList
;
101 UiAgentList
* pUiAgentList
;
103 ChannelTuner
* pChannelTuner
;
107 INetSessionRef xINetSession
;
109 Link aNotifyPermissionHdl
;
110 Link aCheckFinishHdl
;
111 // wird von der ChannelList gehandelt; sollte ausgebaut werden; auch im SFX
112 Link aAgentUpdateHdl
;
113 Downloader
* pBTXDecoder
;
115 void MakeGodChannel(ChannelAgentItem
* pAgent
);
116 void DeleteUiAgentList();
118 BOOL
StartAgent(ChannelAgentItem
* pAgent
);
120 void DoNotifyAgents();
121 void NotifyAgent(ChannelAgentItem
* pAgent
, ULONG nNotifyItemIdx
);
123 void UpdateAgent(ChannelAgentItem
* pAgent
, ULONG nNotifyItemIdx
);
124 void SendItemToTuner(ChannelItem
* pItem
);
126 BOOL
ParseDateTime(const String
& rSrc
, Date
& rDate
, Time
& rTime
);
128 void UnZipAgent(ChannelAgentItem
* pAgent
);
129 static void EnumFilesCallBack(char *pFile
, void *pObject
);
131 DECL_LINK(CheckChannels
, void*);
132 DECL_LINK(CloseChannelObjEvt
, void*);
133 DECL_LINK(GetChannelObjNotify
, GetChannelObj
*);
135 friend class ChannelApi
;
136 friend class ChannelTuner
;
138 ChannelItem
* GetChannelItemByName(const String
& rName
);
139 ChannelAgentItem
* GetAgentItemByName(const String
& rName
);
141 void ReadChannelList();
142 void ReadAgentList();
143 void WriteChannelItem(ChannelItem
* pItem
);
144 void WriteAgentItem(ChannelAgentItem
* pChAgent
);
145 void SetLastSuccUpdChannel(ChannelAgentItem
* pChAgent
);
146 void SetLastSuccUpdAgent(ChannelAgentItem
* pChAgent
);
147 void SetEnabledAgent(ChannelAgentItem
* pChAgent
);
149 void DeleteAgentItem(ChannelAgentItem
* pItem
);
150 void DeleteChannelItem(ChannelItem
* pItem
);
151 void RegisterNewChannelItem(ChannelItem
* pItem
);
154 Downloader
* GetBTXDecoder() const { return pBTXDecoder
; }
155 ResMgr
* GetResMgr() const { return pResMgr
; }
157 DECL_LINK(CheckBTXFinishHdl
, void*);
159 void NotifyTransmitterMsg(const String
& rStr
);
162 ChannelList(const String
& rAgentPath
);
165 void SubscribeNewAgent(const INetURLObject
& rURL
);
167 void SetINetSession(INetSession
* pNewSess
);
168 void SetBTXDecoder(Downloader
* pDecoder
);
170 void SetNotifyPermissionHdl(const Link
& rHdl
) { aNotifyPermissionHdl
= rHdl
; }
171 void SetAgentUpdateHdl(const Link
& rHdl
) { aAgentUpdateHdl
= rHdl
; }
173 void SetTimerInterval(ULONG nNew
);
174 void StartCheckChannels();
175 void StopCheckChannels();
177 void CheckAgentNow(const String
& rAgName
, BOOL bCheckGOD
= FALSE
);
178 void SetCheckFinishHdl(const Link
& rHdl
) { aCheckFinishHdl
= rHdl
; }
179 const Link
& GetCheckFinishHdl() const { return aCheckFinishHdl
;};
181 UiAgentList
* GetUiAgentList();
182 void JoinUiAgentList();
185 ///////////////////////////////////////////////////////////////////////////////
190 ChannelItem
* pChItem
;
195 INetURLObject aChObjURL
;
198 NotifyItem( ChannelItem
* pItem
, short nGMTOff
, ULONG nLastDate
,
199 ULONG nLastTime
, const INetURLObject
& rChObjURL
,
200 const String
& rChName
);
203 ChannelItem
* GetChannelItem() const { return pChItem
; }
205 const String
& GetChannelName() const { return aChName
; }
206 const INetURLObject
GetChannelObjURL() const { return aChObjURL
; }
208 void SetDateLastUpd(ULONG nNew
) { nDateLastUpd
= nNew
; }
209 ULONG
GetDateLastUpd() const { return nDateLastUpd
; }
211 void SetTimeLastUpd(long nNew
) { nTimeLastUpd
= nNew
; }
212 long GetTimeLastUpd() const { return nTimeLastUpd
; }
214 const String
& GetChAgentName() const;
218 #endif // _CHLIST_HXX