You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
969 B
49 lines
969 B
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using UnityEngine.UI; |
|
|
|
public class BLEAdapter : MonoBehaviour |
|
{ |
|
public Text BLEMsg; |
|
public Text BLEData; |
|
public InputField linkInput; |
|
public InputField msgInput; |
|
// Start is called before the first frame update |
|
void Start() |
|
{ |
|
|
|
} |
|
|
|
public void CreateCentral() { |
|
} |
|
|
|
public void LinkBLE() { |
|
} |
|
public void UnLinkBLE() { |
|
} |
|
|
|
public void SendMsg() { |
|
byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(linkInput.text); |
|
} |
|
|
|
public void OnDidUpdateState() |
|
{ |
|
BLEMsg.text = "状态已更新"; |
|
} |
|
|
|
public void OnDidConnect() |
|
{ |
|
BLEMsg.text = "已连接"; |
|
} |
|
|
|
public void OnDidDisconnect() |
|
{ |
|
BLEMsg.text = "已断开连接"; |
|
} |
|
|
|
public void OnDidReceiveWriteRequests(string base64String) |
|
{ |
|
BLEData.text = "收到消息:" + base64String; |
|
} |
|
}
|
|
|