aboutsummaryrefslogtreecommitdiffstats
path: root/demo-ui/app/services/model.js
blob: ed482d2ac9e9558f52b72df6e5115e5dcbe1cbf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*******************************************************************************
* Copyright (c) 2015 CableLabs Inc. and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution, and is available at
* http://www.apache.org/licenses/LICENSE-2.0
*******************************************************************************/

//
// For data that must be shared accross controllers
//

(function(){
var model = function ($log, dbg) {

	var _shared = {
		availableUnis : [],
		currentEpl    : null
	};

	var getAvailableUnis = function () {
		return _shared.availableUnis;
	}

	var setAvailableUnis = function (availableUnis) {
		dbg.p("in model:setAvailableUnis");
		_shared.availableUnis = availableUnis;
		dbg.pj(_shared.availableUnis);
	}

	// var getCurrentEplId = function () {
	// 	// dbg.p("in model:getCurrentEplId, returning: "+_shared.currentEplId);
	// 	return _shared.currentEplId;
	// }

	// var setCurrentEplId = function (currentEplId) {
	// 	// dbg.p("in model:setCurrentEplId, setting to: "+currentEplId);
	// 	_shared.currentEplId = currentEplId;
	// }

	var getCurrentEpl = function () {
		dbg.p("in model:getCurrentEpl:");
		//dbg.pj(_shared.currentEpl);
		return _shared.currentEpl;
	}

	var setCurrentEpl = function (currentEpl) {
		// dbg.p("in model:setCurrentEplId, setting to: "+currentEplId);
		dbg.p("in model:setCurrentEpl");
		//dbg.pj(currentEpl);
		_shared.currentEpl = currentEpl;
	}


	var dumpShareDdata = function() { dbg.pj(_shared); };

	return { // Public API
			 getAvailableUnis : getAvailableUnis,
			 setAvailableUnis : setAvailableUnis,
			 getCurrentEpl    : getCurrentEpl,
			 setCurrentEpl    : setCurrentEpl,
			 dumpShareDdata   : dumpShareDdata
      };
   };

   var module = angular.module("vcpe");
   module.factory("model", model);

}());