The use of the service is twofold.
First, the service provides an access to the local transport network information. This includes the static and real-time information about the public transport schedules and their deviations, information about parking structures and their real-time filling, information about road works and blocks, etc.
Second, it provides the functionality of multimodal route planner, enabling planning for public transport and a car, bycicle routes, considering also the bike sharing stations and parkings near by, etc. Besides, the service allows the user to store the planned routes and perform their monitoring, signalling possible problems (e.g., delays, strikes, accidents, etc).
Note that these functionalities are strongly related: the multimodal route planner takes the real-time information into account either directly during the plan construction or through the warnings that are shown/notified to the user with respect to her plan.
Corresponding to these functionalities the service operates the following data structures:
The following data structures are operated by the service.
Public transport network relies on the concept of agency, which logically corresponds to a public entity managing certain mobility network systems. Each agency is identified with its agencyId. Currently, the following agencies are due:
Agency ID | Agency description |
---|---|
12 | Trento City Bus (TrentinoTrasporti) |
10 | Trento-Male' railway (FTM di TrentinoTrasporti) |
5 | Bolzano-Verona railway line (Trenitalia) |
6 | Trento-Bassano di Grappa railway line (Trenitalia) |
16 | Rovereto City Bus (TrentinoTrasporti) |
17 | Trentino Intercity Bus (TrentinoTrasporti) |
COMUNE_DI_TRENTO | Parkings of Trento |
COMUNE_DI_ROVERETO | Parkings of Rovereto |
BIKE_SHARING_TRENTO | Bike sharing stations of Trento |
BIKE_SHARING_ROVERETO | Bike sharing stations of Rovereto |
CAR_SHARING_SERVICE | Car sharing stations of Trento |
Another important type of information is the transport type enumeration. Currently, the following types are considered:
Value | Description |
---|---|
CAR | Private car |
BICYCLE | Bicycle |
TRANSIT | Public transport |
SHAREDBIKE | Bicycle with a constraint to move between bike sharing points |
SHAREDBIKE_WITHOUT_STATION | Shared bicycle with a constraint to move from a bike sharing point |
CARWITHPARKING | Private car with a constraint to move to a parking close to destination |
SHAREDCAR | Shared car with a constraint to move between car sharing points |
SHAREDCAR_WITHOUT_STATION | Shared car with a constraint to move from a car sharing point |
BUS | Public bus, a subset of public transport |
TRAIN | Trains, a subset of public transport |
WALK | pedestrian walk |
SHUTTLE | Shuttle bus, a subset of public transport |
GONDOLA | Auxiliary transports, such as cable cars |
USER
key specifies that the delay is signaled by the users, while SERVICE
specifies that the delay info is obtained from external (transport provider) source. The value is in minutes (string).The data structures below represent the real time updates that can be signaled to the system: delays, strikes, accidents, etc. These structures, or alerts have the following common elements:
USER
or SERVICE
.DELAY
, ACCIDENT
, ROAD
, STRIKE
, PARKING
or CUSTOM
.Besides, the specific alert types define additional fields:
ROAD_BLOCK
, PARKING_BLOCK
, DRIVE_CHANGE
, OTHER
.These data structures represent the route plans and the user-defined information on top of those, such as, e.g., monitoring instructions. Specifically, the following structures are due
fastest
, healthy
, leastWalking
, leastChanges
, greenest
, safest
. fastest
, healthy
, leastWalking
, leastChanges
, greenest
, safest
. The following operations are allowed
These scenarios allow one to signal the real-time information relevant for monitored/planned trips.
Currently, the following notifications are possible for the different object types:
The notifications will contain the following data (see Communicator Service for the detailed description of the notification attributes):
The requests are emitted to the following endpoint:
https://dev.smartcommunitylab.it/core.mobility
The method allows for retrieving the information about transport agency lines.
Parameters
Request
GET /core.mobility/getroutes/{agencyId} HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user or client access token}
Response (list of Route structures)
[ { "id": { "id":"01", "agency":"12" }, "routeLongName":"Roncafort - P.Dante - Osp.S.Chiara- Roncafort", "routeShortName":"1" }, { "id": { "id":"10R", "agency":"12" }, "routeLongName":"Cognola / Montevaccino - Martignano - P.Dante", "routeShortName":"10" }, ... ]
The method allows for retrieving the information about transport agency stops across the specific line.
Parameters
Request
GET /core.mobility/getstops/{agencyId}/{routeId} HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user or client access token}
Response (list of Stop structures)
[ { "name":"RONCAFORT nord", "id":"22500c", "latitude":46.103456, "longitude":11.100248 }, { "name":"GARDOLO P.le Neufahrn", "id":"22055n", "latitude":46.106678, "longitude":11.111444 }, { "name":"GARDOLO \"campo sportivo", "id":"22005z", "latitude":46.105677, "longitude":11.107554 } ]
The method allows for retrieving the information about transport agency stops within specific area.
Parameters
Request
GET /core.mobility/geostops/{agencyId}?lat=<lat>&lng=<lng>&radius=<radius>&page=<page>&count=<count> HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user or client access token}
Response (list of Stop structures)
[ { "name":"RONCAFORT nord", "id":"22500c", "latitude":46.103456, "longitude":11.100248 }, { "name":"GARDOLO P.le Neufahrn", "id":"22055n", "latitude":46.106678, "longitude":11.111444 }, { "name":"GARDOLO \"campo sportivo", "id":"22005z", "latitude":46.105677, "longitude":11.107554 } ]
The method allows for retrieving the information about the time at which the specified transport line passes the specified stop (currently, plus/minus 1 hour).
Parameters
Request
GET /core.mobility/gettimetable/{agencyId}/{routeId}/{stopId} HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user or client access token}
Response (list of StopTime structures)
[ { "name":"RONCAFORT nord", "id":"22500c", "latitude":46.103456, "longitude":11.100248 }, { "name":"GARDOLO P.le Neufahrn", "id":"22055n", "latitude":46.106678, "longitude":11.111444 }, { "name":"GARDOLO \"campo sportivo", "id":"22005z", "latitude":46.105677, "longitude":11.107554 } ]
The method allows for retrieving the information about next transports passing the specified stop.
Parameters
Request
GET /core.mobility/getlimitedtimetable/{agencyId}/{stopId}/{results} HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user or client access token}
Response (list of TripData structures)
{ "01":{ "delays":{}, "name":"Roncafort - P.Dante - Osp.S.Chiara- Roncafort", "route":"1", "times":[ { "time":1377092520, "trip":{ "id":"01-Feriale_034", "agency":"12" } }, { "time":1377093960, "trip":{ "id":"01-Feriale_035", "agency":"12" } }, { "time":1377095520, "trip":{ "id":"01-Feriale_036", "agency":"12" } } ] } }
The method allows for retrieving the transport line timetable for the specified day. If the day matches current date, the available delay data is also included.
Parameters
Request
GET /core.mobility/gettransittimes/{routeId}/{timefrom}/{timeto} HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user or client access token}
Response (TimeTable structures)
{ "stops":[ "RONCAFORT nord", "GARDOLO P.le Neufahrn", "GARDOLO \"campo sportivo", "RONCAFORT", ... ], "stopsId":[ "22500c", "22055n", "22005z", "22505c", ... ], "times":[ [ [ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "06:48", "06:50", "06:54", "06:55", "06:56", "06:59", "07:00", "07:01", "07:02", "07:03", "", "", "", "" ], ... ] ], "tripIds":[ [ "01-Feriale_002", "01-Feriale_005", "01-Feriale_003", "01-Feriale_004", .... ] ], "delays":[ [ {}, {}, {}, {}, ... ] ] }
The method allows for retrieving the information about transport line delays for the specified time interval.
Parameters
Request
GET /core.mobility/gettransitdelays/{routeId}/{timefrom}/{timeto} HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user or client access token}
Response (TimeTable structure, with all fields but delays empty)
{ "stops":null, "stopsId":null, "times":null, "tripIds":null, "delays":[ [ { "user": "5", "service": "3" }, { "service": "2" }, {}, {}, ... ] ] }
The method allows for retrieving the information about transport line timetable of the current date with the real-time delay information.
Parameters
Request
GET /core.mobility/timetable/{agencyId}/{routeId} HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user or client access token}
Response (Day TimeTable structure). Defines the list of stops and stop IDs, and list of trip times with trip delay (if any).
{ "stopIds": [ "TRENTO_STATION_FTM", "TRENTO_NORD", "GARDOLO", "Zona_Industriale", ... ], "stopNames": [ "Trento Train Station FTM", "TRENTO NORD - Zona Comm.le", "GARDOLO Ferrovia", "Spini Zona Industriale Ferrovia", ... ], "trips": [ { "tripId": "302", "delay": { "SERVICE": "1" }, "stopTimes": [ "05:31", "05:33", "05:37", "05:39", "05:40", "05:43", "05:47", "05:50", "05:54", "05:57", "06:00", "06:03", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" ] }, ... ] }
The method allows for retrieving the list of car parking with optionally the real-time availability data.
Parameters
Request
GET /core.mobility/getparkingsbyagency/{agencyId} HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user or client access token}
Response (list of Parking structures)
[ { "name":"via Roggia Grande,16 - Trento", "position":[ 46.0676, 11.1247 ], "description":"via Roggia Grande,16 - Trento", "monitored":false, "slotsTotal":100, "slotsAvailable":0 }, { "name":"P7", "position":[ 46.0657, 11.1145 ], "description":"Piazzale Roberto da Sanseverino - Trento", "monitored":true, "slotsTotal":342, "slotsAvailable":136 }, ... ]
The method allows for retrieving the list of bikesharing stations with the real-time availability data.
Parameters
Request
GET /core.mobility/bikesharing/{cityname} HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json
Response (list of Station structures)
[ { "name": "Brione", "address": "Via Perosi / Via Puccini", "id": "1153", "bikes": 1, "slots": 5, "totalSlots": 6, "position": [ 45.90421911950808, 11.044299836454002 ] }, ... ]
The method allows for retrieving the list of work roads, deviations, road blocks, etc.
Parameters
Request
GET /core.mobility/getroadinfobyagency/{agencyId}/{from}/time HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user or client access token}
Response (list of AlertRoad structures)
[ { "agencyId":"COMUNE_DI_ROVERETO", "road":{ "note":"", "lat":"45.894037", "lon":"11.043587", "streetCode":"290", "street":"CORSO BETTINI A.", "fromNumber":"", "toNumber":"", "fromIntersection":"", "toIntersection":"" }, "changeTypes":[ "PARKING_BLOCK", "ROAD_BLOCK" ], "id":"612005_290", "type":null, "entity":null, "description":"UFFICIO ATTIVITA' PRODUTTIVE: DIVIETO DI TRANSITO E DI SOSTA CON RIMOZIONE COATTA IN CORSO BETTINI, IN VIALE TRENTO E NELLE STRADE LIMITROFE A ROVERETO PER LO SVOLGIMENTO DEL MERCATO SETTIMANALE DEL MARTEDI'.", "from":1372543200000, "to":1378764000000, "creatorId":"default", "creatorType":"SERVICE", "effect":"Temporanea", "note":null }, ... ]
The method allows for retrieving the list of taxi stations.
Request
GET /core.mobility/getTaxiStation/ HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user or client access token}
Response (list of Taxi stop structures)
[ { "id": "via Degasperi 77@TAXI_TRENTO", "stationId": { "agencyId": "TAXI_TRENTO", "id": "via Degasperi 77", "extra": null }, "type": "TAXI", "fullName": null, "location": [ 46.044135, 11.129531 ], "taxis": 0, "monitored": false, "address": "via Degasperi 77" }, ... ]
The method allows for retrieving the taxi contact information for different taxy agencies.
Request
GET /core.mobility/getTaxiAgencyContacts/ HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user or client access token}
Response (list of Taxi contacts structures)
[ { "id": "Cooperativa", "name": "Cooperativa Radio Taxi", "agencyId": "TAXI_TRENTO", "phone": [ "0461930002" ], "sms": [ "3409949655" ] },, ... ]
The requests are emitted to the following endpoint:
https://dev.smartcommunitylab.it/core.mobility
The method allows for signalling an arbitrary alert (delay, strike, accident, road work, parking availability) as a user.
Permission
mobilityservice.user.alert
Parameters
Request
POST /core.mobility/alert/user HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user access token} { "position":{ "lon":"11.100248", "stopId":{ "id":"22500c", "agencyId":"12" }, "name":"RONCAFORT nord", "stopCode":"22500c", "lat":"46.103456" }, "id":"71d6a009-dec9-4e1b-bd3b-d69ca65826e4", "to":1377094660792, "effect":"effect", "transport":{ "tripId":"01-Feriale_036", "routeShortName":"01", "routeId":"01", "type":"BUS", "agencyId":"12" }, "description":"description", "creatorId":"1", "delay":300000, "creatorType":"USER", "from":1377094360792, "type":"DELAY", "note":"note" }
Response: empty
The method allows for signalling an arbitrary alert (delay, strike, accident, road work, parking availability) as a service provider.
Permission
mobilityservice.service.alert
Parameters
Request
POST /core.mobility/alert/service HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {client access token} { "position":{ "lon":"11.100248", "stopId":{ "id":"22500c", "agencyId":"12" }, "name":"RONCAFORT nord", "stopCode":"22500c", "lat":"46.103456" }, "id":"71d6a009-dec9-4e1b-bd3b-d69ca65826e4", "to":1377094660792, "effect":"effect", "transport":{ "tripId":"01-Feriale_036", "routeShortName":"01", "routeId":"01", "type":"BUS", "agencyId":"12" }, "description":"description", "creatorId":"1", "delay":300000, "creatorType":"USER", "from":1377094360792, "type":"DELAY", "note":"note" }
Response: empty
The requests are emitted to the following endpoint:
https://dev.smartcommunitylab.it/core.mobility
The method allows for planning journey given the input requirements (SingleJourney structure).
Parameters
Request
POST /core.mobility/plansinglejourney HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user or client access token} { "to":{ "lon":"11.11889", "stopId":null, "name":null, "stopCode":null, "lat":"46.066695" }, "routeType":"fastest", "resultsNumber":1, "departureTime":"04:25PM", "from":{ "lon":"11.151796", "stopId":null, "name":null, "stopCode":null, "lat":"46.066799" }, "date":"08/21/2013", "transportTypes":[ "TRANSIT", "BICYCLE" ] }
Response (list of Itinerary objects)
[ { "from":{ "name":"service road", "stopId":{ "agencyId":"", "id":"" }, "stopCode":"null", "lon":"11.151824063634374", "lat":"46.06679860551396" }, "to":{ "name":"corner of path and sidewalk", "stopId":{ "agencyId":"", "id":"" }, "stopCode":"null", "lon":"11.11889", "lat":"46.066695" }, "startime":1377095100000, "endtime":1377096112000, "duration":1012000, "walkingDuration":1012, "leg":[ { "legId":"null_null", "startime":1377095100000, "endtime":1377095716000, "duration":616000, "from":{ "name":"service road", "stopId":null, "stopCode":"null", "lon":"11.151824063634374", "lat":"46.06679860551396" }, "to":{ "name":"Via Benedetto Giovanelli", "stopId":null, "stopCode":"null", "lon":"11.1311699", "lat":"46.0642586" }, "transport":{ "type":"BICYCLE", "agencyId":"null", "routeId":"null", "routeShortName":"null", "tripId":"null" }, "legGeometery":{ "length":107, "levels":"null", "points":"mldxG{aacAoAAg@ZCpCCx@?b@QA?dAExA@j@Bp@Jl@Tb@Xh@ZPV^Ll@HfAFNl@F^@LbADfAA^[~@WbAOx@Gl@@~@Dj@Lt@Pj@HX@`B?\\?dA?n@Hn@JZHHHX@F?DUACFIp@E^Ih@KPKHKTG^S|@Kl@M|AAPKNQj@Mt@E^Af@?f@FBD@CFIVKNBJFT?xACt@E`@INYBEH@J`@j@F@HEjA}@J@?Pe@vA@\\DV^R`@f@fA^bAdBRTx@VXRV\\JTFHF~D?dAGz@^Dt@Pp@PZhBJjB@V@hBK|BAR" }, "alertStrikeList":[], "alertDelayList":[], "alertParkingList":[], "alertRoadList":[], "alertAccidentList":[] }, { "legId":"null_null", "startime":1377095716000, "endtime":1377095722000, "duration":6000, "from":{ "name":"Via Benedetto Giovanelli", "stopId":{ "agencyId":"", "id":"" }, "stopCode":"null", "lon":"11.1311791", "lat":"46.0643067" }, "to":{ "name":"Via Fiume", "stopId":{ "agencyId":"", "id":"" }, "stopCode":"null", "lon":"11.1311967", "lat":"46.0640542" }, "transport":{ "type":"WALK", "agencyId":"null", "routeId":"null", "routeShortName":"null", "tripId":"null" }, "legGeometery":{ "length":2, "levels":"null", "points":"{|cxGy`}bAH@" }, " "alertStrikeList":[], "alertDelayList":[], "alertParkingList":[], "alertRoadList":[], "alertAccidentList":[] }, { "legId":"null_null", "startime":1377095722000, "endtime":1377096112000, "duration":390000, "from":{ "name":"Via Fiume", "stopId":null, "stopCode":"null", "lon":"11.1311699", "lat":"46.0642586" }, "to":{ "name":"corner of path and sidewalk", "stopId":null, "stopCode":"null", "lon":"11.11889", "lat":"46.066695" }, "transport":{ "type":"BICYCLE", "agencyId":"null", "routeId":"null", "routeShortName":"null", "tripId":"null" }, "legGeometery":{ "length":39, "levels":"null", "points":"q|cxGw`}bAf@ENHLRBJBN?BOvAIjAg@nFa@|DIPyA|OIbAEV[lG?N@NBVETUBG@{@jICLAH]@g@?Y?b@hJG?IAQBE?E@}AR@TOB@b@I@" }, "alertStrikeList":[], "alertDelayList":[], "alertParkingList":[], "alertRoadList":[], "alertAccidentList":[] } ] } , ... ]
The method allows for planning a recurrent journey given the input requirements (RecurrentJourneyParameters structure).
Parameters
Request
POST /core.mobility/planrecurrent HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user or client access token} { "to":{ "lon":"11.11889", "stopId":null, "name":null, "stopCode":null, "lat":"46.066695" }, "time":"04:30PM", "routeType":"fastest", "recurrence":[ 1, 2, 3, 4, 5, 6, 7 ], "interval":3600000, "fromDate":1377095453280, "resultsNumber":3, "from":{ "lon":"11.151796", "stopId":null, "name":null, "stopCode":null, "lat":"46.066799" }, "toDate":1377700254728, "transportTypes":[ "TRANSIT", "BICYCLE" ] }
Response (RecurrentJourney structure)
{ "parameters":{ "recurrence":[ 1, 2, 3, 4, 5, 6, 7 ], "from":{ "name":null, "stopId":null, "stopCode":null, "lon":"11.151796", "lat":"46.066799" }, "to":{ "name":null, "stopId":null, "stopCode":null, "lon":"11.11889", "lat":"46.066695" }, "fromDate":1377095453280, "toDate":1377700254728, "time":"04:30PM", "interval":3600000, "transportTypes":[ "TRANSIT", "BICYCLE" ], "routeType":"fastest", "resultsNumber":3 }, "legs":[ { "from":"POVO \"Fac. Scienze\"", "to":"Piazza Dante Dogana", "transport":{ "type":"BUS", "agencyId":"12", "routeId":"05R", "routeShortName":"5", "tripId":"05R-Feriale_045" } }, { "from":"Piazza Dante \"Stazione FS\"", "to":"Rosmini S.Maria Maggiore", "transport":{ "type":"BUS", "agencyId":"12", "routeId":"09A", "routeShortName":"9", "tripId":"09A-Feriale_032" } }, { "from":"POVO \"Fac. Scienze\"", "to":"Piazza Dante Dogana", "transport":{ "type":"BUS", "agencyId":"12", "routeId":"05R", "routeShortName":"5", "tripId":"05R-Feriale_047" } }, { "from":"Piazza Dante \"Stazione FS\"", "to":"Rosmini S.Maria Maggiore", "transport":{ "type":"BUS", "agencyId":"12", "routeId":"09A", "routeShortName":"9", "tripId":"09A-Feriale_033" } }, { "from":"POVO \"Fac. Scienze\"", "to":"Piazza Dante Dogana", "transport":{ "type":"BUS", "agencyId":"12", "routeId":"05R", "routeShortName":"5", "tripId":"05R-Feriale_049" } }, { "from":"Povo Mesiano FS", "to":"Trento FS", "transport":{ "type":"TRAIN", "agencyId":"6", "routeId":"TB_R2_R", "routeShortName":"RG", "tripId":"R5840" } }, { "from":"Piazza Dante \"Stazione FS\"", "to":"Rosmini S.Maria Maggiore", "transport":{ "type":"BUS", "agencyId":"12", "routeId":"05A", "routeShortName":"5", "tripId":"05A-Feriale_056" } }, { "from":"POVO Piazza Manci", "to":"Rosmini \"Cimitero\"", "transport":{ "type":"BUS", "agencyId":"12", "routeId":"13R", "routeShortName":"13", "tripId":"13R-Feriale_021" } }, { "from":"Povo-Mesiano (Stazione F.S.)", "to":"Trento (Stazione Fs)", "transport":{ "type":"BUS", "agencyId":"17", "routeId":"521_ExUr", "routeShortName":"401", "tripId":"0001129442011062520110910" } }, { "from":"service road", "to":"Via Benedetto Giovanelli", "transport":{ "type":"BICYCLE", "agencyId":"null", "routeId":"null", "routeShortName":"null", "tripId":"null" } } ], "monitorLegs":{ "12_05A":true, "12_05R":true, "12_09A":true, "12_13R":true, "17_521_ExUr":true, "6_TB_R2_R":true } }
The requests are emitted to the following endpoint:
https://dev.smartcommunitylab.it/core.mobility
The method allows the user to store a single journey for, e.g., monitoring purposes.
Permission
mobilityservice.user.itinerary.write
Parameters
Request
POST /core.mobility/itinerary HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user access token} { "monitor":true, "originalTo":{ "lon":"11.11889", "stopId":null, "name":null, "stopCode":null, "lat":"46.066695" }, "name":"test", "data":{ "to":{ "lon":"11.11889", "stopId":{ "id":"", "agencyId":"" }, "name":"corner of path and sidewalk", "stopCode":"null", "lat":"46.066695" }, "endtime":1377099352000, "leg":[ { "to":{ "lon":"11.1311699", "stopId":null, "name":"Via Benedetto Giovanelli", "stopCode":"null", "lat":"46.0642586" }, "endtime":1377098956000, "alertParkingList":[ ], "duration":616000, "startime":1377098340000, "transport":{ "tripId":"null", "routeShortName":"null", "routeId":"null", "type":"BICYCLE", "agencyId":"null" }, "alertDelayList":[ ], "alertStrikeList":[ ], "from":{ "lon":"11.151824063634374", "stopId":null, "name":"service road", "stopCode":"null", "lat":"46.06679860551396" }, "legGeometery":{ "levels":"null", "length":107, "points":"mldxG{aacAoAAg@ZCpCCx@?b@QA?dAExA@j@Bp@Jl@Tb@Xh@ZPV^Ll@HfAFNl@F^@LbADfAA^[~@WbAOx@Gl@@~@Dj@Lt@Pj@HX@`B?\\?dA?n@Hn@JZHHHX@F?DUACFIp@E^Ih@KPKHKTG^S|@Kl@M|AAPKNQj@Mt@E^Af@?f@FBD@CFIVKNBJFT?xACt@E`@INYBEH@J`@j@F@HEjA}@J@?Pe@vA@\\DV^R`@f@fA^bAdBRTx@VXRV\\JTFHF~D?dAGz@^Dt@Pp@PZhBJjB@V@hBK|BAR" }, "legId":"null_null" }, { "to":{ "lon":"11.1311967", "stopId":{ "id":"", "agencyId":"" }, "name":"Via Fiume", "stopCode":"null", "lat":"46.0640542" }, "endtime":1377098962000, "alertParkingList":[ ], "duration":6000, "startime":1377098956000, "transport":{ "tripId":"null", "routeShortName":"null", "routeId":"null", "type":"WALK", "agencyId":"null" }, "alertDelayList":[ ], "alertStrikeList":[ ], "from":{ "lon":"11.1311791", "stopId":{ "id":"", "agencyId":"" }, "name":"Via Benedetto Giovanelli", "stopCode":"null", "lat":"46.0643067" }, "legGeometery":{ "levels":"null", "length":2, "points":"{|cxGy`}bAH@" }, "legId":"null_null" }, { "to":{ "lon":"11.11889", "stopId":null, "name":"corner of path and sidewalk", "stopCode":"null", "lat":"46.066695" }, "endtime":1377099352000, "alertParkingList":[ ], "duration":390000, "startime":1377098962000, "transport":{ "tripId":"null", "routeShortName":"null", "routeId":"null", "type":"BICYCLE", "agencyId":"null" }, "alertDelayList":[ ], "alertStrikeList":[ ], "from":{ "lon":"11.1311699", "stopId":null, "name":"Via Fiume", "stopCode":"null", "lat":"46.0642586" }, "legGeometery":{ "levels":"null", "length":39, "points":"q|cxGw`}bAf@ENHLRBJBN?BOvAIjAg@nFa@|DIPyA|OIbAEV[lG?N@NBVETUBG@{@jICLAH]@g@?Y?b@hJG?IAQBE?E@}AR@TOB@b@I@" }, "legId":"null_null" } ], "duration":1012000, "startime":1377098340000, "walkingDuration":1012, "from":{ "lon":"11.151824063634374", "stopId":{ "id":"", "agencyId":"" }, "name":"service road", "stopCode":"null", "lat":"46.06679860551396" } }, "originalFrom":{ "lon":"11.151796", "stopId":null, "name":null, "stopCode":null, "lat":"46.066799" } }
Response (saved BasicJourney structure)
{ "clientId":"5214daa4975a4023840002a2", "data":{ "from":{ "name":"service road", "stopId":{ "agencyId":"", "id":"" }, "stopCode":"null", "lon":"11.151824063634374", "lat":"46.06679860551396" }, "to":{ "name":"corner of path and sidewalk", "stopId":{ "agencyId":"", "id":"" }, "stopCode":"null", "lon":"11.11889", "lat":"46.066695" }, "startime":1377098340000, "endtime":1377099352000, "duration":1012000, "walkingDuration":1012, "leg":[ { "legId":"null_null", "startime":1377098340000, "endtime":1377098956000, "duration":616000, "from":{ "name":"service road", "stopId":null, "stopCode":"null", "lon":"11.151824063634374", "lat":"46.06679860551396" }, "to":{ "name":"Via Benedetto Giovanelli", "stopId":null, "stopCode":"null", "lon":"11.1311699", "lat":"46.0642586" }, "transport":{ "type":"BICYCLE", "agencyId":"null", "routeId":"null", "routeShortName":"null", "tripId":"null" }, "legGeometery":{ "length":107, "levels":"null", "points":"mldxG{aacAoAAg@ZCpCCx@?b@QA?dAExA@j@Bp@Jl@Tb@Xh@ZPV^Ll@HfAFNl@F^@LbADfAA^[~@WbAOx@Gl@@~@Dj@Lt@Pj@HX@`B?\\?dA?n@Hn@JZHHHX@F?DUACFIp@E^Ih@KPKHKTG^S|@Kl@M|AAPKNQj@Mt@E^Af@?f@FBD@CFIVKNBJFT?xACt@E`@INYBEH@J`@j@F@HEjA}@J@?Pe@vA@\\DV^R`@f@fA^bAdBRTx@VXRV\\JTFHF~D?dAGz@^Dt@Pp@PZhBJjB@V@hBK|BAR" }, "alertStrikeList":[ ], "alertDelayList":[ ], "alertParkingList":[ ], "alertRoadList":null, "alertAccidentList":null }, { "legId":"null_null", "startime":1377098956000, "endtime":1377098962000, "duration":6000, "from":{ "name":"Via Benedetto Giovanelli", "stopId":{ "agencyId":"", "id":"" }, "stopCode":"null", "lon":"11.1311791", "lat":"46.0643067" }, "to":{ "name":"Via Fiume", "stopId":{ "agencyId":"", "id":"" }, "stopCode":"null", "lon":"11.1311967", "lat":"46.0640542" }, "transport":{ "type":"WALK", "agencyId":"null", "routeId":"null", "routeShortName":"null", "tripId":"null" }, "legGeometery":{ "length":2, "levels":"null", "points":"{|cxGy`}bAH@" }, "alertStrikeList":[ ], "alertDelayList":[ ], "alertParkingList":[ ], "alertRoadList":null, "alertAccidentList":null }, { "legId":"null_null", "startime":1377098962000, "endtime":1377099352000, "duration":390000, "from":{ "name":"Via Fiume", "stopId":null, "stopCode":"null", "lon":"11.1311699", "lat":"46.0642586" }, "to":{ "name":"corner of path and sidewalk", "stopId":null, "stopCode":"null", "lon":"11.11889", "lat":"46.066695" }, "transport":{ "type":"BICYCLE", "agencyId":"null", "routeId":"null", "routeShortName":"null", "tripId":"null" }, "legGeometery":{ "length":39, "levels":"null", "points":"q|cxGw`}bAf@ENHLRBJBN?BOvAIjAg@nFa@|DIPyA|OIbAEV[lG?N@NBVETUBG@{@jICLAH]@g@?Y?b@hJG?IAQBE?E@}AR@TOB@b@I@" }, "alertStrikeList":[ ], "alertDelayList":[ ], "alertParkingList":[ ], "alertRoadList":null, "alertAccidentList":null } ] }, "monitor":true, "originalFrom":{ "name":null, "stopId":null, "stopCode":null, "lon":"11.151796", "lat":"46.066799" }, "originalTo":{ "name":null, "stopId":null, "stopCode":null, "lon":"11.11889", "lat":"46.066695" }, "name":"test" }
The method allows the user to read a single journey stored by the user.
Permission
mobilityservice.user.itinerary.read
Parameters
Request
GET /core.mobility/itinerary/{id} HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user access token}
Response (saved BasicJourney structure)
{ "clientId":"5214daa4975a4023840002a2", "data":{ "from":{ "name":"service road", "stopId":{ "agencyId":"", "id":"" }, "stopCode":"null", "lon":"11.151824063634374", "lat":"46.06679860551396" }, "to":{ "name":"corner of path and sidewalk", "stopId":{ "agencyId":"", "id":"" }, "stopCode":"null", "lon":"11.11889", "lat":"46.066695" }, "startime":1377098340000, "endtime":1377099352000, "duration":1012000, "walkingDuration":1012, "leg":[ { "legId":"null_null", "startime":1377098340000, "endtime":1377098956000, "duration":616000, "from":{ "name":"service road", "stopId":null, "stopCode":"null", "lon":"11.151824063634374", "lat":"46.06679860551396" }, "to":{ "name":"Via Benedetto Giovanelli", "stopId":null, "stopCode":"null", "lon":"11.1311699", "lat":"46.0642586" }, "transport":{ "type":"BICYCLE", "agencyId":"null", "routeId":"null", "routeShortName":"null", "tripId":"null" }, "legGeometery":{ "length":107, "levels":"null", "points":"mldxG{aacAoAAg@ZCpCCx@?b@QA?dAExA@j@Bp@Jl@Tb@Xh@ZPV^Ll@HfAFNl@F^@LbADfAA^[~@WbAOx@Gl@@~@Dj@Lt@Pj@HX@`B?\\?dA?n@Hn@JZHHHX@F?DUACFIp@E^Ih@KPKHKTG^S|@Kl@M|AAPKNQj@Mt@E^Af@?f@FBD@CFIVKNBJFT?xACt@E`@INYBEH@J`@j@F@HEjA}@J@?Pe@vA@\\DV^R`@f@fA^bAdBRTx@VXRV\\JTFHF~D?dAGz@^Dt@Pp@PZhBJjB@V@hBK|BAR" }, "alertStrikeList":[ ], "alertDelayList":[ ], "alertParkingList":[ ], "alertRoadList":null, "alertAccidentList":null }, { "legId":"null_null", "startime":1377098956000, "endtime":1377098962000, "duration":6000, "from":{ "name":"Via Benedetto Giovanelli", "stopId":{ "agencyId":"", "id":"" }, "stopCode":"null", "lon":"11.1311791", "lat":"46.0643067" }, "to":{ "name":"Via Fiume", "stopId":{ "agencyId":"", "id":"" }, "stopCode":"null", "lon":"11.1311967", "lat":"46.0640542" }, "transport":{ "type":"WALK", "agencyId":"null", "routeId":"null", "routeShortName":"null", "tripId":"null" }, "legGeometery":{ "length":2, "levels":"null", "points":"{|cxGy`}bAH@" }, "alertStrikeList":[ ], "alertDelayList":[ ], "alertParkingList":[ ], "alertRoadList":null, "alertAccidentList":null }, { "legId":"null_null", "startime":1377098962000, "endtime":1377099352000, "duration":390000, "from":{ "name":"Via Fiume", "stopId":null, "stopCode":"null", "lon":"11.1311699", "lat":"46.0642586" }, "to":{ "name":"corner of path and sidewalk", "stopId":null, "stopCode":"null", "lon":"11.11889", "lat":"46.066695" }, "transport":{ "type":"BICYCLE", "agencyId":"null", "routeId":"null", "routeShortName":"null", "tripId":"null" }, "legGeometery":{ "length":39, "levels":"null", "points":"q|cxGw`}bAf@ENHLRBJBN?BOvAIjAg@nFa@|DIPyA|OIbAEV[lG?N@NBVETUBG@{@jICLAH]@g@?Y?b@hJG?IAQBE?E@}AR@TOB@b@I@" }, "alertStrikeList":[ ], "alertDelayList":[ ], "alertParkingList":[ ], "alertRoadList":null, "alertAccidentList":null } ] }, "monitor":true, "originalFrom":{ "name":null, "stopId":null, "stopCode":null, "lon":"11.151796", "lat":"46.066799" }, "originalTo":{ "name":null, "stopId":null, "stopCode":null, "lon":"11.11889", "lat":"46.066695" }, "name":"test" }
The method allows the user to read all single journeys stored by the user.
Permission
mobilityservice.user.itinerary.read
Request
GET /core.mobility/itinerary HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user access token}
Response (list of saved BasicJourney structures)
[ { "clientId":"5214daa4975a4023840002a2", "data":{ "from":{ "name":"service road", "stopId":{ "agencyId":"", "id":"" }, "stopCode":"null", "lon":"11.151824063634374", "lat":"46.06679860551396" }, "to":{ "name":"corner of path and sidewalk", "stopId":{ "agencyId":"", "id":"" }, "stopCode":"null", "lon":"11.11889", "lat":"46.066695" }, "startime":1377098340000, "endtime":1377099352000, "duration":1012000, "walkingDuration":1012, "leg":[ { "legId":"null_null", "startime":1377098340000, "endtime":1377098956000, "duration":616000, "from":{ "name":"service road", "stopId":null, "stopCode":"null", "lon":"11.151824063634374", "lat":"46.06679860551396" }, "to":{ "name":"Via Benedetto Giovanelli", "stopId":null, "stopCode":"null", "lon":"11.1311699", "lat":"46.0642586" }, "transport":{ "type":"BICYCLE", "agencyId":"null", "routeId":"null", "routeShortName":"null", "tripId":"null" }, "legGeometery":{ "length":107, "levels":"null", "points":"mldxG{aacAoAAg@ZCpCCx@?b@QA?dAExA@j@Bp@Jl@Tb@Xh@ZPV^Ll@HfAFNl@F^@LbADfAA^[~@WbAOx@Gl@@~@Dj@Lt@Pj@HX@`B?\\?dA?n@Hn@JZHHHX@F?DUACFIp@E^Ih@KPKHKTG^S|@Kl@M|AAPKNQj@Mt@E^Af@?f@FBD@CFIVKNBJFT?xACt@E`@INYBEH@J`@j@F@HEjA}@J@?Pe@vA@\\DV^R`@f@fA^bAdBRTx@VXRV\\JTFHF~D?dAGz@^Dt@Pp@PZhBJjB@V@hBK|BAR" }, "alertStrikeList":[ ], "alertDelayList":[ ], "alertParkingList":[ ], "alertRoadList":null, "alertAccidentList":null }, { "legId":"null_null", "startime":1377098956000, "endtime":1377098962000, "duration":6000, "from":{ "name":"Via Benedetto Giovanelli", "stopId":{ "agencyId":"", "id":"" }, "stopCode":"null", "lon":"11.1311791", "lat":"46.0643067" }, "to":{ "name":"Via Fiume", "stopId":{ "agencyId":"", "id":"" }, "stopCode":"null", "lon":"11.1311967", "lat":"46.0640542" }, "transport":{ "type":"WALK", "agencyId":"null", "routeId":"null", "routeShortName":"null", "tripId":"null" }, "legGeometery":{ "length":2, "levels":"null", "points":"{|cxGy`}bAH@" }, "alertStrikeList":[ ], "alertDelayList":[ ], "alertParkingList":[ ], "alertRoadList":null, "alertAccidentList":null }, { "legId":"null_null", "startime":1377098962000, "endtime":1377099352000, "duration":390000, "from":{ "name":"Via Fiume", "stopId":null, "stopCode":"null", "lon":"11.1311699", "lat":"46.0642586" }, "to":{ "name":"corner of path and sidewalk", "stopId":null, "stopCode":"null", "lon":"11.11889", "lat":"46.066695" }, "transport":{ "type":"BICYCLE", "agencyId":"null", "routeId":"null", "routeShortName":"null", "tripId":"null" }, "legGeometery":{ "length":39, "levels":"null", "points":"q|cxGw`}bAf@ENHLRBJBN?BOvAIjAg@nFa@|DIPyA|OIbAEV[lG?N@NBVETUBG@{@jICLAH]@g@?Y?b@hJG?IAQBE?E@}AR@TOB@b@I@" }, "alertStrikeList":[ ], "alertDelayList":[ ], "alertParkingList":[ ], "alertRoadList":null, "alertAccidentList":null } ] }, "monitor":true, "originalFrom":{ "name":null, "stopId":null, "stopCode":null, "lon":"11.151796", "lat":"46.066799" }, "originalTo":{ "name":null, "stopId":null, "stopCode":null, "lon":"11.11889", "lat":"46.066695" }, "name":"test" }, ... ]
The method allows the user to switch journey monitoring on/off.
Permission
mobilityservice.user.itinerary.write
Parameters
Request
GET /core.mobility/itinerary/{id}/monitor/{monitor} HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user access token}
Response: monitoring status
true
The method allows the user to delete saved journey.
Permission
mobilityservice.user.itinerary.write
Parameters
Request
DELETE /core.mobility/itinerary/{id} HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user access token}
Response: result of the operation
true
The method allows the user to store a recurrent journey for, e.g., monitoring purposes.
Permission
mobilityservice.user.itinerary.write
Parameters
Request
POST /core.mobility/recurrent HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user access token} { "monitor":true, "name":"test", "data":{ "monitorLegs":{ "12_16R":true, "12_13R":true, "17_521_ExUr":true, "12_03A":true, "12_05A":true, "12_04A":true, "12_09A":true, "12_01":true, "12_09R":true, "6_TB_R2_R":true, "12_05R":true }, "legs":[ { "to":"Piazza Dante Dogana", "transport":{ "tripId":"05R-Feriale_051", "routeShortName":"5", "routeId":"05R", "type":"BUS", "agencyId":"12" }, "from":"POVO \"Fac. Scienze\"" }, ... ], "parameters":{ "to":{ "lon":"11.11889", "stopId":null, "name":"null", "stopCode":"null", "lat":"46.066695" }, "time":"05:31PM", "routeType":"fastest", "recurrence":[ 1, 2, 3, 4, 5, 6, 7 ], "interval":3600000, "fromDate":1377099062591, "resultsNumber":3, "from":{ "lon":"11.151796", "stopId":null, "name":"null", "stopCode":"null", "lat":"46.066799" }, "toDate":1377703862597, "transportTypes":[ "TRANSIT", "BICYCLE" ] } } }
Response (saved BasicRecurrentJourney structure)
{ "clientId":"5214e671975a4023840002a8", "data":{ "parameters":{ "recurrence":[ 1, 2, 3, 4, 5, 6, 7 ], "from":{ "name":"null", "stopId":null, "stopCode":"null", "lon":"11.151796", "lat":"46.066799" }, "to":{ "name":"null", "stopId":null, "stopCode":"null", "lon":"11.11889", "lat":"46.066695" }, "fromDate":1377101418001, "toDate":1377706218008, "time":"06:10PM", "interval":3600000, "transportTypes":[ "TRANSIT", "BICYCLE" ], "routeType":"fastest", "resultsNumber":3 }, "legs":[ { "from":"POVO \"Fac. Scienze\"", "to":"Piazza Dante Dogana", "transport":{ "type":"BUS", "agencyId":"12", "routeId":"05R", "routeShortName":"5", "tripId":"05R-Feriale_055" } }, ... ], "monitorLegs":{ "12_16R":true, "12_13R":true, "17_521_ExUr":true, "12_12A":true, "12_05A":true, "12_09A":true, "12_01":true, "12_09R":true, "6_TB_R2_R":true, "12_05R":true } }, "name":"test", "monitor":true }
The method allows the user to read a recurrent journey stored by the user.
Permission
mobilityservice.user.itinerary.read
Parameters
Request
GET /core.mobility/recurrent/{id} HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user access token}
Response (saved BasicRecurrentJourney structure)
{ "clientId":"5214e671975a4023840002a8", "data":{ "parameters":{ "recurrence":[ 1, 2, 3, 4, 5, 6, 7 ], "from":{ "name":"null", "stopId":null, "stopCode":"null", "lon":"11.151796", "lat":"46.066799" }, "to":{ "name":"null", "stopId":null, "stopCode":"null", "lon":"11.11889", "lat":"46.066695" }, "fromDate":1377101418001, "toDate":1377706218008, "time":"06:10PM", "interval":3600000, "transportTypes":[ "TRANSIT", "BICYCLE" ], "routeType":"fastest", "resultsNumber":3 }, "legs":[ { "from":"POVO \"Fac. Scienze\"", "to":"Piazza Dante Dogana", "transport":{ "type":"BUS", "agencyId":"12", "routeId":"05R", "routeShortName":"5", "tripId":"05R-Feriale_055" } }, ... ], "monitorLegs":{ "12_16R":true, "12_13R":true, "17_521_ExUr":true, "12_12A":true, "12_05A":true, "12_09A":true, "12_01":true, "12_09R":true, "6_TB_R2_R":true, "12_05R":true } }, "name":"test", "monitor":true }
The method allows the user to read all recurrent journeys stored by the user.
Permission
mobilityservice.user.itinerary.read
Request
GET /core.mobility/recurrent HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user access token}
Response (list of saved BasicRecurrentJourney structures)
[ { "clientId":"5214e671975a4023840002a8", "data":{ "parameters":{ "recurrence":[ 1, 2, 3, 4, 5, 6, 7 ], "from":{ "name":"null", "stopId":null, "stopCode":"null", "lon":"11.151796", "lat":"46.066799" }, "to":{ "name":"null", "stopId":null, "stopCode":"null", "lon":"11.11889", "lat":"46.066695" }, "fromDate":1377101418001, "toDate":1377706218008, "time":"06:10PM", "interval":3600000, "transportTypes":[ "TRANSIT", "BICYCLE" ], "routeType":"fastest", "resultsNumber":3 }, "legs":[ { "from":"POVO \"Fac. Scienze\"", "to":"Piazza Dante Dogana", "transport":{ "type":"BUS", "agencyId":"12", "routeId":"05R", "routeShortName":"5", "tripId":"05R-Feriale_055" } }, ... ], "monitorLegs":{ "12_16R":true, "12_13R":true, "17_521_ExUr":true, "12_12A":true, "12_05A":true, "12_09A":true, "12_01":true, "12_09R":true, "6_TB_R2_R":true, "12_05R":true } }, "name":"test", "monitor":true }, ... ]
The method allows the user to switch recurrent journey monitoring on/off.
Permission
mobilityservice.user.itinerary.write
Parameters
Request
GET /core.mobility/recurrent/{id}/monitor/{monitor} HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user access token}
Response: monitoring status
true
The method allows the user to update recurrent journey.
Permission
mobilityservice.user.itinerary.write
Parameters
Request
PUT /core.mobility/recurrent/{id} HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user access token} { "clientId":"5214e671975a4023840002a8", "data":{ "parameters":{ "recurrence":[ 1, 2, 3, 4, 5, 6, 7 ], "from":{ "name":"null", "stopId":null, "stopCode":"null", "lon":"11.151796", "lat":"46.066799" }, "to":{ "name":"null", "stopId":null, "stopCode":"null", "lon":"11.11889", "lat":"46.066695" }, "fromDate":1377101418001, "toDate":1377706218008, "time":"06:10PM", "interval":3600000, "transportTypes":[ "TRANSIT", "BICYCLE" ], "routeType":"fastest", "resultsNumber":3 }, "legs":[ { "from":"POVO \"Fac. Scienze\"", "to":"Piazza Dante Dogana", "transport":{ "type":"BUS", "agencyId":"12", "routeId":"05R", "routeShortName":"5", "tripId":"05R-Feriale_055" } }, ... ], "monitorLegs":{ "12_16R":true, "12_13R":true, "17_521_ExUr":true, "12_12A":true, "12_05A":true, "12_09A":true, "12_01":true, "12_09R":true, "6_TB_R2_R":true, "12_05R":true } }, "name":"test", "monitor":true }
Response: result of the operation
true
The method allows the user to delete saved recurrent journey.
Permission
mobilityservice.user.itinerary.write
Parameters
Request
DELETE /core.mobility/recurrent/{id} HTTPS/1.1 Host: dev.smartcommunitylab.it Accept: application/json Authorization: Bearer {user access token}
Response: result of the operation
true
The Mobility Service client library provides an access to the operations exposed by the Mobility Service REST APIs.
The source code of the library is available at https://github.com/smartcommunitylab/mobilityservice.client.
To use the library, the Maven coordinates of the library are as follows:
<dependency> <groupId>eu.trentorise.smartcampus</groupId> <artifactId>mobilityservice.client</artifactId> <version>1.1.6</version> <scope>jar</scope> </dependency>
Note that the SmartCommunity repository should be included in Maven configuration, e.g.:
<repository> <id>SmartCommunity</id> <url>http://repository.smartcommunitylab.it/content/groups/public</url> </repository>
The functionality is exposed by the MobilityDataService
(for transport information API) class, the MobilityAlertService
(for signalling alerts), MobilityPlannerService
(for planning functionality), and the MobilityUserService
(for managing the user trips) class.
The following code demonstrates how the classes may be used:
MobilityDataService dataService = new MobilityDataService("https://dev.smartcommunitylab.it/core.mobility"); MobilityPlannerService plannerService = new MobilityPlannerService("https://dev.smartcommunitylab.it/core.mobility"); MobilityAlertService alertService = new MobilityAlertService("https://dev.smartcommunitylab.it/core.mobility"); MobilityUserService userService = new MobilityUserService("https://dev.smartcommunitylab.it/core.mobility"); // get route information, agency '12' (Trento city bus) List<Route> routes = dataService.getRoutes("12","token"); // get stops information //get stops information List<Stop> stops = dataService.getStops("12",routes.get(0).getId().getId(), "token"); // stop times on the stop and route List<StopTime> stopTimes = dataService.getStopTimes("12",routes.get(0).getId().getId(),stops.get(0).getId(), "token"); // next trips at the stop List<TripData> stopTrips = dataService.getNextTrips("12",stops.get(0).getId(), 3, "token"); // timetable for the route TimeTable tt = dataService.getTimeTable(routes.get(0).getId().getId(), System.currentTimeMillis(), "token"); // delays for route List<Delay> delays = dataService.getDelays(routes.get(0).getId().getId(), "token"); // get road works information for Rovereto for the next three days List<AlertRoad> roadInfos = dataService.getRoadInfo("COMUNE_DI_ROVERETO", System.currentTimeMillis(), System.currentTimeMillis()+100*60*60*24*3,"token"); // get parkings in Trento List<Parking> parkings = dataService.getParkings("COMUNE_DI_TRENTO","token"); // delay alert AlertDelay ac = new AlertDelay(); ac.setDescription("description"); ac.setEffect("effect"); ac.setFrom(System.currentTimeMillis()); ac.setTo(System.currentTimeMillis()+1000*60*20); // valid for 20 mins ac.setNote("note"); Stop s = stops.get(0); ac.setPosition(new Position(s.getName(), new StopId("12", s.getId()), s.getId(), ""+s.getLongitude(), ""+s.getLatitude())); ac.setDelay(60*1000*5); // we need some trip to signal a delay List<TripData> stopTrips = dataService.getNextTrips("12",stops.get(0).getId(), 3, "token"); ac.setTransport(new Transport(TType.BUS, "12", stopTrips.get(0).getRouteId(), stopTrips.get(0).getTripId())); alertService.sendUserAlert(ac, "token"); // plan a single journey SingleJourney request = new SingleJourney(); request.setDate(new SimpleDateFormat("MM/dd/yyyy").format(new Date())); request.setDepartureTime(new SimpleDateFormat("hh:mmaa").format(new Date())); Position from = new Position(); from.setLat("46.066799"); from.setLon("11.151796"); request.setFrom(from); Position to = new Position("46.066695,11.11889"); request.setTo(to); request.setResultsNumber(3); request.setRouteType(RType.fastest); request.setTransportTypes(new TType[]{TType.TRANSIT, TType.BICYCLE}); List<Itinerary> list = plannerService.planSingleJourney(request, "token"); // save the journey BasicItinerary basic = new BasicItinerary(); basic.setData(list.get(0)); basic.setMonitor(true); basic.setName("test"); basic.setOriginalFrom(from); basic.setOriginalTo(to); basic = userService.saveSingleJourney(basic, "token");
~~DISQUS~~