1
- using System ;
1
+ // Visual Pinball Engine
2
+ // Copyright (C) 2021 freezy and VPE Team
3
+ //
4
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
5
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
6
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
7
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
9
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
10
+ // SOFTWARE.
11
+
12
+ using System ;
2
13
using System . Collections . Generic ;
3
14
using System . IO ;
4
15
using System . Threading . Tasks ;
@@ -19,19 +30,21 @@ public MpfApi(string machineFolder)
19
30
/// <summary>
20
31
/// Launches MPF in the background and connects to it via gRPC.
21
32
/// </summary>
22
- public async Task Launch ( )
33
+ /// <param name="port">gRPC port to use for MPC/VPE communication</param>
34
+ /// <returns></returns>
35
+ public async Task Launch ( int port = 50051 )
23
36
{
24
37
await _spawner . Spawn ( ) ;
25
- await _client . Connect ( ) ;
38
+ await _client . Connect ( $ "localhost: { port } " ) ;
26
39
}
27
40
28
41
/// <summary>
29
42
/// Starts MPF, i.e. it will start polling for switches and sending events.
30
43
/// </summary>
31
44
/// <param name="initialSwitches">Initial switch states of the machine</param>
32
- public async Task Start ( Dictionary < string , bool > initialSwitches = null )
45
+ public void Start ( Dictionary < string , bool > initialSwitches = null )
33
46
{
34
- await _client . Start ( initialSwitches ?? new Dictionary < string , bool > ( ) ) ;
47
+ _client . Start ( initialSwitches ?? new Dictionary < string , bool > ( ) ) ;
35
48
}
36
49
37
50
/// <summary>
0 commit comments