//--------------------------------------------------- // BtStack.SetGeneralSecurityOptions //--------------------------------------------------- public eBTRC SetGeneralSecurityOptions(GenSecOptions Opts) { eBTRC rc = BT_SetGeneralSecurityOptions(Opts.LocalDeviceName, Opts.FTPRootDir, Opts.IsDiscoverable ? 1 : 0, Opts.IsConnectable ? 1 : 0); return(rc); }
//--------------------------------------------------- // BtStack.SetSvcSecurityOptions //--------------------------------------------------- public eBTRC SetSvcSecurityOptions(eBTSVC eSvc, SvcSecOptions Opts) { eBTRC rc = BT_SetSvcSecurityOptions(eSvc, Opts.IsEnabled ? 1 : 0, Opts.IsAuthRequired ? 1 : 0, Opts.IsPINRequired ? 1 : 0, Opts.IsEncryptRequired ? 1 : 0); return(rc); }
//---------------------------------------------------------- // SendFileComplete handler //---------------------------------------------------------- public void OnSendFileComplete(eBTRC rc) { eBTRC i = rc; AddResult(String.Format(" >SendFile: {0}", rc == eBTRC.BT_FTP_OPEN_FAILED ? "open failed" : rc == eBTRC.BT_FTP_SEND_ERROR ? "send error" : rc == eBTRC.BT_FTP_CLOSE_FAILED ? "close failed" : rc == eBTRC.BT_OK ? "completed" : "unknown error")); SendComplete = true; }
private void ShowFcnResult(string fcn, eBTRC rc) { string s; s = String.Format("{0}-->{1}", fcn, rc == eBTRC.BT_OK ? "BT_OK" : rc == eBTRC.BT_FAIL ? "BT_FAIL" : rc == eBTRC.BT_DEVICE_NOTAVAIL ? "BT_DEVICE_NOTAVAIL" : rc == eBTRC.BT_SVC_NOT_SUPPORTED ? "BT_SVC_NOT_SUPPORTED" : rc == eBTRC.BT_SVC_NOT_UNIQUE ? "BT_SVC_NOT_UNIQUE" : "unknown rc"); AddResult(s); if (fcn.Equals("SendFile") && rc != eBTRC.BT_OK) { SendComplete = true; } }
public static string PANConnectResultToString(eBTRC result) { string errorMessage; switch (result) { case eBTRC.BT_FAIL: errorMessage = "Connection attempt has failed"; break; case eBTRC.BT_SVC_NOT_SUPPORTED: errorMessage = "The device does not support the PAN service"; break; case eBTRC.BT_DEVICE_NOTAVAIL: errorMessage = "The device is not responding to Bluetooth communications"; break; case eBTRC.BT_UNSUPPORTED: errorMessage = "This is the return code if the method is called from the standard BTaccess library."; break; default: errorMessage = "Unknown result returned."; break; } return errorMessage; }
//---------------------------------------------------------- // BusinessCardComplete Handler //---------------------------------------------------------- public void OnBcComplete(eBTRC rc) { AddResult(String.Format(" >BusCard operation {0}", rc == eBTRC.BT_OK ? "succeeded" : "failed")); }
private void ShowFcnResult(string fcn, eBTRC rc) { string s; s = String.Format("{0}-->{1}", fcn, rc == eBTRC.BT_OK ? "BT_OK" : rc == eBTRC.BT_FAIL ? "BT_FAIL" : rc == eBTRC.BT_DEVICE_NOTAVAIL ? "BT_DEVICE_NOTAVAIL" : rc == eBTRC.BT_SVC_NOT_SUPPORTED ? "BT_SVC_NOT_SUPPORTED" : rc == eBTRC.BT_SVC_NOT_UNIQUE ? "BT_SVC_NOT_UNIQUE" : "unknown rc"); AddResult(s); if (fcn.Equals("SendFile") && rc != eBTRC.BT_OK) SendComplete = true; }
//BTHelper() //{ // //KnownDevices.Add("FA:73:5E:37:12:00"); // "00:12:37:5E:73:FA" // //KnownDevices.Add("72:FF:8C:37:12:00"); // "00:12:37:8C:FF:72" PDA36 // //KnownDevices.Add("41:2F:8D:37:12:00"); // "00:12:37:8D:2F:41" // //KnownDevices.Add("C6:01:8D:37:12:00"); // "00:12:37:8D:01:C6" // //KnownDevices.Add("8D:2F:41:37:12:00"); // "00:12:37:41:2F:8D" // //KnownDevices.Add("C6:01:8D:37:00:08"); // PDA38 //} public static string StringFcnResult(eBTRC rc) { string s; s = String.Format("{0}", rc == eBTRC.BT_OK ? "BT_OK" : rc == eBTRC.BT_FAIL ? "BT_FAIL" : rc == eBTRC.BT_DEVICE_NOTAVAIL ? "BT_DEVICE_NOTAVAIL" : rc == eBTRC.BT_SVC_NOT_SUPPORTED ? "BT_SVC_NOT_SUPPORTED" : rc == eBTRC.BT_SVC_NOT_UNIQUE ? "BT_SVC_NOT_UNIQUE" : "unknown rc"); return s; }