b4f5580393f4648745ddb4b61c35fca62c36afe6
[public/netxms.git] / src / java / netxms-client / src / main / java / org / netxms / client / objects / MobileDevice.java
1 /**
2 * NetXMS - open source network management system
3 * Copyright (C) 2003-2012 Victor Kirhenshtein
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19 package org.netxms.client.objects;
20
21 import java.util.Date;
22 import org.netxms.base.NXCPCodes;
23 import org.netxms.base.NXCPMessage;
24 import org.netxms.client.NXCSession;
25
26 /**
27 * Mobile device object
28 */
29 public class MobileDevice extends GenericObject
30 {
31 private String deviceId;
32 private String vendor;
33 private String model;
34 private String serialNumber;
35 private String osName;
36 private String osVersion;
37 private String userId;
38 private int batteryLevel;
39 private Date lastReportTime;
40
41 /**
42 * @param msg
43 * @param session
44 */
45 public MobileDevice(NXCPMessage msg, NXCSession session)
46 {
47 super(msg, session);
48 deviceId = msg.getVariableAsString(NXCPCodes.VID_DEVICE_ID);
49 vendor = msg.getVariableAsString(NXCPCodes.VID_VENDOR);
50 model = msg.getVariableAsString(NXCPCodes.VID_MODEL);
51 serialNumber = msg.getVariableAsString(NXCPCodes.VID_SERIAL_NUMBER);
52 osName = msg.getVariableAsString(NXCPCodes.VID_OS_NAME);
53 osVersion = msg.getVariableAsString(NXCPCodes.VID_OS_VERSION);
54 userId = msg.getVariableAsString(NXCPCodes.VID_USER_ID);
55 batteryLevel = msg.getVariableAsInteger(NXCPCodes.VID_BATTERY_LEVEL);
56 lastReportTime = msg.getVariableAsDate(NXCPCodes.VID_LAST_CHANGE_TIME);
57 }
58
59 /**
60 * @return the deviceId
61 */
62 public final String getDeviceId()
63 {
64 return deviceId;
65 }
66
67 /**
68 * @return the vendor
69 */
70 public final String getVendor()
71 {
72 return vendor;
73 }
74
75 /**
76 * @return the model
77 */
78 public final String getModel()
79 {
80 return model;
81 }
82
83 /**
84 * @return the serialNumber
85 */
86 public final String getSerialNumber()
87 {
88 return serialNumber;
89 }
90
91 /**
92 * @return the osName
93 */
94 public final String getOsName()
95 {
96 return osName;
97 }
98
99 /**
100 * @return the osVersion
101 */
102 public final String getOsVersion()
103 {
104 return osVersion;
105 }
106
107 /**
108 * @return the userId
109 */
110 public final String getUserId()
111 {
112 return userId;
113 }
114
115 /**
116 * @return the batteryLevel
117 */
118 public final int getBatteryLevel()
119 {
120 return batteryLevel;
121 }
122
123 /* (non-Javadoc)
124 * @see org.netxms.client.objects.GenericObject#getObjectClassName()
125 */
126 @Override
127 public String getObjectClassName()
128 {
129 return "MobileDevice";
130 }
131
132 /**
133 * @return the lastReportTime
134 */
135 public final Date getLastReportTime()
136 {
137 return lastReportTime;
138 }
139 }