DEPRECATED: Diffusion iOS Classic API  5.9.4
 All Data Structures Files Functions Variables Enumerations Enumerator Properties Macros Pages
DFPagedTopicHandler.h
1 //
2 // DFPagedTopicHandler.h
3 // DiffusionTransport
4 //
5 // Created by Martin Cowie on 05/01/2012 - Diffusion 5.9.4_01
6 // Copyright (c) 2013 Push Technology Ltd. All rights reserved.
7 //
8 
9 #import "DFTopicListenerDelegate.h"
10 #import "DFPagedTopicDelegate.h"
11 
12 /**
13  * Paging Options
14  *
15  * @author Martin Cowie - 6 Jan 2012
16  * @since 4.1
17  */
18 typedef enum {
19  REFRESH, /**< Refresh the current page */
20  NEXT, /**< Move to next page. If no next page then this has the same effect as REFRESH */
21  PRIOR, /**< Move to prior page. If no prior page then this has the same effect as REFRESH. */
22  FIRST, /**< Move to first page. */
23  LAST /**< Move to last page. */
24 } DFPageOption;
25 
26 @class DFClient;
27 
28 /**
29  * A Paged Topic Handler.
30  * <P>
31  * This is an object which is used to send commands to a 'paged' Topic.
32  * (see PagedTopicData). The handler simplifies the use of such a
33  * Topic and avoids having to format messages to send to the Topic or parse
34  * messages received from it.
35  * <P>
36  * Such a handler is created using
37  * [DFClient createPagedTopicHandlerWithMessage:andDelegate]
38  * and all notifications from the Topic will be routed through the supplied
39  * listener.
40  * <P>
41  * When such a handler is in use then messages received on the Topic will not
42  * be delivered to the DFClientListener delegate declared to the DFClient object.
43  *
44  * @author Martin Cowie - created 6 Jan 2012
45  * @since 4.1
46  */
48 
49 @property(weak, readonly,nonatomic) DFClient* connection; /**< Get the connection (the client object that created the handler). */
50 @property(readonly,nonatomic) NSString *topicName; /**< Get the topic-name associated with this handler. */
51 
52 
53 /**
54  * Open the Topic.
55  * <P>
56  * This is used to request the initial page and then receive updates.
57  * Updates will be received until [close] is called or the Topic is
58  * unsubscribed.
59  * <P>
60  * If the Topic is already open then this may be called again to resubmit
61  * with a different number of lines if required.
62  *
63  * @param linesPerPage the number of lines required per page. This must be a
64  * positive value.
65  *
66  * @param page specifies the first page to be sent. This can be an
67  * absolute page number (from 1 to n) or -1 to indicate the current last
68  * page. The resulting page will be received on the
69  * [DFPagedTopicDelegate pageWithLines:status:handler:]
70  * method of the associated listener.
71  *
72  * @throws DFException if linesPerPage is not positive
73  */
74 -(void)openLinesPerPage:(int)linesPerPage onPage:(int)page;
75 
76 /**
77  * Requests a page, relative to the current page.
78  * <P>
79  * The resulting page will be received on the
80  * [DFPagedTopicDelegate pageWithLines:status:handler:]
81  * method of the associated delegate.
82  *
83  * @param pageOption specifies the page option required.
84  *
85  * @throws DFException if the Topic is not open or the request fails.
86  */
87 -(void)page:(DFPageOption)pageOption;
88 
89 /**
90  * Requests a page by absolute page number.
91  *
92  * @param pageNumber the page number or -1 to indicate the last page.
93  *
94  * @throws DFException if the Topic is not open or the request fails.
95  */
96 -(void)pageNumber:(int)pageNumber;
97 
98 /**
99  * Close the Topic.
100  * <P>
101  * The Topic will remain subscribed but no more notifications will be
102  * received and no requests can be sent.
103  *
104  * @throws DFException if unable to send close request
105  */
106 -(void)close;
107 
108 @end