Skip to content

Commit

Permalink
Check BT pin
Browse files Browse the repository at this point in the history
  • Loading branch information
uholeschak committed Jan 24, 2022
1 parent 261b315 commit 34e881d
Show file tree
Hide file tree
Showing 5 changed files with 690 additions and 683 deletions.
22 changes: 11 additions & 11 deletions BmwDeepObd/MtcServiceConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -468,12 +468,12 @@ public string GetModulePassword()

public void SetModuleName(string name)
{
CommandMac(ApiVersion > 2 ? 29 + ApiOffset : 20, name);
CommandSetString(ApiVersion > 2 ? 29 + ApiOffset : 20, name);
}

public void SetModulePassword(string name)
{
CommandMac(ApiVersion > 2 ? 30 + ApiOffset : 21, name);
CommandSetString(ApiVersion > 2 ? 30 + ApiOffset : 21, name);
}

public void SetAutoConnect(bool auto)
Expand All @@ -498,32 +498,32 @@ public bool GetAutoAnswer()

public void ConnectBt(string mac)
{
CommandMac(ApiVersion > 2 ? 35 + ApiOffset : 26, mac);
CommandSetString(ApiVersion > 2 ? 35 + ApiOffset : 26, mac);
}

public void DisconnectBt(string mac)
{
CommandMac(ApiVersion > 2 ? 36 + ApiOffset : 27, mac);
CommandSetString(ApiVersion > 2 ? 36 + ApiOffset : 27, mac);
}

public void ConnectObd(string mac)
{
CommandMac(ApiVersion > 2 ? 37 + ApiOffset : 28, mac);
CommandSetString(ApiVersion > 2 ? 37 + ApiOffset : 28, mac);
}

public void DisconnectObd(string mac)
{
CommandMac(ApiVersion > 2 ? 38 + ApiOffset : 29, mac);
CommandSetString(ApiVersion > 2 ? 38 + ApiOffset : 29, mac);
}

public void DeleteObd(string mac)
{
CommandMac(ApiVersion > 2 ? 39 + ApiOffset : 30, mac);
CommandSetString(ApiVersion > 2 ? 39 + ApiOffset : 30, mac);
}

public void DeleteBt(string mac)
{
CommandMac(ApiVersion > 2 ? 40 + ApiOffset : 31, mac);
CommandSetString(ApiVersion > 2 ? 40 + ApiOffset : 31, mac);
}

public void SyncMatchList()
Expand Down Expand Up @@ -709,7 +709,7 @@ private void CommandSetInt(int code, int value)
}
}

private void CommandMac(int code, string mac)
private void CommandSetString(int code, string text)
{
if (_binder == null)
{
Expand All @@ -720,10 +720,10 @@ private void CommandMac(int code, string mac)
try
{
#if DEBUG
Android.Util.Log.Info(Tag, string.Format("SetMac({0}, {1})", code, mac));
Android.Util.Log.Info(Tag, string.Format("SetMac({0}, {1})", code, text));
#endif
data.WriteInterfaceToken(InterfaceToken);
data.WriteString(mac);
data.WriteString(text);
_binder.Transact(code, data, reply, 0);
reply.ReadException();
}
Expand Down
Loading

0 comments on commit 34e881d

Please sign in to comment.