GMTCTripModel Class Reference

GMTCTripModel Class Reference

Overview

A class representing a trip session.

A trip session will provide trip info update periodically after started, it can be either a ridesharing or a delivery trip, and each trip session is identified by a TripName.

Public Member Functions

(void) - registerSubscriber:
 Register an instance of GMTCTripModelSubscriber for this session.
(void) - unregisterSubscriber:
 Unregister an instance of GMTCTripModelSubscriber for this session, for avoiding the callback.

Properties

GMTCTripModelState state
 Returns the current session state.
GMTSTripcurrentTrip
 Returns the current trip data.
NSString * tripName
 Returns the associated trip name.
GMTCMutableTripModelOptionsoptions
 Specifies the options of the current trip session.

Member Function Documentation

- (void) registerSubscriber: (id< GMTCTripModelSubscriber >)  subscriber

Register an instance of GMTCTripModelSubscriber for this session.

Call this API before you can get any callbacks. This method is only allowed to be called in the main thread.

Note that the tripModel will be active (e.g. trip data is being updated/refreshed) automatically once a subscriber is registered.

Parameters:
subscriberThe instance of GMTCTripModelSubscriber to be registered.
- (void) unregisterSubscriber: (id< GMTCTripModelSubscriber >)  subscriber

Unregister an instance of GMTCTripModelSubscriber for this session, for avoiding the callback.

This is recommended when the instance of GMTCTripModelSubscriber needs to be dealloced. This method is only allowed to be called in the main thread.

Note that if there are no subscribers registered, the tripModel will automatically stop the trip session.

Parameters:
subscriberThe instance of GMTCTripModelSubscriber to be registered.

Property Documentation

- (GMTCTripModelState) state [read, assign]

Returns the current session state.

- (GMTSTrip*) currentTrip [read, assign]

Returns the current trip data.

- (NSString*) tripName [read, assign]

Returns the associated trip name.

- (GMTCMutableTripModelOptions*) options [read, assign]

Specifies the options of the current trip session.

This property should only be accessed in the main thread.