88using Windows . Devices . Bluetooth . GenericAttributeProfile ;
99using Windows . Devices . Enumeration ;
1010using Windows . Storage . Streams ;
11- using Windows . UI . Composition ;
1211
1312namespace LighthouseV2PowerControl
1413{
@@ -27,7 +26,6 @@ public Form1(string[] args)
2726 InitializeComponent ( ) ;
2827 btnStart . Click += ( obj , e ) => SendOnLighthouseAsync ( activateByte ) ;
2928 btnStop . Click += ( obj , e ) => SendOnLighthouseAsync ( deactivateByte ) ;
30- btnStop . Enabled = btnStart . Enabled = false ;
3129 if ( args . Length > 0 )
3230 {
3331 UseArgumentsAsync ( args ) ;
@@ -58,10 +56,15 @@ private async void UseArgumentsAsync(string[] args)
5856 Close ( ) ;
5957 }
6058
59+ #region Body
60+ /// <summary>
61+ /// Call once at startup to get the characteristics of all base stations.
62+ /// </summary>
63+ /// <returns></returns>
6164 private async Task GetGattCharacteristicsAsync ( )
6265 {
6366 DeviceInformationCollection GatDevices = await DeviceInformation . FindAllAsync ( GattDeviceService . GetDeviceSelectorFromUuid ( service ) ) ;
64- for ( int id = 0 ; id < GatDevices . Count ; id ++ )
67+ for ( int id = 0 ; id < GatDevices . Count ; ++ id )
6568 {
6669 if ( ! regex . IsMatch ( GatDevices [ id ] . Name ) ) continue ;
6770
@@ -104,6 +107,11 @@ private async Task GetGattCharacteristicsAsync()
104107 }
105108 }
106109
110+ /// <summary>
111+ /// Called to write the value to the characteristic for all found base stations.
112+ /// </summary>
113+ /// <param name="byte4send"></param>
114+ /// <returns></returns>
107115 private async Task SendOnLighthouseAsync ( byte byte4send )
108116 {
109117 for ( int i = 0 ; i < listGattCharacteristics . Count ; ++ i )
@@ -121,6 +129,7 @@ private async Task SendOnLighthouseAsync(byte byte4send)
121129 }
122130 }
123131 }
132+ #endregion
124133
125134 private void Log ( object msg )
126135 {
0 commit comments