-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduced a PotAppDevice class to encapsulate process logic for devices
Merge pull request #43 from pharo-iot/dev Introduced a PotAppDevice class to encapsulate process logic for devices
- Loading branch information
Showing
42 changed files
with
147 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"separateMethodMetaAndSource" : false, | ||
"noMethodMetaData" : true, | ||
"useCypressPropertiesFile" : true | ||
} |
Empty file.
3 changes: 3 additions & 0 deletions
3
src/PharoThings-Apps-Tests.package/PotAppDeviceMock.class/instance/log.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
log | ||
^ log |
3 changes: 3 additions & 0 deletions
3
src/PharoThings-Apps-Tests.package/PotAppDeviceMock.class/instance/loopBody.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
loopBody | ||
log := 1 |
3 changes: 3 additions & 0 deletions
3
src/PharoThings-Apps-Tests.package/PotAppDeviceMock.class/instance/process.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
process | ||
^process |
13 changes: 13 additions & 0 deletions
13
src/PharoThings-Apps-Tests.package/PotAppDeviceMock.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"commentStamp" : "", | ||
"super" : "PotAppDevice", | ||
"category" : "PharoThings-Apps-Tests", | ||
"classinstvars" : [ ], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ | ||
"log" | ||
], | ||
"name" : "PotAppDeviceMock", | ||
"type" : "normal" | ||
} |
Empty file.
7 changes: 7 additions & 0 deletions
7
src/PharoThings-Apps-Tests.package/PotAppDeviceTests.class/instance/setUp.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
running | ||
setUp | ||
"Hooks that subclasses may override to define the fixture of test." | ||
super setUp. | ||
appDevice := PotAppDeviceMock new. | ||
appDevice deviceName: 'testAppDevice'. | ||
appDevice delay: 500 milliSeconds |
4 changes: 4 additions & 0 deletions
4
src/PharoThings-Apps-Tests.package/PotAppDeviceTests.class/instance/tearDown.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
running | ||
tearDown | ||
appDevice disconnect. | ||
super tearDown |
5 changes: 5 additions & 0 deletions
5
src/PharoThings-Apps-Tests.package/PotAppDeviceTests.class/instance/testBody.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
tests | ||
testBody | ||
appDevice connect. | ||
appDevice delay wait. | ||
self assert: appDevice log notNil |
6 changes: 6 additions & 0 deletions
6
src/PharoThings-Apps-Tests.package/PotAppDeviceTests.class/instance/testConnection.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
tests | ||
testConnection | ||
appDevice connect. | ||
self assert: appDevice process name equals: (appDevice printString, ': ', appDevice deviceName). | ||
self assert: appDevice process priority equals: Processor userBackgroundPriority. | ||
self assert: appDevice isConnected |
3 changes: 3 additions & 0 deletions
3
src/PharoThings-Apps-Tests.package/PotAppDeviceTests.class/instance/testDelay.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
tests | ||
testDelay | ||
self assert: appDevice delay equals: 500 milliSeconds |
3 changes: 3 additions & 0 deletions
3
src/PharoThings-Apps-Tests.package/PotAppDeviceTests.class/instance/testDeviceName.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
tests | ||
testDeviceName | ||
self assert: appDevice deviceName equals: 'testAppDevice' |
6 changes: 6 additions & 0 deletions
6
src/PharoThings-Apps-Tests.package/PotAppDeviceTests.class/instance/testDisconnection.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
tests | ||
testDisconnection | ||
appDevice connect. | ||
self assert: appDevice isConnected. | ||
appDevice disconnect. | ||
self deny: appDevice isConnected |
13 changes: 13 additions & 0 deletions
13
src/PharoThings-Apps-Tests.package/PotAppDeviceTests.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"commentStamp" : "", | ||
"super" : "TestCase", | ||
"category" : "PharoThings-Apps-Tests", | ||
"classinstvars" : [ ], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ | ||
"appDevice" | ||
], | ||
"name" : "PotAppDeviceTests", | ||
"type" : "normal" | ||
} |
1 change: 1 addition & 0 deletions
1
src/PharoThings-Apps-Tests.package/monticello.meta/categories.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SystemOrganization addCategory: #'PharoThings-Apps-Tests'! |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(name 'PharoThings-Apps-Tests') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"separateMethodMetaAndSource" : false, | ||
"noMethodMetaData" : true, | ||
"useCypressPropertiesFile" : true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
I am a specialized device with a process and connect/disconnect logic for writing devices that need to regularly update. | ||
I am an abstract class. | ||
You have to subclass me and implement: | ||
- loopBody: the method that is called by my process |
7 changes: 7 additions & 0 deletions
7
src/PharoThings-Apps.package/PotAppDevice.class/instance/connect.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
controlling | ||
connect | ||
process := [ [ true ] | ||
whileTrue: [ self loopBody. | ||
delay wait ] ] | ||
forkAt: Processor userBackgroundPriority | ||
named: self printString , ': ' , self deviceName |
3 changes: 3 additions & 0 deletions
3
src/PharoThings-Apps.package/PotAppDevice.class/instance/delay..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
delay: anObject | ||
delay := anObject |
3 changes: 3 additions & 0 deletions
3
src/PharoThings-Apps.package/PotAppDevice.class/instance/delay.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
delay | ||
^ delay |
3 changes: 3 additions & 0 deletions
3
src/PharoThings-Apps.package/PotAppDevice.class/instance/deviceName..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
accessing | ||
deviceName: aString | ||
deviceName := aString |
5 changes: 5 additions & 0 deletions
5
src/PharoThings-Apps.package/PotAppDevice.class/instance/deviceName.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
accessing | ||
deviceName | ||
^ deviceName | ||
ifNil: [ deviceName := 'anonymous device(' | ||
, Time now asNanoSeconds printString , ')' ] |
5 changes: 5 additions & 0 deletions
5
src/PharoThings-Apps.package/PotAppDevice.class/instance/disconnect.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
controlling | ||
disconnect | ||
self isConnected | ||
ifFalse: [ ^ self ]. | ||
process terminate |
3 changes: 3 additions & 0 deletions
3
src/PharoThings-Apps.package/PotAppDevice.class/instance/isConnected.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
controlling | ||
isConnected | ||
^ process notNil and: [ process isTerminated not ] |
3 changes: 3 additions & 0 deletions
3
src/PharoThings-Apps.package/PotAppDevice.class/instance/loopBody.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
controlling | ||
loopBody | ||
self subclassResponsibility |
15 changes: 15 additions & 0 deletions
15
src/PharoThings-Apps.package/PotAppDevice.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"commentStamp" : "StevenCostiou 12/3/2019 15:26", | ||
"super" : "PotDevice", | ||
"category" : "PharoThings-Apps", | ||
"classinstvars" : [ ], | ||
"pools" : [ ], | ||
"classvars" : [ ], | ||
"instvars" : [ | ||
"process", | ||
"delay", | ||
"deviceName" | ||
], | ||
"name" : "PotAppDevice", | ||
"type" : "normal" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SystemOrganization addCategory: #'PharoThings-Apps'! |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(name 'PharoThings-Apps') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{ } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
src/PharoThings-Devices-WaterAlarm.package/PotWaterAlarm.class/instance/connect.st
This file was deleted.
Oops, something went wrong.
4 changes: 0 additions & 4 deletions
4
src/PharoThings-Devices-WaterAlarm.package/PotWaterAlarm.class/instance/disconnect.st
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
src/PharoThings-Devices-WaterAlarm.package/PotWaterAlarm.class/instance/initialize.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
controlling | ||
initialize | ||
super initialize. | ||
deviceName := 'water tracking' |
4 changes: 0 additions & 4 deletions
4
src/PharoThings-Devices-WaterAlarm.package/PotWaterAlarm.class/instance/isConnected.st
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
src/PharoThings-Devices-WaterAlarm.package/PotWaterAlarm.class/instance/loopBody.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
controlling | ||
loopBody | ||
self checkWater |
5 changes: 0 additions & 5 deletions
5
src/PharoThings-Devices-WaterAlarm.package/PotWaterAlarm.class/instance/waterTrackingLoop.st
This file was deleted.
Oops, something went wrong.
7 changes: 3 additions & 4 deletions
7
src/PharoThings-Devices-WaterAlarm.package/PotWaterAlarm.class/properties.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters