Schedules: create, edit, delete

To create, edit or delete schedules, use the command route/update_schedule:

svc=route/update_schedule&params={"itemId":<long>,
				  "id":<long>,
				  "callMode":<text>,
				  "n":<text>,
				  "f":<uint>,
				  "tz":<uint>,
				  "u":<long>,
				  "tm":[
				  	{
				  		"at":<uint>,
				  		"ad":<uint>,
				  		"dt":<uint>,
				  		"dd":<uint>
				  	}
				  ],
				  "sch":{
				  	"f1":<uint>,
				  	"f2":<uint>,
				  	"t1":<uint>,
				  	"t2":<uint>,
				  	"m":<uint>,
				  	"y":<uint>,
				  	"w":<uint>
				  },
				  "cfg":{
				  	"name":<text>,
				  	"units":[<long>],
				  	"enabled":<byte>,
				  	"roundFlags":<uint>,
				  	"autoName":<byte>,
				  	"validityPeriod":<uint>
				  }}

Parameters

Name Description
itemId route ID
id schedule ID
callMode action: create, update, delete

Other parameters are required only for creating and editing. They are described in the chapter Round information.

Response

For create and edit:

[
	<long>,	/* schedule ID */
	{
		"id":<long>,	/* schedule ID */
		"n":<text>,	/* name */
		"f":<uint>,	/* schedule type (see below) */
		"tz":<uint>,	/* timezone */
		"cfg":{		/* custom configuration (example) */
			"autoName":<byte>,	/* use automatically generated name:  0 - no, 1 - yes */
			"enabled":<byte>,	/* auto create rounds for current schedule: 1 - enable, 0 - disable */
			"name":<text>,		/* round name */
			"roundFlags":<uint>,	/* round flags */
			"units":[<long>],	/* array of units IDs */
			"validityPeriod":<uint>	/* validity period */
		},
		"tm":[		/* time of passing points */
			{
				"at":<uint>,	/* arrival time */
				"ad":<uint>,	/* deviation from arrival time */
				"dt":<uint>,	/* departure time */
				"dd":<uint>	/* deviation from departure time */
			}
		],
		"sch":{		/* time limitation */
			"f1":<uint>,	/* beginning of interval 1 */
			"f2":<uint>,	/* beginning of interval 2 */
			"t1":<uint>,	/* ending of interval 1 */
			"t2":<uint>,	/* ending of interval 2 */
			"m":<uint>,	/* days of month mask */
			"y":<uint>,	/* months mask */
			"w":<uint>	/* days of week mask */
		}
	}
]

Schedule types:

Flag Description
0x1 relative to activation
0x2 relative to day
0x4 absolute

For delete:

[
	<long>,		/* schedule ID */
	null
]