我将vb项目转移到python,com接口的设置正常,现在我想读取数据:
# int FEISC_0xB0_ISOCmd( int iReaderHnd, unsigned char cBusAdr, unsigned char* cReqData, int iReqLen, unsigned char* cRspData, int* iRspLen, int iDataFormat )
feisc.FEISC_0xB0_ISOCmd.argtypes = c_int, c_ubyte, c_char_p, c_int, c_char_p, c_int, c_int
rspData = create_string_buffer(512);
rspDatalen = 0
iBack = feisc.FEISC_0xB0_ISOCmd(iReader, 255, b'0100', 4, rspData, rspDataLen, 0x01)
我收到以下错误:
OSError: [WinError -4021] Windows Error 0x%X
这个错误是什么意思?
我改为feisc = WinDLL(' FeIsc')现在我从dll得到一个指针为0的错误。我怎么能把rdpatlen作为函数的int *?
答案 0 :(得分:0)
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button drawCanvas = findViewById(R.id.draw_canvas_button);
drawCanvas.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Paint paint = new Paint();
Canvas canvas = new Canvas();
paint.setColor(Color.BLACK);
paint.setStyle(Paint.Style.FILL);
paint.setTextSize(20f);
canvas.drawText("My Text", 10f, 15f, paint);
}
});
}
}
应为iRspLen
。对于输出参数,您需要创建ctypes数据实例以保存结果。下面我猜测应该用输入上的响应缓冲区大小初始化POINTER(c_int)
,并且可能会根据输出的实际大小进行更新。
cRspDataLen