From 9b9043824d04f20e8e3679f1a2e946ee6f96194e Mon Sep 17 00:00:00 2001 From: rtrimana Date: Thu, 22 Dec 2016 16:59:19 -0800 Subject: [PATCH] Adding new policies for stub/skeleton generation - second benchmark --- .../iotpolicy/EspSprinkler/espsprinkler.pol | 29 +++++++++++++++++++ .../iotpolicy/EspSprinkler/sprinklersmart.req | 3 ++ localconfig/iotpolicy/GreenLawn/greenlawn.pol | 8 +++++ localconfig/iotpolicy/GreenLawn/lawnsmart.req | 3 ++ .../iotpolicy/SpruceSensor/sensorcallback.pol | 11 +++++++ .../iotpolicy/SpruceSensor/sensorcallback.req | 3 ++ .../iotpolicy/SpruceSensor/sensorsmart.req | 3 ++ .../iotpolicy/SpruceSensor/sprucesensor.pol | 29 +++++++++++++++++++ .../weathergatewaycallback.pol | 11 +++++++ .../weathergatewaycallback.req | 3 ++ .../weathergatewaysmart.req | 3 ++ .../weatherphonegateway.pol | 29 +++++++++++++++++++ 12 files changed, 135 insertions(+) create mode 100644 localconfig/iotpolicy/EspSprinkler/espsprinkler.pol create mode 100644 localconfig/iotpolicy/EspSprinkler/sprinklersmart.req create mode 100644 localconfig/iotpolicy/GreenLawn/greenlawn.pol create mode 100644 localconfig/iotpolicy/GreenLawn/lawnsmart.req create mode 100644 localconfig/iotpolicy/SpruceSensor/sensorcallback.pol create mode 100644 localconfig/iotpolicy/SpruceSensor/sensorcallback.req create mode 100644 localconfig/iotpolicy/SpruceSensor/sensorsmart.req create mode 100644 localconfig/iotpolicy/SpruceSensor/sprucesensor.pol create mode 100644 localconfig/iotpolicy/WeatherPhoneGateway/weathergatewaycallback.pol create mode 100644 localconfig/iotpolicy/WeatherPhoneGateway/weathergatewaycallback.req create mode 100644 localconfig/iotpolicy/WeatherPhoneGateway/weathergatewaysmart.req create mode 100644 localconfig/iotpolicy/WeatherPhoneGateway/weatherphonegateway.pol diff --git a/localconfig/iotpolicy/EspSprinkler/espsprinkler.pol b/localconfig/iotpolicy/EspSprinkler/espsprinkler.pol new file mode 100644 index 0000000..e2c83b6 --- /dev/null +++ b/localconfig/iotpolicy/EspSprinkler/espsprinkler.pol @@ -0,0 +1,29 @@ +public interface Sprinkler { + + public void init(); + public void setZone(int _zone, boolean _onOff, int _onDurationSeconds); + public List getZoneStates(); + public int getNumberOfZones(); + public boolean doesHaveZoneTimers(); + + capability Initialize { + description = "Initialize object"; + method = "init()"; + } + + capability Zone { + description = "Manage zones"; + method = "setZone(int _zone, boolean _onOff, int _onDurationSeconds)"; + method = "getZoneStates()"; + method = "getNumberOfZones()"; + method = "doesHaveZoneTimers()"; + } + + struct ZoneState { + int zoneNumber; + boolean onOffState; + int duration; + } +} + + diff --git a/localconfig/iotpolicy/EspSprinkler/sprinklersmart.req b/localconfig/iotpolicy/EspSprinkler/sprinklersmart.req new file mode 100644 index 0000000..826f227 --- /dev/null +++ b/localconfig/iotpolicy/EspSprinkler/sprinklersmart.req @@ -0,0 +1,3 @@ + +requires Sprinkler with Initialize, Zone as interface SprinklerSmart; + diff --git a/localconfig/iotpolicy/GreenLawn/greenlawn.pol b/localconfig/iotpolicy/GreenLawn/greenlawn.pol new file mode 100644 index 0000000..35dc21c --- /dev/null +++ b/localconfig/iotpolicy/GreenLawn/greenlawn.pol @@ -0,0 +1,8 @@ +public interface Lawn { + + capability Empty { + description = "Empty"; + } +} + + diff --git a/localconfig/iotpolicy/GreenLawn/lawnsmart.req b/localconfig/iotpolicy/GreenLawn/lawnsmart.req new file mode 100644 index 0000000..edba1e4 --- /dev/null +++ b/localconfig/iotpolicy/GreenLawn/lawnsmart.req @@ -0,0 +1,3 @@ + +requires Lawn with Empty as interface LawnSmart; + diff --git a/localconfig/iotpolicy/SpruceSensor/sensorcallback.pol b/localconfig/iotpolicy/SpruceSensor/sensorcallback.pol new file mode 100644 index 0000000..4b636fc --- /dev/null +++ b/localconfig/iotpolicy/SpruceSensor/sensorcallback.pol @@ -0,0 +1,11 @@ +public interface MoistureSensorCallback { + + public void newReadingAvailable(int sensorId, float moisture, long timeStampOfLastReading); + + capability Callback { + description = "Callback method"; + method = "newReadingAvailable(int sensorId, float moisture, long timeStampOfLastReading)"; + } +} + + diff --git a/localconfig/iotpolicy/SpruceSensor/sensorcallback.req b/localconfig/iotpolicy/SpruceSensor/sensorcallback.req new file mode 100644 index 0000000..668a875 --- /dev/null +++ b/localconfig/iotpolicy/SpruceSensor/sensorcallback.req @@ -0,0 +1,3 @@ + +requires MoistureSensorCallback with Callback as interface SensorSmartCallback; + diff --git a/localconfig/iotpolicy/SpruceSensor/sensorsmart.req b/localconfig/iotpolicy/SpruceSensor/sensorsmart.req new file mode 100644 index 0000000..ed2c2d5 --- /dev/null +++ b/localconfig/iotpolicy/SpruceSensor/sensorsmart.req @@ -0,0 +1,3 @@ + +requires MoistureSensor with Initialize, Moisture, SensorId as interface SensorSmart; + diff --git a/localconfig/iotpolicy/SpruceSensor/sprucesensor.pol b/localconfig/iotpolicy/SpruceSensor/sprucesensor.pol new file mode 100644 index 0000000..98fa112 --- /dev/null +++ b/localconfig/iotpolicy/SpruceSensor/sprucesensor.pol @@ -0,0 +1,29 @@ +public interface MoistureSensor { + + public void init(); + public float getMoisture(); + public long getTimestampOfLastReading(); + public void setId(int id); + public int getId(); + public void registerCallback(MoistureSensorCallback _callbackTo); + + capability Initialize { + description = "Initialize object"; + method = "init()"; + method = "registerCallback(MoistureSensorCallback _callbackTo)"; + } + + capability Moisture { + description = "Handle moisture value"; + method = "getMoisture()"; + method = "getTimestampOfLastReading()"; + } + + capability SensorId { + description = "Manage sensor Id"; + method = "setId(int id)"; + method = "getId()"; + } +} + + diff --git a/localconfig/iotpolicy/WeatherPhoneGateway/weathergatewaycallback.pol b/localconfig/iotpolicy/WeatherPhoneGateway/weathergatewaycallback.pol new file mode 100644 index 0000000..b435ec8 --- /dev/null +++ b/localconfig/iotpolicy/WeatherPhoneGateway/weathergatewaycallback.pol @@ -0,0 +1,11 @@ +public interface WeatherGatewayCallback { + + public void informationRetrieved(double _inchesPerWeek, int _weatherZipCode, int _daysToWaterOn, double _inchesPerMinute); + + capability Callback { + description = "Callback method"; + method = "informationRetrieved(double _inchesPerWeek, int _weatherZipCode, int _daysToWaterOn, double _inchesPerMinute)"; + } +} + + diff --git a/localconfig/iotpolicy/WeatherPhoneGateway/weathergatewaycallback.req b/localconfig/iotpolicy/WeatherPhoneGateway/weathergatewaycallback.req new file mode 100644 index 0000000..61a71bc --- /dev/null +++ b/localconfig/iotpolicy/WeatherPhoneGateway/weathergatewaycallback.req @@ -0,0 +1,3 @@ + +requires WeatherGatewayCallback with Callback as interface WeatherGWSmartCallback; + diff --git a/localconfig/iotpolicy/WeatherPhoneGateway/weathergatewaysmart.req b/localconfig/iotpolicy/WeatherPhoneGateway/weathergatewaysmart.req new file mode 100644 index 0000000..830a8a6 --- /dev/null +++ b/localconfig/iotpolicy/WeatherPhoneGateway/weathergatewaysmart.req @@ -0,0 +1,3 @@ + +requires WeatherGateway with Initialize, WeatherUpdate as interface WeatherGatewaySmart; + diff --git a/localconfig/iotpolicy/WeatherPhoneGateway/weatherphonegateway.pol b/localconfig/iotpolicy/WeatherPhoneGateway/weatherphonegateway.pol new file mode 100644 index 0000000..22096d0 --- /dev/null +++ b/localconfig/iotpolicy/WeatherPhoneGateway/weatherphonegateway.pol @@ -0,0 +1,29 @@ +public interface WeatherGateway { + + public void init(); + public void start(); + public void stop(); + public double getInchesPerWeek(); + public int getWeatherZipCode(); + public int getDaysToWaterOn(); + public double getInchesPerMinute(); + public void registerCallback(WeatherGatewayCallback _callbackTo); + + capability Initialize { + description = "Initialize object"; + method = "init()"; + method = "start()"; + method = "stop()"; + method = "registerCallback(WeatherGatewayCallback _callbackTo)"; + } + + capability WeatherUpdate { + description = "Manage weather data update"; + method = "getInchesPerWeek()"; + method = "getWeatherZipCode()"; + method = "getDaysToWaterOn()"; + method = "getInchesPerMinute()"; + } +} + + -- 2.34.1