@@ -41,125 +41,126 @@ Set capability properties in your Service Object to advertise support for the fe
41
41
42
42
## Example
43
43
44
- using System;
45
- using System.Collections.Generic;
46
- using System.Text;
47
-
48
- using Microsoft.PointOfService;
49
- using Microsoft.PointOfService.BaseServiceObjects;
50
-
51
- [assembly: PosAssembly("Service Object Contractors, Inc.")]
52
-
53
- namespace SOSample.LineDisplay
44
+ ``` csharp
45
+ using System ;
46
+ using System .Collections .Generic ;
47
+ using System .Text ;
48
+
49
+ using Microsoft .PointOfService ;
50
+ using Microsoft .PointOfService .BaseServiceObjects ;
51
+
52
+ [assembly : PosAssembly (" Service Object Contractors, Inc." )]
53
+
54
+ namespace SOSample .LineDisplay
55
+ {
56
+ [ServiceObject (
57
+ DeviceType .LineDisplay ,
58
+ " SampleLineDisplay" ,
59
+ " Sample LineDiplay Service Object" ,
60
+ 1 ,
61
+ 9 )]
62
+
63
+ public class SampleLineDisplay : LineDisplayBase
54
64
{
55
- [ServiceObject(
56
- DeviceType.LineDisplay,
57
- "SampleLineDisplay",
58
- "Sample LineDiplay Service Object",
59
- 1,
60
- 9)]
61
-
62
- public class SampleLineDisplay : LineDisplayBase
65
+ SampleLineDisplay ()
63
66
{
64
- SampleLineDisplay()
65
- {
66
- // The CapBlink property is initially set to
67
- // DisplayBlink.None in LineDisplayBase. This property
68
- // will be set here to indicate what mode of blinking
69
- // text our Service Object can support.
70
- Properties.CapBlink = DisplayBlink.All;
71
-
72
- // Set the CapBlinkRate property to true to indicate
73
- // that this device has the ability to change the
74
- // rate at which it blinks by setting the property
75
- // BlinkRate.
76
- Properties.CapBlinkRate = true;
77
- }
67
+ // The CapBlink property is initially set to
68
+ // DisplayBlink.None in LineDisplayBase. This property
69
+ // will be set here to indicate what mode of blinking
70
+ // text our Service Object can support.
71
+ Properties .CapBlink = DisplayBlink .All ;
72
+
73
+ // Set the CapBlinkRate property to true to indicate
74
+ // that this device has the ability to change the
75
+ // rate at which it blinks by setting the property
76
+ // BlinkRate.
77
+ Properties .CapBlinkRate = true ;
78
+ }
78
79
79
- #region Implement Abstract LineDisplayBase Members
80
- // LineDisplayScreenMode must be implemented to
81
- // allow the application to find out which screen modes
82
- // are supported by this device.
83
- protected override LineDisplayScreenMode[]
84
- LineDisplayScreenModes
80
+ #region Implement Abstract LineDisplayBase Members
81
+ // LineDisplayScreenMode must be implemented to
82
+ // allow the application to find out which screen modes
83
+ // are supported by this device.
84
+ protected override LineDisplayScreenMode[]
85
+ LineDisplayScreenModes
86
+ {
87
+ get
85
88
{
86
- get
87
- {
88
- LineDisplayScreenMode[] SupportedModes;
89
-
90
- // Create a LineDisplayScreenMode object; this SO
91
- // has a screen mode 10 columns wide and 2 rows deep.
92
- LineDisplayScreenMode mode =
93
- new LineDisplayScreenMode(10, 2, 0, 0);
94
-
95
- // Allocate space for our screen mode array and
96
- // initialize it to hold our supported screen
97
- // mode(s).
98
- SupportedModes =
99
- new LineDisplayScreenMode[] { mode };
100
-
101
- return SupportedModes;
102
- }
103
- }
89
+ LineDisplayScreenMode [] SupportedModes ;
104
90
105
- // DisplayData is the method called from the application
106
- // specifying what data should be displayed on the
107
- // device.
108
- protected override void DisplayData(Cell[] cells)
109
- {
110
- // Your code here:
111
- // Send the data to your device. Take settings such
112
- // as blink and blink rate into account here.
113
- return;
114
- }
115
- #endregion Implement Abstract LineDisplayBase Members
91
+ // Create a LineDisplayScreenMode object; this SO
92
+ // has a screen mode 10 columns wide and 2 rows deep.
93
+ LineDisplayScreenMode mode =
94
+ new LineDisplayScreenMode (10 , 2 , 0 , 0 );
116
95
117
- #region Implement Abstract PosCommon Members
118
- private string MyHealthText = "";
96
+ // Allocate space for our screen mode array and
97
+ // initialize it to hold our supported screen
98
+ // mode(s).
99
+ SupportedModes =
100
+ new LineDisplayScreenMode [] { mode };
119
101
120
- // PosCommon.CheckHealthText.
121
- public override string CheckHealthText
122
- {
123
- get
124
- {
125
- // VerifyState(mustBeClaimed,
126
- // mustBeEnabled).
127
- VerifyState(false, false);
128
- return MyHealthText;
129
- }
102
+ return SupportedModes ;
130
103
}
104
+ }
131
105
132
- // PosCommon.CheckHealth.
133
- public override string CheckHealth(
134
- HealthCheckLevel level)
135
- {
136
- // Verify that the device is open, claimed and enabled.
137
- VerifyState(true, true);
106
+ // DisplayData is the method called from the application
107
+ // specifying what data should be displayed on the
108
+ // device.
109
+ protected override void DisplayData (Cell [] cells )
110
+ {
111
+ // Your code here:
112
+ // Send the data to your device. Take settings such
113
+ // as blink and blink rate into account here.
114
+ return ;
115
+ }
116
+ #endregion Implement Abstract LineDisplayBase Members
138
117
139
- // Your code here:
140
- // check the health of the device and return a
141
- // descriptive string.
118
+ #region Implement Abstract PosCommon Members
119
+ private string MyHealthText = " " ;
142
120
143
- // Cache result in the CheckHealthText property.
144
- MyHealthText = "Ok";
121
+ // PosCommon.CheckHealthText.
122
+ public override string CheckHealthText
123
+ {
124
+ get
125
+ {
126
+ // VerifyState(mustBeClaimed,
127
+ // mustBeEnabled).
128
+ VerifyState (false , false );
145
129
return MyHealthText ;
146
130
}
131
+ }
147
132
148
- // PosCommon.DirectIOData.
149
- public override DirectIOData DirectIO(
150
- int command,
151
- int data,
152
- object obj)
153
- {
154
- // Verify that the device is open.
155
- VerifyState(false, false);
133
+ // PosCommon.CheckHealth.
134
+ public override string CheckHealth (
135
+ HealthCheckLevel level )
136
+ {
137
+ // Verify that the device is open, claimed and enabled.
138
+ VerifyState (true , true );
156
139
157
- return new DirectIOData(data, obj);
158
- }
159
- #endregion Abstract PosCommon Members
140
+ // Your code here:
141
+ // check the health of the device and return a
142
+ // descriptive string.
143
+
144
+ // Cache result in the CheckHealthText property.
145
+ MyHealthText = " Ok" ;
146
+ return MyHealthText ;
160
147
}
161
- }
162
148
149
+ // PosCommon.DirectIOData.
150
+ public override DirectIOData DirectIO (
151
+ int command ,
152
+ int data ,
153
+ object obj )
154
+ {
155
+ // Verify that the device is open.
156
+ VerifyState (false , false );
157
+
158
+ return new DirectIOData (data , obj );
159
+ }
160
+ #endregion Abstract PosCommon Members
161
+ }
162
+ }
163
+ ```
163
164
## See Also
164
165
165
166
#### Other Resources
0 commit comments