11299bfb2Sbeveloper /* 21299bfb2Sbeveloper * Copyright 2002, Marcus Overhagen. All rights reserved. 31299bfb2Sbeveloper * Distributed under the terms of the MIT License. 41299bfb2Sbeveloper */ 5*8734b81dSAxel Dörfler #ifndef NOTIFICATION_MANAGER_H 6*8734b81dSAxel Dörfler #define NOTIFICATION_MANAGER_H 71d616657Sbeveloper 8*8734b81dSAxel Dörfler #include <Locker.h> 9e66fda40Sbeveloper #include <MediaNode.h> 10*8734b81dSAxel Dörfler #include <Messenger.h> 11*8734b81dSAxel Dörfler 12*8734b81dSAxel Dörfler #include "Queue.h" 13e66fda40Sbeveloper #include "TList.h" 14e66fda40Sbeveloper 151d616657Sbeveloper 16*8734b81dSAxel Dörfler struct Notification { 17e66fda40Sbeveloper BMessenger messenger; 18e66fda40Sbeveloper media_node node; 19e66fda40Sbeveloper int32 what; 20e66fda40Sbeveloper team_id team; 21e66fda40Sbeveloper }; 22e66fda40Sbeveloper 23*8734b81dSAxel Dörfler class NotificationManager { 241d616657Sbeveloper public: 251d616657Sbeveloper NotificationManager(); 261d616657Sbeveloper ~NotificationManager(); 271d616657Sbeveloper 28ced4130fSbeveloper void Dump(); 29ced4130fSbeveloper 30*8734b81dSAxel Dörfler void EnqueueMessage(BMessage* message); 311d616657Sbeveloper 321d616657Sbeveloper void CleanupTeam(team_id team); 331d616657Sbeveloper 341d616657Sbeveloper private: 35*8734b81dSAxel Dörfler void RequestNotifications(BMessage* message); 36*8734b81dSAxel Dörfler void CancelNotifications(BMessage* message); 37*8734b81dSAxel Dörfler void SendNotifications(BMessage* message); 381d616657Sbeveloper 391d616657Sbeveloper void WorkerThread(); 401d616657Sbeveloper static int32 worker_thread(void* arg); 411d616657Sbeveloper 421d616657Sbeveloper private: 43*8734b81dSAxel Dörfler Queue fNotificationQueue; 441d616657Sbeveloper thread_id fNotificationThreadId; 45*8734b81dSAxel Dörfler BLocker fLocker; 46*8734b81dSAxel Dörfler List<Notification> fNotificationList; 471d616657Sbeveloper }; 48*8734b81dSAxel Dörfler 49*8734b81dSAxel Dörfler #endif // NOTIFICATION_MANAGER_H 50