Alipay+ DocsAlipay+ Docs

SendCancelCommand

The POS device calls the SendCancelCommand API to send a command to the BlueTap device to disable the NFC link.

Method signature

copy
/**
 * Send cancel command to the BlueTap device
 */
ResultCode SendCancelCommand(CancelCommand cancelCommand);

Request parameter

Item

Type

Description

Required

cancelCommand

CancelCommand

The command sent to the BlueTap device to disable the NFC link.

M

CancelCommand

Item

Type

Length

Description

Required

OrderId

String

16

The order ID created by the POS device to identify an order.

O

Response parameter

Item

Type

Description

Required

/

ResultCode

The result code that indicates the result of the command sending. For more information about the result code, see the ResultCode section.

M

ResultCode

ResultCode

Description

SUCCESS

Success.

DEVICE_DISCONNECTED

The BlueTap device is disconnected.

PARAM_ILLEGAL

The parameter values are invalid.

PROCESS_FAIL

Failed to send the command.

UNKNOWN_EXCEPTION

System exception.

Sample

C#

This following sample shows how to use the SendCancelCommand API in C#.

copy
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Windows.Forms;
using BluetapLib;

namespace BluetapTest
{
    static class Program
    {
        private static void Main(string[] args)
        {
            TinyCommand tinyCommand = new TinyCommand();
            /* Send CancelCommand */
            CancelCommand cancelCommand = new CancelCommand();
            result = tinyCommand.SendCancelCommand(cancelCommand);
        }
    }
}

Python

This following sample shows how to use the SendCancelCommand API in Python.

copy
import hid
import bluetaplib

tinyCommand = bluetaplib.TinyCommand()
cancelCommand = bluetaplib.CancelCommand()
tinyCommand.SendCancelCommand(cancelCommand)

Note: Contact your Alipay+ Solution Architect to obtain the BluetapLib.dll file.

Python code requires hid and bluetaplib to execute. Use the command below in terminal to install them.

copy
pip install hidapi
pip install bluetaplib-1.0.0-py3-none-any.whl

Note: Contact your Alipay+ Solution Architect to obtain the bluetaplib-x.x.x-py3-none-any.whl file.