-
Notifications
You must be signed in to change notification settings - Fork 2
/
SecurityCamera.java
53 lines (43 loc) · 1.33 KB
/
SecurityCamera.java
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
// This class represents the Security Camera class in the wireless security system.
public class SecurityCamera extends SecurityDevice {
// The device ID of the hardware.
public static final String deviceID = "SecurityCamera";
private static boolean motionStatus;
private static boolean armedStatus;
public static boolean alert;
public SecurityCamera() {
super(deviceID);
motionStatus = false;
armedStatus = true;
}
// Method getMotionStatus: used to retrieve the motion status of the camera
boolean getMotionStatus() {
return motionStatus;
}
void record() {
}
void takeSnapshot() {
}
// Method armDevice is used to arm and disarm the camera
void armDevice(boolean isArmed) {
armedStatus = isArmed;
if (isArmed) {
System.out.print("Security Camera armed.");
} else {
System.out.print("Security Camera disarmed.");
}
}
// Method that generates an alert.
public void sendAlert() {
if (armedStatus && motionStatus) {
super.sendAlert("ALERT! Security Camera detects motion.", deviceID);
} else if (armedStatus) {
super.sendAlert("No motion detected by Security Camera.", deviceID);
} else {
super.sendAlert("The Security Camera is not armed.", deviceID);
}
}
// Method that sends a message to the MobileNumber class.
void SendMessage() {
}
}