Secondary display API: Difference between revisions

From wizarPOS
No edit summary
No edit summary
Line 1: Line 1:
== Functions ==
== Functions ==
The calling sequence is [[#open|open]]>[[#ctrl_devs|ctrl_devs]]/[[#write_picture|write_picture]]>[[#close|close ]]
The calling sequence is [[#open|open]]>[[#ctrl_devs|ctrl_devs]]/[[#write_picture|write_picture]]>[[#close|close ]]
=== open ===
=== <big>open</big> ===
  void* customer_display_open(int* pError)
  <syntaxhighlight lang="c">void* customer_display_open(int* pError)</syntaxhighlight >
Open the CustomerDisplay device.
Open the CustomerDisplay device.
This operation should be used before other operations.
This operation should be used before other operations.


'''Parameters'''
{|class="wizarpostable"
{|
|-
! scope="row" colspan="2" | Parameters
|-
|-
| ''pErrorCode'' || int* || if out is null, can not open, else, the out is the handler
| pErrorCode || '''int*:''' if out is null, can not open, else, the out is the handler
|}
|}
'''Returns'''


=== close ===
 
   int customer_display_close(int nHandle)
=== <big>close</big> ===
   <syntaxhighlight lang="c">int customer_display_close(int nHandle)</syntaxhighlight >
Close the CustomerDisplay device opened before.
Close the CustomerDisplay device opened before.
The open and close apis are pair operations. If you don’t want to use this device, you should call the close api to release this device.
The open and close apis are pair operations. If you don’t want to use this device, you should call the close api to release this device.


'''Parameters'''
{|class="wizarpostable"
|-
! scope="row" colspan="2" | Parameters
|-
| nHandle || '''int:''' Handle of this device, returned from open
|}
{|
{|
|-
|-
| ''nHandle'' || int || Handle of this device, returned from open
|  
|}
{|class="wizarpostable"
|-
!  scope="row" colspan="2" | Returns
|-
int || The result code, >= 0, success; <0 [[Error_code|error code]].
|}
|}
'''Returns'''


The result code, >= 0, success; <0 [[Error_code|error code]].
 
=== <big>ctrl_devs</big>===
=== ctrl_devs===
   <syntaxhighlight lang="c">int customer_display_ctrl_devs(int nHandle, int nCmd, int nValue)</syntaxhighlight >
   int customer_display_ctrl_devs(int nHandle, int nCmd, int nValue)
Use the function of the CustomerDisplay, such as set background, display default screen, open or close led, buzzer beep and so on.
Use the function of the CustomerDisplay, such as set background, display default screen, open or close led, buzzer beep and so on.


'''Parameters'''
{|class="wizarpostable"
{|
|-
! scope="row" colspan="2" | Parameters
|-
|-
| ''nHandle'' || int || Handle of this device, returned from open
| nHandle || '''int:''' Handle of this device, returned from open
|-
|-
| ''nCmd'' || int || Control command
| nCmd || '''int:''' Control command
|-
|-
| ''nValue'' || int || Value of control command
| nValue || '''int:''' Value of control command
|}
|}
find nCmd and nValue from the follow table:
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 52: Line 64:
| 0x07:buzzer.|| 0
| 0x07:buzzer.|| 0
|}
|}
'''Returns'''
{|class="wizarpostable"
|-
!  scope="row" colspan="2" | Returns
|-
|  int || The result code, >= 0, success; <0 [[Error_code|error code]].
|}
 


The result code, >= 0, success; <0 [[Error_code|error code]].
=== <big>write_picture</big>===
   <syntaxhighlight lang="c">int customer_display_write_picture_data(int nHandle, unsigned int nXcoordinate, unsigned int nYcoordinate,unsigned int nWidth, unsigned int nHeight ,unsigned char* pData, unsigned int nDataLength)</syntaxhighlight >
=== write_picture===
   int customer_display_write_picture_data(int nHandle, unsigned int nXcoordinate, unsigned int nYcoordinate,unsigned int nWidth, unsigned int nHeight ,unsigned char* pData, unsigned int nDataLength)
Write picture point data(one point to 4 bytes in ARGB8888).
Write picture point data(one point to 4 bytes in ARGB8888).
You need firstly convert a Bitmap to point data.
You need firstly convert a Bitmap to point data.
 
{|class="wizarpostable"
 
|-
'''Parameters'''
! scope="row" colspan="2" | Parameters
{|
|-
| nHandle || '''int:''' Handle of this device, returned from open
|-
| nXcoordinate || '''unsigned int:''' X cordinate
|-
| nYcoordinate || '''unsigned int:''' Y cordinate
|-
|-
| ''nHandle'' || int || Handle of this device, returned from open
| nWidth || '''unsigned int:''' width
|-
|-
| ''nXcoordinate'' || unsigned int || X cordinate
| nHeight || '''unsigned int:''' Height
|-
|-
| ''nYcoordinate'' || unsigned int || Y cordinate
| pData || '''unsigned char*:''' All point data
|-
|-
| ''nWidth'' || unsigned int || width
| nDataLength || '''unsigned int:''' Point data length
|}
{|
|-
|-
| ''nHeight'' || unsigned int || Height
|  
|}
{|class="wizarpostable"
|-
|-
| ''pData'' || unsigned char* || All point data
!  scope="row" colspan="2" | Returns
|-
|-
| ''nDataLength'' || unsigned int || Point data length
| int || The result code, >= 0, success; <0 [[Error_code|error code]].
|}
|}
'''Returns'''
The result code, >= 0, success; <0 [[Error_code|error code]].

Revision as of 09:12, 2 May 2018

Functions

The calling sequence is open>ctrl_devs/write_picture>close

open

void* customer_display_open(int* pError)

Open the CustomerDisplay device. This operation should be used before other operations.

Parameters
pErrorCode int*: if out is null, can not open, else, the out is the handler


close

int customer_display_close(int nHandle)

Close the CustomerDisplay device opened before. The open and close apis are pair operations. If you don’t want to use this device, you should call the close api to release this device.

Parameters
nHandle int: Handle of this device, returned from open
Returns
int The result code, >= 0, success; <0 error code.


ctrl_devs

int customer_display_ctrl_devs(int nHandle, int nCmd, int nValue)

Use the function of the CustomerDisplay, such as set background, display default screen, open or close led, buzzer beep and so on.

Parameters
nHandle int: Handle of this device, returned from open
nCmd int: Control command
nValue int: Value of control command

find nCmd and nValue from the follow table:

nCmd nValue
0x04:set background. RED :0x001F;BLACK:0X0000;YELLOW:0X07FF;BLUE:0XF800;GRAY0:0XCE9A.
0x05:display default screen. 0
0x06:led. 1:open led; 0:close led.
0x07:buzzer. 0
Returns
int The result code, >= 0, success; <0 error code.


write_picture

int customer_display_write_picture_data(int nHandle, unsigned int nXcoordinate, unsigned int nYcoordinate,unsigned int nWidth, unsigned int nHeight ,unsigned char* pData, unsigned int nDataLength)

Write picture point data(one point to 4 bytes in ARGB8888). You need firstly convert a Bitmap to point data.

Parameters
nHandle int: Handle of this device, returned from open
nXcoordinate unsigned int: X cordinate
nYcoordinate unsigned int: Y cordinate
nWidth unsigned int: width
nHeight unsigned int: Height
pData unsigned char*: All point data
nDataLength unsigned int: Point data length
Returns
int The result code, >= 0, success; <0 error code.