1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
<title>Service Added Callback</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7
<link rel="home" href="index.html" title="libdmapsharing Reference Manual">
8
<link rel="up" href="ch02.html" title="Libdmapsharing Browsing Overview">
9
<link rel="prev" href="browserapi.html" title="mDNS Browser API">
10
<link rel="next" href="connectedcb.html" title="Connected Callback">
11
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
12
<link rel="stylesheet" href="style.css" type="text/css">
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
16
<td><a accesskey="p" href="browserapi.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
17
<td><a accesskey="u" href="ch02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
18
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
19
<th width="100%" align="center">libdmapsharing Reference Manual</th>
20
<td><a accesskey="n" href="connectedcb.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
22
<div class="refentry">
23
<a name="serviceaddedcb"></a><div class="titlepage"></div>
24
<div class="refnamediv"><table width="100%"><tr>
26
<h2><span class="refentrytitle">Service Added Callback</span></h2>
27
<p>Service Added Callback —
28
Defining a Service Added Callback
31
<td valign="top" align="right"></td>
33
<div class="refsect1">
34
<a name="id583518"></a><h2>Service Added Callback</h2>
36
A "service-added" callback should create a media DB and a record
37
factory. Both of these objects will be passed to dmap_connection_new. This
38
object will interact with a DMAP share and populate the media DB. In
39
order to instruct the object to begin interrogating the DMAP service,
40
call the dmap_connection_connect function and pass it a "connected"
41
callback. The following is a simple "service-added" callback that creates
47
service_added_cb (DMAPMdnsBrowser *browser,
48
DMAPMdnsBrowserService *service,
51
DMAPRecordFactory *factory;
55
db = DMAP_DB (my_dmap_db_new ());
57
g_error ("Error creating DB");
60
factory = DMAP_RECORD_FACTORY (my_daap_record_factory_new ());
61
if (factory == NULL) {
62
g_error ("Error creating record factory");
64
conn = DMAP_CONNECTION (dmap_connection_new (service->name,
70
dmap_connection_connect (DMAP_CONNECTION (conn),
71
(DMAPConnectionCallback) connected_cb,
79
Generated by GTK-Doc V1.17</div>
b'\\ No newline at end of file'