implemented add_system_beep_event()
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20711 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -74,6 +74,8 @@ enum {
|
|||||||
|
|
||||||
MEDIA_SERVER_GET_FORMATS,
|
MEDIA_SERVER_GET_FORMATS,
|
||||||
MEDIA_SERVER_MAKE_FORMAT_FOR,
|
MEDIA_SERVER_MAKE_FORMAT_FOR,
|
||||||
|
|
||||||
|
MEDIA_SERVER_SYSTEM_BEEP_EVENT
|
||||||
};
|
};
|
||||||
|
|
||||||
// Raw port based communication
|
// Raw port based communication
|
||||||
@@ -1012,4 +1014,10 @@ struct controllable_set_parameter_data_reply : public reply_data
|
|||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
enum {
|
||||||
|
SYSTEM_BEEP_EVENT_INVOKE = 1,
|
||||||
|
SYSTEM_BEEP_EVENT_ADD
|
||||||
|
};
|
||||||
#endif // _DATA_EXCHANGE_H
|
#endif // _DATA_EXCHANGE_H
|
||||||
|
|||||||
@@ -7,13 +7,24 @@
|
|||||||
#include <Beep.h>
|
#include <Beep.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "DataExchange.h"
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
system_beep(const char *eventName)
|
system_beep(const char *eventName)
|
||||||
{
|
{
|
||||||
printf("beep event \"%s\" requested.\n", eventName);
|
BMessenger messenger("application/x-vnd.Be.media-server");
|
||||||
// ToDo: ask media server to beep around
|
if (!messenger.IsValid())
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
BMessage msg(MEDIA_SERVER_SYSTEM_BEEP_EVENT), reply;
|
||||||
|
msg.AddInt32("action", SYSTEM_BEEP_EVENT_INVOKE);
|
||||||
|
msg.AddString("event", eventName);
|
||||||
|
|
||||||
|
status_t err = messenger.SendMessage(&msg, &reply);
|
||||||
|
if ((err != B_OK)
|
||||||
|
|| (reply.FindInt32("error", &err) != B_OK))
|
||||||
|
err = B_BAD_REPLY;
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -27,7 +38,18 @@ beep()
|
|||||||
status_t
|
status_t
|
||||||
add_system_beep_event(const char *eventName, uint32 flags)
|
add_system_beep_event(const char *eventName, uint32 flags)
|
||||||
{
|
{
|
||||||
// ToDo: ask media server to add beep event
|
BMessenger messenger("application/x-vnd.Be.media-server");
|
||||||
return B_ERROR;
|
if (!messenger.IsValid())
|
||||||
|
return B_ERROR;
|
||||||
|
BMessage msg(MEDIA_SERVER_SYSTEM_BEEP_EVENT), reply;
|
||||||
|
msg.AddInt32("action", SYSTEM_BEEP_EVENT_ADD);
|
||||||
|
msg.AddString("event", eventName);
|
||||||
|
msg.AddInt32("flags", flags);
|
||||||
|
|
||||||
|
status_t err = messenger.SendMessage(&msg, &reply);
|
||||||
|
if ((err != B_OK)
|
||||||
|
|| (reply.FindInt32("error", &err) != B_OK))
|
||||||
|
err = B_BAD_REPLY;
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ SetSubDirSupportedPlatforms haiku libbe_test ;
|
|||||||
# # addr_t.
|
# # addr_t.
|
||||||
#}
|
#}
|
||||||
|
|
||||||
UsePrivateHeaders shared app ;
|
UsePrivateHeaders shared app media ;
|
||||||
|
|
||||||
MergeObject <libbe>support_kit.o :
|
MergeObject <libbe>support_kit.o :
|
||||||
Archivable.cpp
|
Archivable.cpp
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
#include <Autolock.h>
|
#include <Autolock.h>
|
||||||
|
#include <MediaFiles.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <storage/FindDirectory.h>
|
#include <storage/FindDirectory.h>
|
||||||
#include <storage/Path.h>
|
#include <storage/Path.h>
|
||||||
@@ -363,3 +364,37 @@ MMediaFilesManager::TimerMessage()
|
|||||||
fRunner = NULL;
|
fRunner = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
MMediaFilesManager::HandleSystemBeepEvent(BMessage *msg)
|
||||||
|
{
|
||||||
|
int32 action, flags;
|
||||||
|
BString event;
|
||||||
|
status_t err = B_OK;
|
||||||
|
if ((msg->FindString("event", &event) != B_OK)
|
||||||
|
|| (msg->FindInt32("action", &action) != B_OK)) {
|
||||||
|
err = B_BAD_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (action == SYSTEM_BEEP_EVENT_ADD) {
|
||||||
|
if (msg->FindInt32("flags", &flags) != B_OK)
|
||||||
|
err = B_BAD_VALUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err != B_OK) {
|
||||||
|
msg->SendReply(err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (action) {
|
||||||
|
case SYSTEM_BEEP_EVENT_ADD: {
|
||||||
|
entry_ref ref;
|
||||||
|
SetRefFor(BMediaFiles::B_SOUNDS, event.String(), ref);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SYSTEM_BEEP_EVENT_INVOKE: {
|
||||||
|
// TODO play the sound
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ class MMediaFilesManager
|
|||||||
|
|
||||||
void TimerMessage();
|
void TimerMessage();
|
||||||
|
|
||||||
|
void HandleSystemBeepEvent(BMessage *msg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int32 ReadPascalString(BFile &file, char **str);
|
static int32 ReadPascalString(BFile &file, char **str);
|
||||||
static int32 WritePascalString(BFile &file, const char *str);
|
static int32 WritePascalString(BFile &file, const char *str);
|
||||||
|
|||||||
@@ -802,7 +802,10 @@ ServerApp::MessageReceived(BMessage *msg)
|
|||||||
case MEDIA_SERVER_MAKE_FORMAT_FOR:
|
case MEDIA_SERVER_MAKE_FORMAT_FOR:
|
||||||
gFormatManager->MakeFormatFor(*msg);
|
gFormatManager->MakeFormatFor(*msg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case MEDIA_SERVER_SYSTEM_BEEP_EVENT:
|
||||||
|
gMMediaFilesManager->HandleSystemBeepEvent(msg);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
inherited::MessageReceived(msg);
|
inherited::MessageReceived(msg);
|
||||||
printf("\nmedia_server: unknown message received:\n");
|
printf("\nmedia_server: unknown message received:\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user