Compare commits
7 Commits
73e1c7dafa
...
main
Author | SHA1 | Date | |
---|---|---|---|
f0d004e8c5 | |||
caf35e2429 | |||
c1b09ae48f | |||
10bedef9f0 | |||
867535b95f | |||
364af82a07 | |||
0113a2a2b1 |
3
.vscode/settings.json
vendored
@ -13,6 +13,7 @@
|
||||
"moto_config.h": "c",
|
||||
"awtk.h": "c",
|
||||
"video_callbacks.h": "c",
|
||||
"freertos.h": "c"
|
||||
"freertos.h": "c",
|
||||
"mmu.h": "c"
|
||||
}
|
||||
}
|
@ -1,17 +1,17 @@
|
||||
G:\mengxun\A58-AMTLDR\AMT630Hv100\Obj\AMTLDR.pbd
|
||||
G:\mengxun\A58-AMTLDR\AMT630Hv100\Obj\diskio.pbi
|
||||
G:\mengxun\A58-AMTLDR\AMT630Hv100\Obj\ff.pbi
|
||||
G:\mengxun\A58-AMTLDR\AMT630Hv100\Obj\clockcfg.pbi
|
||||
G:\mengxun\A58-AMTLDR\AMT630Hv100\Obj\crc32.pbi
|
||||
G:\mengxun\A58-AMTLDR\AMT630Hv100\Obj\Entry.pbi
|
||||
G:\mengxun\A58-AMTLDR\AMT630Hv100\Obj\exception.pbi
|
||||
G:\mengxun\A58-AMTLDR\AMT630Hv100\Obj\gpio.pbi
|
||||
G:\mengxun\A58-AMTLDR\AMT630Hv100\Obj\mmu.pbi
|
||||
G:\mengxun\A58-AMTLDR\AMT630Hv100\Obj\sdmmc.pbi
|
||||
G:\mengxun\A58-AMTLDR\AMT630Hv100\Obj\SpiBooter.pbi
|
||||
G:\mengxun\A58-AMTLDR\AMT630Hv100\Obj\SpinandBooter.pbi
|
||||
G:\mengxun\A58-AMTLDR\AMT630Hv100\Obj\sysinfo.pbi
|
||||
G:\mengxun\A58-AMTLDR\AMT630Hv100\Obj\timer.pbi
|
||||
G:\mengxun\A58-AMTLDR\AMT630Hv100\Obj\UartPrint.pbi
|
||||
G:\mengxun\A58-AMTLDR\AMT630Hv100\Obj\wdt.pbi
|
||||
G:\mengxun\A58-AMTLDR\AMT630Hv100\Obj\cp15.pbi
|
||||
G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\AMT630Hv100\Obj\AMTLDR.pbd
|
||||
G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\AMT630Hv100\Obj\diskio.pbi
|
||||
G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\AMT630Hv100\Obj\ff.pbi
|
||||
G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\AMT630Hv100\Obj\clockcfg.pbi
|
||||
G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\AMT630Hv100\Obj\crc32.pbi
|
||||
G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\AMT630Hv100\Obj\Entry.pbi
|
||||
G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\AMT630Hv100\Obj\exception.pbi
|
||||
G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\AMT630Hv100\Obj\gpio.pbi
|
||||
G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\AMT630Hv100\Obj\mmu.pbi
|
||||
G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\AMT630Hv100\Obj\sdmmc.pbi
|
||||
G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\AMT630Hv100\Obj\SpiBooter.pbi
|
||||
G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\AMT630Hv100\Obj\SpinandBooter.pbi
|
||||
G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\AMT630Hv100\Obj\sysinfo.pbi
|
||||
G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\AMT630Hv100\Obj\timer.pbi
|
||||
G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\AMT630Hv100\Obj\UartPrint.pbi
|
||||
G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\AMT630Hv100\Obj\wdt.pbi
|
||||
G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\AMT630Hv100\Obj\cp15.pbi
|
||||
|
@ -5,299 +5,130 @@
|
||||
<configuration>
|
||||
<name>AMT630Hv100</name>
|
||||
<outputs>
|
||||
<file>$PROJ_DIR$\Src\fs\ff.h</file>
|
||||
<file>$PROJ_DIR$\Src\fs\ff.c</file>
|
||||
<file>$PROJ_DIR$\Src\amt630h.h</file>
|
||||
<file>$PROJ_DIR$\Src\Boot.s</file>
|
||||
<file>$PROJ_DIR$\Src\fs\diskio.h</file>
|
||||
<file>$PROJ_DIR$\Src\fs\integer.h</file>
|
||||
<file>$PROJ_DIR$\Src\fs\diskio.c</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\iccarm_builtin.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\sysinfo.pbi</file>
|
||||
<file>$PROJ_DIR$\Src\spi.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\crc32.pbi</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\cp15.o</file>
|
||||
<file>$PROJ_DIR$\Src\scsi.h</file>
|
||||
<file>$PROJ_DIR$\Src\timer.h</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\DLib_Config_Normal.h</file>
|
||||
<file>$PROJ_DIR$\Src\crc32.c</file>
|
||||
<file>$PROJ_DIR$\Src\Entry.c</file>
|
||||
<file>$PROJ_DIR$\Src\SpiBooter.c</file>
|
||||
<file>$PROJ_DIR$\Src\sysinfo.c</file>
|
||||
<file>$PROJ_DIR$\Src\SpinandBooter.c</file>
|
||||
<file>$PROJ_DIR$\Src\timer.c</file>
|
||||
<file>$PROJ_DIR$\Src\typedef.h</file>
|
||||
<file>$PROJ_DIR$\Src\wdt.c</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\AMTLDR.pbd</file>
|
||||
<file>$PROJ_DIR$\Src\exception.c</file>
|
||||
<file>$PROJ_DIR$\Src\BootModeSel.h</file>
|
||||
<file>$PROJ_DIR$\Src\mmu.c</file>
|
||||
<file>$PROJ_DIR$\Src\sysinfo.h</file>
|
||||
<file>$PROJ_DIR$\Src\UartPrint.c</file>
|
||||
<file>$PROJ_DIR$\Src\cp15_asm_iar.s</file>
|
||||
<file>$PROJ_DIR$\Src\clockcfg.c</file>
|
||||
<file>$PROJ_DIR$\Src\list.h</file>
|
||||
<file>$PROJ_DIR$\Src\sdmmc.c</file>
|
||||
<file>$PROJ_DIR$\Src\sdmmc.h</file>
|
||||
<file>$PROJ_DIR$\Src\cp15.c</file>
|
||||
<file>$PROJ_DIR$\Src\gpio.c</file>
|
||||
<file>$PROJ_DIR$\Src\crc32.h</file>
|
||||
<file>$PROJ_DIR$\Src\UartPrint.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\cp15.pbi</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\timer.pbi</file>
|
||||
<file>$TOOLKIT_DIR$\lib\dl7Sx_tln.a</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\ff.o</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\wdt.pbi</file>
|
||||
<file>$PROJ_DIR$\AMTLDR.icf</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\gpio.o</file>
|
||||
<file>$PROJ_DIR$\Src\cp15.h</file>
|
||||
<file>$PROJ_DIR$\..\..\A58-AMTLDR\Src\Entry.c</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\sysinfo.pbi</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\stdint.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\sdmmc.o</file>
|
||||
<file>$TOOLKIT_DIR$\lib\dl7Sx_tln.a</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\wdt.pbi</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\DLib_Product_stdlib.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\SpinandBooter.pbi</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\Boot.o</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\diskio.pbi</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\clockcfg.pbi</file>
|
||||
<file>$PROJ_DIR$\AMTLDR.icf</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\clockcfg.o</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\cp15.o</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\ff.o</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\SpinandBooter.pbi</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\yvals.h</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\stdlib.h</file>
|
||||
<file>$TOOLKIT_DIR$\lib\rt7Sx_tl.a</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\exception.o</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\diskio.pbi</file>
|
||||
<file>$PROJ_DIR$\Src\SpinandBooter.c</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\timer.o</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\ff.pbi</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\DLib_Product.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\cp15_asm_iar.o</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\ysizet.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Exe\AMTLDR.bin</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\mmu.pbi</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\ycheck.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\List\AMTLDR.map</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\diskio.o</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\SpiBooter.o</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\intrinsics.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\UartPrint.pbi</file>
|
||||
<file>$TOOLKIT_DIR$\lib\m7Sx_tl.a</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\crc32.o</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\Entry.pbi</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Exe\AMTLDR.out</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\sdmmc.pbi</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\DLib_Product_string.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\Entry.o</file>
|
||||
<file>$PROJ_DIR$\Src\gpio.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\SpiBooter.pbi</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\UartPrint.o</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\mmu.o</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\exception.pbi</file>
|
||||
<file>$TOOLKIT_DIR$\lib\sh7Sxs_l.a</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\wdt.o</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\string.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\SpinandBooter.o</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\iar_intrinsics_common.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\UartPrint.pbi</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\cp15_asm_iar.o</file>
|
||||
<file>$PROJ_DIR$\Src\wdt.c</file>
|
||||
<file>$PROJ_DIR$\Src\sdmmc.h</file>
|
||||
<file>$PROJ_DIR$\Src\spi.h</file>
|
||||
<file>$PROJ_DIR$\Src\sysinfo.c</file>
|
||||
<file>$PROJ_DIR$\Src\sysinfo.h</file>
|
||||
<file>$PROJ_DIR$\Src\list.h</file>
|
||||
<file>$PROJ_DIR$\Src\UartPrint.c</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\crc32.o</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Exe\AMTLDR.bin</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\ysizet.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\Entry.o</file>
|
||||
<file>$TOOLKIT_DIR$\lib\m7Sx_tl.a</file>
|
||||
<file>$PROJ_DIR$\Src\gpio.h</file>
|
||||
<file>$PROJ_DIR$\Src\UartPrint.h</file>
|
||||
<file>$PROJ_DIR$\Src\cp15.c</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\UartPrint.o</file>
|
||||
<file>$TOOLKIT_DIR$\lib\sh7Sxs_l.a</file>
|
||||
<file>$PROJ_DIR$\Src\cp15_asm_iar.s</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\DLib_Product_string.h</file>
|
||||
<file>$PROJ_DIR$\Src\scsi.h</file>
|
||||
<file>$PROJ_DIR$\Src\typedef.h</file>
|
||||
<file>$PROJ_DIR$\Src\sdmmc.c</file>
|
||||
<file>$PROJ_DIR$\Src\timer.c</file>
|
||||
<file>$PROJ_DIR$\Src\SpiBooter.c</file>
|
||||
<file>$PROJ_DIR$\Src\mmu.c</file>
|
||||
<file>$PROJ_DIR$\Src\timer.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\wdt.o</file>
|
||||
<file>$PROJ_DIR$\Src\mmu.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\AMTLDR.pbd</file>
|
||||
<file>$TOOLKIT_DIR$\lib\rt7Sx_tl.a</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\clockcfg.pbi</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\cp15.pbi</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\Entry.pbi</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\gpio.o</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\DLib_Defaults.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\mmu.o</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\gpio.pbi</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\SpiBooter.pbi</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\mmu.pbi</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\DLib_Config_Normal.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\crc32.pbi</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\iar_intrinsics_common.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\ff.pbi</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\sdmmc.o</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\List\AMTLDR.map</file>
|
||||
<file>$PROJ_DIR$\Src\cp15.h</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\ycheck.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\sdmmc.pbi</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\exception.pbi</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\exception.o</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\DLib_Product.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\SpiBooter.o</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\diskio.o</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\intrinsics.h</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Exe\AMTLDR.out</file>
|
||||
<file>$PROJ_DIR$\AMT630Hv100\Obj\sysinfo.o</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\stdio.h</file>
|
||||
<file>$PROJ_DIR$\Src\mmu.h</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\DLib_Defaults.h</file>
|
||||
<file>$TOOLKIT_DIR$\inc\c\string.h</file>
|
||||
<file>$PROJ_DIR$\Src\clockcfg.c</file>
|
||||
<file>$PROJ_DIR$\Src\crc32.c</file>
|
||||
<file>$PROJ_DIR$\Src\Boot.s</file>
|
||||
<file>$PROJ_DIR$\Src\crc32.h</file>
|
||||
<file>$PROJ_DIR$\Src\Entry.c</file>
|
||||
<file>$PROJ_DIR$\Src\exception.c</file>
|
||||
<file>$PROJ_DIR$\Src\gpio.c</file>
|
||||
<file>$PROJ_DIR$\Src\fs\diskio.c</file>
|
||||
<file>$PROJ_DIR$\Src\fs\diskio.h</file>
|
||||
<file>$PROJ_DIR$\Src\fs\ff.c</file>
|
||||
<file>$PROJ_DIR$\Src\fs\ff.h</file>
|
||||
<file>$PROJ_DIR$\Src\fs\integer.h</file>
|
||||
<file>$PROJ_DIR$\Src\amt630h.h</file>
|
||||
<file>$PROJ_DIR$\Src\BootModeSel.h</file>
|
||||
</outputs>
|
||||
<file>
|
||||
<name>[ROOT_NODE]</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ILINK</name>
|
||||
<file> 74 66</file>
|
||||
<file> 76 66</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\fs\ff.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 41</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 59</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 85 65 54 92 14 60 62 76 0 5 4</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 65 76 14 4 62 0 54 60 85 92 5</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\Boot.s</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>AARM</name>
|
||||
<file> 50</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\fs\diskio.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 67</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 51</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 4 5</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 4 5</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\crc32.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 72</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 10</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 90 65 54 92 14 60 62 55 48</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 92 54 65 60 62 55 14 90 48</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\Entry.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 77</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 73</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 21 2 25 37 13 91 45 46 65 54 92 14 60 27 9</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 13 21 92 25 27 54 2 37 91 9 45 46 65 14 60</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\SpiBooter.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 68</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 79</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 85 65 54 92 14 60 62 76 21 2 37 13 9 45 46 27 36 78</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 36 13 62 60 21 2 45 65 76 14 37 9 27 78 54 92 46 85</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\sysinfo.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 89</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 8</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 2 27 36</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 36 27 2</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\SpinandBooter.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 86</file>
|
||||
<file> 19</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 49</file>
|
||||
<file> 13</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 90 65 54 92 14 60 62 85 76 21 2 37 13 9 45 46 27 36 78</file>
|
||||
<file> 78 68 14 56 61 72 31 79 40 42 92 35 47 24 67 4 26 83 34</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 62 27 60 37 65 21 9 78 14 76 85 2 13 45 36 54 92 46 90</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\timer.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 58</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 39</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 2 13 21</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 21 13 2</file>
|
||||
<file> 31 26 72 35 68 42 24 34 61 40 79 92 47 67 83 14 56 4 78</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
@ -306,67 +137,44 @@
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 84</file>
|
||||
<file> 48</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 42</file>
|
||||
<file> 6</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 2 37</file>
|
||||
<file> 92 35</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 37 2</file>
|
||||
<file> 35 92</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\exception.c</name>
|
||||
<name>$PROJ_DIR$\Src\sysinfo.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 57</file>
|
||||
<file> 77</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 82</file>
|
||||
<file> 3</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 37</file>
|
||||
<file> 92 26 83</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 37</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\mmu.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 81</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 64</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 91 45 46 65 54 92 14 60</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 45 14 46 65 60 54 92 91</file>
|
||||
<file> 83 26 92</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
@ -375,76 +183,21 @@
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 80</file>
|
||||
<file> 37</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 70</file>
|
||||
<file> 20</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 2 21 37</file>
|
||||
<file> 92 42 35</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 37 21 2</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\cp15_asm_iar.s</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>AARM</name>
|
||||
<file> 61</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\clockcfg.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 53</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 52</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 2</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 2</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\sdmmc.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 47</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 75</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 85 65 54 92 14 60 62 76 21 2 33 37 13 0 5 4 36 27</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 36 37 62 60 2 0 65 21 33 13 4 27 76 14 5 85 54 92</file>
|
||||
<file> 35 42 92</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
@ -457,40 +210,118 @@
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 38</file>
|
||||
<file> 53</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 45 46 65 54 92 14 60 37 69 7 87</file>
|
||||
<file> 67 4 68 14 56 61 72 35 75 0 63</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 14 7 65 60 37 69 46 54 92 87 45</file>
|
||||
<file> 61 0 68 72 35 75 4 14 56 63 67</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\gpio.c</name>
|
||||
<name>$PROJ_DIR$\Src\cp15_asm_iar.s</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>AARM</name>
|
||||
<file> 21</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\sdmmc.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 44</file>
|
||||
<file> 65</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 88</file>
|
||||
<file> 69</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 2</file>
|
||||
<file> 79 68 14 56 61 72 31 40 42 92 23 35 47 90 91 88 83 26</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 2</file>
|
||||
<file> 83 35 31 72 92 90 68 42 23 47 88 26 40 61 91 79 14 56</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\timer.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 18</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 1</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 92 47 42</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 42 47 92</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\SpiBooter.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 73</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 59</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 79 68 14 56 61 72 31 40 42 92 35 47 24 67 4 26 83 34</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 83 47 31 72 42 92 67 68 40 61 35 24 26 34 14 56 4 79</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\mmu.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 57</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 60</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 49 67 4 68 14 56 61 72</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 67 61 4 68 72 14 56 49</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
@ -503,13 +334,183 @@
|
||||
</tool>
|
||||
<tool>
|
||||
<name>OBJCOPY</name>
|
||||
<file> 63</file>
|
||||
<file> 30</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ILINK</name>
|
||||
<file> 43 50 53 11 61 72 67 77 57 41 44 81 47 68 86 89 58 80 84 83 56 71 40</file>
|
||||
<file> 9 8 10 11 21 29 74 32 71 12 55 57 65 73 19 77 18 37 48 38 51 33 5</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\clockcfg.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 10</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 52</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 92</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 92</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\crc32.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 29</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 62</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 78 68 14 56 61 72 31 15 7</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 56 14 68 72 31 15 61 78 7</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\Boot.s</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>AARM</name>
|
||||
<file> 8</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\Entry.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 32</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 54</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 42 92 93 35 47 49 67 4 68 14 56 61 72 26 24</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 47 42 56 93 26 14 92 35 49 24 67 4 68 61 72</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\exception.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 71</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 70</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 35</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 35</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\gpio.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 55</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 58</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 92</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 92</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\fs\diskio.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 74</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 16</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 88 91</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 88 91</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
<file>
|
||||
<name>$PROJ_DIR$\Src\fs\ff.c</name>
|
||||
<outputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 12</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 64</file>
|
||||
</tool>
|
||||
</outputs>
|
||||
<inputs>
|
||||
<tool>
|
||||
<name>ICCARM</name>
|
||||
<file> 79 68 14 56 61 72 31 40 90 91 88</file>
|
||||
</tool>
|
||||
<tool>
|
||||
<name>BICOMP</name>
|
||||
<file> 68 40 61 88 31 90 14 72 79 56 91</file>
|
||||
</tool>
|
||||
</inputs>
|
||||
</file>
|
||||
|
@ -25,7 +25,7 @@ if not "%~1" == "" goto debugFile
|
||||
|
||||
@echo on
|
||||
|
||||
"E:\IAR\common\bin\cspybat" -f "G:\mengxun\A58-AMTLDR\settings\AMTLDR.AMT630Hv100.general.xcl" --backend -f "G:\mengxun\A58-AMTLDR\settings\AMTLDR.AMT630Hv100.driver.xcl"
|
||||
"E:\IAR\common\bin\cspybat" -f "G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\settings\AMTLDR.AMT630Hv100.general.xcl" --backend -f "G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\settings\AMTLDR.AMT630Hv100.driver.xcl"
|
||||
|
||||
@echo off
|
||||
goto end
|
||||
@ -34,7 +34,7 @@ goto end
|
||||
|
||||
@echo on
|
||||
|
||||
"E:\IAR\common\bin\cspybat" -f "G:\mengxun\A58-AMTLDR\settings\AMTLDR.AMT630Hv100.general.xcl" "--debug_file=%~1" --backend -f "G:\mengxun\A58-AMTLDR\settings\AMTLDR.AMT630Hv100.driver.xcl"
|
||||
"E:\IAR\common\bin\cspybat" -f "G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\settings\AMTLDR.AMT630Hv100.general.xcl" "--debug_file=%~1" --backend -f "G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\settings\AMTLDR.AMT630Hv100.driver.xcl"
|
||||
|
||||
@echo off
|
||||
:end
|
@ -23,9 +23,9 @@
|
||||
|
||||
if ($debugfile -eq "")
|
||||
{
|
||||
& "E:\IAR\common\bin\cspybat" -f "G:\mengxun\A58-AMTLDR\settings\AMTLDR.AMT630Hv100.general.xcl" --backend -f "G:\mengxun\A58-AMTLDR\settings\AMTLDR.AMT630Hv100.driver.xcl"
|
||||
& "E:\IAR\common\bin\cspybat" -f "G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\settings\AMTLDR.AMT630Hv100.general.xcl" --backend -f "G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\settings\AMTLDR.AMT630Hv100.driver.xcl"
|
||||
}
|
||||
else
|
||||
{
|
||||
& "E:\IAR\common\bin\cspybat" -f "G:\mengxun\A58-AMTLDR\settings\AMTLDR.AMT630Hv100.general.xcl" --debug_file=$debugfile --backend -f "G:\mengxun\A58-AMTLDR\settings\AMTLDR.AMT630Hv100.driver.xcl"
|
||||
& "E:\IAR\common\bin\cspybat" -f "G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\settings\AMTLDR.AMT630Hv100.general.xcl" --debug_file=$debugfile --backend -f "G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\settings\AMTLDR.AMT630Hv100.driver.xcl"
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
"E:\IAR\arm\bin\armjlink2.dll"
|
||||
|
||||
"G:\mengxun\A58-AMTLDR\AMT630Hv100\Exe\AMTLDR.out"
|
||||
"G:\mengxun\MAX_CARLINK_A270S\A27-AMTLDR\AMT630Hv100\Exe\AMTLDR.out"
|
||||
|
||||
--plugin="E:\IAR\arm\bin\armbat.dll"
|
||||
|
||||
|
@ -135,7 +135,7 @@
|
||||
<RecentlyUsedMenus>1</RecentlyUsedMenus>
|
||||
<MenuShadows>1</MenuShadows>
|
||||
<ShowAllMenusAfterDelay>1</ShowAllMenusAfterDelay>
|
||||
<CommandsUsage>2D0500000800108600007303000020810000010000000F810000010000000C810000010000000E81000001000000058400000100000046810000B50100005D86000003000000</CommandsUsage>
|
||||
<CommandsUsage>3B0500000800108600007D03000020810000010000000F810000010000000C810000010000000E81000001000000058400000100000046810000B90100005D86000003000000</CommandsUsage>
|
||||
</MFCToolBarParameters>
|
||||
<CommandManager>
|
||||
<CommandsWithoutImages>0600008800000188000002880000038800000488000005880000</CommandsWithoutImages>
|
||||
|
@ -50,9 +50,11 @@
|
||||
<mode>0</mode>
|
||||
</DisassembleMode>
|
||||
<Breakpoints2>
|
||||
<Bp0>_ 1 "EMUL_CODE" "{$PROJ_DIR$\Src\Entry.c}.353.2" 0 0 1 "" 0 "" 0</Bp0>
|
||||
<Bp1>_ 1 "EMUL_CODE" "{$PROJ_DIR$\Src\Entry.c}.386.2" 0 0 1 "" 0 "" 0</Bp1>
|
||||
<Count>2</Count>
|
||||
<Bp0>_ 0 "EMUL_CODE" "{$PROJ_DIR$\Src\Entry.c}.353.2" 0 0 1 "" 0 "" 0</Bp0>
|
||||
<Bp1>_ 0 "EMUL_CODE" "{$PROJ_DIR$\Src\Entry.c}.386.2" 0 0 1 "" 0 "" 0</Bp1>
|
||||
<Bp2>_ 1 "EMUL_CODE" "{$PROJ_DIR$\..\..\A58-AMTLDR\Src\Entry.c}.353.2" 0 0 1 "" 0 "" 0</Bp2>
|
||||
<Bp3>_ 1 "EMUL_CODE" "{$PROJ_DIR$\..\..\A58-AMTLDR\Src\Entry.c}.386.2" 0 0 1 "" 0 "" 0</Bp3>
|
||||
<Count>4</Count>
|
||||
</Breakpoints2>
|
||||
<Aliases>
|
||||
<A0>_ "G:\A58-AMTLDR\Src\Entry.c" ""</A0>
|
||||
|
@ -82,7 +82,7 @@
|
||||
<RecentlyUsedMenus>1</RecentlyUsedMenus>
|
||||
<MenuShadows>1</MenuShadows>
|
||||
<ShowAllMenusAfterDelay>1</ShowAllMenusAfterDelay>
|
||||
<CommandsUsage>010200000800108600000200000020810000010000000F810000010000000C810000050000000E810000F7010000058400000400000046810000010000005D86000001000000</CommandsUsage>
|
||||
<CommandsUsage>050200000800108600000200000020810000010000000F810000010000000C810000050000000E810000FB010000058400000400000046810000010000005D86000001000000</CommandsUsage>
|
||||
</MFCToolBarParameters>
|
||||
<CommandManager>
|
||||
<CommandsWithoutImages>12000D8400000F84000008840000FFFFFFFF54840000328100001C810000098400007784000007840000808C000044D50000008800000188000002880000038800000488000005880000</CommandsWithoutImages>
|
||||
@ -339,7 +339,7 @@
|
||||
</BasePane-34049>
|
||||
<MFCToolBar-34050>
|
||||
<Name>Main</Name>
|
||||
<Buttons>00200000010000002000FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000035000000FFFEFF000000000000000000000000000100000001000000018001E100000000000036000000FFFEFF000000000000000000000000000100000001000000018003E100000000040038000000FFFEFF0000000000000000000000000001000000010000000180008100000000000019000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E10000000004003B000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E10000000004003D000000FFFEFF000000000000000000000000000100000001000000018022E10000000004003C000000FFFEFF000000000000000000000000000100000001000000018025E10000000004003F000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE100000000040042000000FFFEFF00000000000000000000000000010000000100000001802CE100000000040043000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6E4281000000000400FFFFFFFFFFFEFF0000000000000000000100000000000000010000007800000002002050FFFFFFFFFFFEFF0096000000000000000000018021810000000004002C000000FFFEFF000000000000000000000000000100000001000000018024E10000000004003E000000FFFEFF000000000000000000000000000100000001000000018028E100000000040040000000FFFEFF000000000000000000000000000100000001000000018029E100000000040041000000FFFEFF000000000000000000000000000100000001000000018002810000000004001B000000FFFEFF0000000000000000000000000001000000010000000180298100000000040030000000FFFEFF000000000000000000000000000100000001000000018027810000000004002E000000FFFEFF000000000000000000000000000100000001000000018028810000000004002F000000FFFEFF00000000000000000000000000010000000100000001801D8100000000040028000000FFFEFF00000000000000000000000000010000000100000001801E8100000000040029000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B810000000004001F000000FFFEFF00000000000000000000000000010000000100000001800C8100000000000020000000FFFEFF00000000000000000000000000010000000100000001805F8600000000000034000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800E8100000000000022000000FFFEFF00000000000000000000000000010000000100000001800F8100000000000023000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E00E8020000</Buttons>
|
||||
<Buttons>00200000010000002000FFFF01001100434D4643546F6F6C426172427574746F6E00E100000000000035000000FFFEFF000000000000000000000000000100000001000000018001E100000000000036000000FFFEFF000000000000000000000000000100000001000000018003E100000000000038000000FFFEFF0000000000000000000000000001000000010000000180008100000000000019000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018007E10000000000003B000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000018023E10000000004003D000000FFFEFF000000000000000000000000000100000001000000018022E10000000004003C000000FFFEFF000000000000000000000000000100000001000000018025E10000000000003F000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001802BE100000000040042000000FFFEFF00000000000000000000000000010000000100000001802CE100000000040043000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF000000000000000000000000000100000001000000FFFF01001900434D4643546F6F6C426172436F6D626F426F78427574746F6E4281000000000000FFFFFFFFFFFEFF0000000000000000000100000000000000010000007800000002002050FFFFFFFFFFFEFF0096000000000000000000018021810000000004002C000000FFFEFF000000000000000000000000000100000001000000018024E10000000000003E000000FFFEFF000000000000000000000000000100000001000000018028E100000000040040000000FFFEFF000000000000000000000000000100000001000000018029E100000000000041000000FFFEFF000000000000000000000000000100000001000000018002810000000000001B000000FFFEFF0000000000000000000000000001000000010000000180298100000000000030000000FFFEFF000000000000000000000000000100000001000000018027810000000000002E000000FFFEFF000000000000000000000000000100000001000000018028810000000000002F000000FFFEFF00000000000000000000000000010000000100000001801D8100000000040028000000FFFEFF00000000000000000000000000010000000100000001801E8100000000040029000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800B810000000004001F000000FFFEFF00000000000000000000000000010000000100000001800C8100000000000020000000FFFEFF00000000000000000000000000010000000100000001805F8600000000000034000000FFFEFF00000000000000000000000000010000000100000001800000000001000000FFFFFFFFFFFEFF00000000000000000000000000010000000100000001800E8100000000000022000000FFFEFF00000000000000000000000000010000000100000001800F8100000000000023000000FFFEFF00000000000000000000000000010000000100000000000000FFFEFF044D00610069006E00E8020000</Buttons>
|
||||
</MFCToolBar-34050>
|
||||
<Pane-34050>
|
||||
<ID>34050</ID>
|
||||
@ -375,7 +375,7 @@
|
||||
</ChildIdMap>
|
||||
<MDIWindows>
|
||||
<MDIClientArea-0>
|
||||
<MDITabsState>010000000300000001000000000000000000000001000000010000000200000000000000010000000100000000000000280000002800000001000000020000000000000001000000FFFEFF142400570053005F0044004900520024005C005300720063005C0045006E007400720079002E00630001000000FFFF010014004966436F6E74656E7453746F72616765496D706CFFFEFF00FFFEFFFF2A013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E003300370031003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E00310031003200370038003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E00310031003200370038003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0745006E007400720079002E00630000000000FFFFFFFFFFFFFFFFFFFEFF132400570053005F0044004900520024005C005300720063005C0042006F006F0074002E007300010000000180FFFEFF00FFFEFFFF27013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E00370039003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0032003800390039003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0032003800390039003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0642006F006F0074002E00730000000000FFFFFFFFFFFFFFFF0000000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD5000100000001000000020000000A01000049000000000600004C020000</MDITabsState>
|
||||
<MDITabsState>010000000300000001000000000000000000000001000000010000000200000000000000010000000100000000000000280000002800000001000000030000000200000001000000FFFEFF142400570053005F0044004900520024005C005300720063005C0045006E007400720079002E00630001000000FFFF010014004966436F6E74656E7453746F72616765496D706CFFFEFF00FFFEFFFF2A013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E003300370031003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E00310031003200370038003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E00310031003200370038003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0745006E007400720079002E00630000000000FFFFFFFFFFFFFFFFFFFEFF132400570053005F0044004900520024005C005300720063005C0042006F006F0074002E007300010000000180FFFEFF00FFFEFFFF27013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E00370039003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E0032003800390039003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E0032003800390039003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0642006F006F0074002E00730000000000FFFFFFFFFFFFFFFFFFFEFF252400570053005F0044004900520024005C002E002E005C002E002E005C004100350038002D0041004D0054004C00440052005C005300720063005C0045006E007400720079002E006300010000000180FFFEFF00FFFEFFFF2A013C003F0078006D006C002000760065007200730069006F006E003D00220031002E0030002200200065006E0063006F00640069006E0067003D0022005500540046002D00380022003F003E000A003C0052006F006F0074003E000A0020002000200020003C004E0075006D0052006F00770073003E0031003C002F004E0075006D0052006F00770073003E000A0020002000200020003C004E0075006D0043006F006C0073003E0031003C002F004E0075006D0043006F006C0073003E000A0020002000200020003C00580050006F0073003E0030003C002F00580050006F0073003E000A0020002000200020003C00590050006F0073003E0030003C002F00590050006F0073003E000A0020002000200020003C00530065006C00530074006100720074003E0030003C002F00530065006C00530074006100720074003E000A0020002000200020003C00530065006C0045006E0064003E0030003C002F00530065006C0045006E0064003E000A0020002000200020003C00580050006F00730032003E0030003C002F00580050006F00730032003E000A0020002000200020003C00590050006F00730032003E003300370031003C002F00590050006F00730032003E000A0020002000200020003C00530065006C005300740061007200740032003E00310031003400300031003C002F00530065006C005300740061007200740032003E000A0020002000200020003C00530065006C0045006E00640032003E00310031003400300031003C002F00530065006C0045006E00640032003E000A003C002F0052006F006F0074003E000A00FFFEFF0745006E007400720079002E00630000000000FFFFFFFFFFFFFFFF0000000010000000C5D4F200FFDC7800BECEA100F0A0A100BCA8E1009CC1B600F7B88600D9ADC200A5C2D700B3A6BE00EAD6A300F6FA7D00B5E99D005FC3CF00C1838300CACAD5000100000001000000020000000A01000049000000000600004C020000</MDITabsState>
|
||||
</MDIClientArea-0>
|
||||
</MDIWindows>
|
||||
</WindowStorage>
|
||||
|
@ -7,10 +7,18 @@
|
||||
|
||||
#include "gpio_protocol.h"
|
||||
|
||||
#include "moto_config.h"
|
||||
|
||||
#if DEVICE_MXC_A58
|
||||
// #define CAN_USE_TX_DEMO
|
||||
#elif DEVICE_MXC_A59
|
||||
// #define CAN_USE_TX_DEMO
|
||||
#else
|
||||
|
||||
#ifdef UI_VIEW_QUICKLY_ARRANGE
|
||||
#define CAN_USE_TX_DEMO
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define CAN_RX_BUF_NUM 32
|
||||
@ -692,37 +700,52 @@ int iCanGetTransmitErrorCount(CanPort_t *cap)
|
||||
}
|
||||
|
||||
#ifdef CAN_USE_TX_DEMO
|
||||
int cantx_count = 0;
|
||||
static void can_txdemo_thread(void *param)
|
||||
{
|
||||
CanPort_t *cap = param;
|
||||
|
||||
// CanMsg txmsg = {0};
|
||||
// txmsg.IDE = CAN_Id_Standard;
|
||||
// txmsg.DLC = 4;
|
||||
// txmsg.Data[0] = 0x11;
|
||||
// txmsg.Data[1] = 0x22;
|
||||
// txmsg.Data[2] = 0x33;
|
||||
// txmsg.Data[3] = 0x44;
|
||||
uint8_t checksum = 0;
|
||||
CanMsg txmsg = {0};
|
||||
txmsg.StdId = 0x200;
|
||||
txmsg.StdId = 0x213;
|
||||
//txmsg.ExtId = 0x400;
|
||||
txmsg.IDE = CAN_Id_Standard;
|
||||
txmsg.DLC = 8;
|
||||
txmsg.Data[0] = Get_sys_tcs_on_off()?0x8:0x00;
|
||||
|
||||
txmsg.Data[0] = Get_sys_quickly_arrange()?0x0:0x10;
|
||||
if(Get_sys_grade() >= 7)
|
||||
txmsg.Data[1] = 0xFF;//档位
|
||||
else
|
||||
txmsg.Data[1] = Get_sys_grade();//档位
|
||||
txmsg.Data[2] = Get_sys_velocity();//速度
|
||||
txmsg.Data[3] = 0x00;
|
||||
txmsg.Data[4] = 0x00;
|
||||
txmsg.Data[5] = 0x00;
|
||||
txmsg.Data[6] = 0x00;
|
||||
txmsg.Data[7] = 0x00;
|
||||
for (;;) {
|
||||
txmsg.Data[0] = Get_sys_tcs_on_off()?0x8:0x00;
|
||||
iCanWrite(cap, &txmsg, 1, 0);
|
||||
vTaskDelay(pdMS_TO_TICKS(100));
|
||||
if(Get_sys_power_on_self_test() == 100){
|
||||
txmsg.Data[0] = Get_sys_quickly_arrange()?0x0:0x10;
|
||||
if(Get_sys_grade() >= 7)
|
||||
txmsg.Data[1] = 0xFF;//档位
|
||||
else
|
||||
txmsg.Data[1] = Get_sys_grade();
|
||||
txmsg.Data[2] = Get_sys_velocity();
|
||||
iCanWrite(cap, &txmsg, 1, 0);
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
uint8_t can101_flag = 0;
|
||||
uint8_t can_flag = 0;
|
||||
extern uint8_t speed_flag;
|
||||
extern uint8_t abs_speed_flag;
|
||||
|
||||
uint8_t mile_flag = 0;
|
||||
|
||||
static void can_rxdemo_thread(void *param)
|
||||
{
|
||||
CanPort_t *cap = param;
|
||||
int tlv_data_value[8] = {0};
|
||||
uint8_t tlv_data_value[8] = {0};
|
||||
|
||||
for (;;) {
|
||||
CanMsg rxmsg[8] = {0};
|
||||
@ -733,72 +756,26 @@ static void can_rxdemo_thread(void *param)
|
||||
for (i = 0; i < revlen; i++) {
|
||||
for (j = 0; j < rxmsg[i].DLC; j++){
|
||||
tlv_data_value[j] = rxmsg[i].Data[j];
|
||||
}
|
||||
// printf("can>> Id = %03x",rxmsg[i].StdId);
|
||||
#if DEVICE_MXC_A58
|
||||
switch(rxmsg[i].StdId){
|
||||
case 0x37B:
|
||||
if(can_flag != 10)
|
||||
can_flag = 10;
|
||||
tcsworking_event_handing(tlv_data_value);//TCS
|
||||
break;
|
||||
case 0x12B:
|
||||
if(can_flag != 10)
|
||||
can_flag = 10;
|
||||
tcsswitch_event_handing(tlv_data_value);//tcs开关
|
||||
break;
|
||||
case 0x401:
|
||||
break;
|
||||
case 0x402://ECU故障码
|
||||
break;
|
||||
case 0xA5://ABS故障码
|
||||
if(can_flag != 10)
|
||||
can_flag = 10;
|
||||
abs_dtc_event_handing(tlv_data_value);
|
||||
break;
|
||||
case 0xA3://ABS数据
|
||||
break;
|
||||
case 0x101://发送机数据
|
||||
if(can101_flag != 10)
|
||||
can101_flag = 10;
|
||||
if(can_flag != 10)
|
||||
can_flag = 10;
|
||||
speed_event_handing(tlv_data_value);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#elif DEVICE_MXC_A59
|
||||
|
||||
switch(rxmsg[i].StdId){
|
||||
case 0x402://ECU故障码
|
||||
if(can_flag != 10)
|
||||
can_flag = 10;
|
||||
A59_dtc_event_handing(tlv_data_value);
|
||||
break;
|
||||
// case 0x101://发送机数据
|
||||
// if(can101_flag != 10)
|
||||
// can101_flag = 10;
|
||||
// if(can_flag != 10)
|
||||
// can_flag = 10;
|
||||
// speed_event_handing(tlv_data_value);
|
||||
// break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#else
|
||||
}
|
||||
switch(rxmsg[i].StdId){
|
||||
#ifdef SPEED_DATA_CAN
|
||||
// 快排仪表
|
||||
case 0x141: //谟绅ABS
|
||||
if(abs_speed_flag != 10)
|
||||
abs_speed_flag = 10;
|
||||
ASB_141_speed_event_handing(tlv_data_value);
|
||||
break;
|
||||
case 0x101:
|
||||
if(speed_flag != 5)
|
||||
speed_flag = 5;
|
||||
if(speed_flag != 10)
|
||||
speed_flag = 10;
|
||||
speed_event_handing(tlv_data_value);
|
||||
break;
|
||||
case 0x400:
|
||||
tcs_control_event_handing(tlv_data_value);
|
||||
kp_control_event_handing(tlv_data_value);//快排信号指示灯
|
||||
break;
|
||||
case 0x401:
|
||||
if(mile_flag != 10)
|
||||
mile_flag = 10;
|
||||
mil_control_event_handing(tlv_data_value);//引擎开关
|
||||
break;
|
||||
#endif
|
||||
@ -807,7 +784,6 @@ static void can_rxdemo_thread(void *param)
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -828,14 +804,16 @@ int can_demo(void)
|
||||
CAN_FilterInitTypeDef canfilter = {0};
|
||||
/* 只接收ID的第0位为1的帧 */
|
||||
canfilter.MODE = 1; /* 单滤波器模式 */
|
||||
canfilter.ID = 0x37B;
|
||||
canfilter.IDMASK = 0x7ff;
|
||||
// canfilter.ID = 0x37B;
|
||||
// canfilter.IDMASK = 0x7ff;
|
||||
canfilter.ID = 0x402;
|
||||
canfilter.IDMASK = 0X543;
|
||||
vCanSetFilter(cap, &canfilter);
|
||||
#endif
|
||||
|
||||
/* Create a task to test read can msg */
|
||||
if (xTaskCreate(can_rxdemo_thread, "canrx", configMINIMAL_STACK_SIZE, cap,
|
||||
configMAX_PRIORITIES / 3, NULL) != pdPASS) {
|
||||
configMAX_PRIORITIES / 2, NULL) != pdPASS) {
|
||||
printf("create can rxdemo task fail.\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -460,9 +460,9 @@ int rtc_init(void)
|
||||
alarm_irq_enable(0);
|
||||
|
||||
rtc_read_time(&tm);
|
||||
// if (tm.tm_year == 70) {
|
||||
// rtc_set_time(&default_tm);
|
||||
// }
|
||||
if (tm.tm_year == 70) {
|
||||
rtc_set_time(&default_tm);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1090,6 +1090,7 @@ static void uart_rx_demo_thread(void *param)
|
||||
|
||||
int uart_rx_demo(void)
|
||||
{
|
||||
printf("3028 Bluetooth Communicator > UART2 OPEN.\r\n");
|
||||
/* Create a task to process uart rx data */
|
||||
if (xTaskCreate(uart_rx_demo_thread, "uartdemo", configMINIMAL_STACK_SIZE, NULL,
|
||||
configMAX_PRIORITIES / 3, NULL) != pdPASS) {
|
||||
|
@ -75,7 +75,7 @@ static void protocol_uart_tx_thread(void *param)
|
||||
for (;;)
|
||||
{
|
||||
if(uart_tx_flag){
|
||||
if (uart_time_request[0] != 0 && uart_time_request[0] == 0xAA)
|
||||
if (uart_time_request[0] != 0 && (uart_time_request[0] == 0xAA || uart_time_request[0] == 0x27))
|
||||
{
|
||||
// printf("UART3 tx-->>> ");
|
||||
for (uint8_t i = 0; i < uart_tx_flag; i++)
|
||||
@ -331,7 +331,7 @@ static void protocol_uart_rx_thread(void *param)
|
||||
// for(j=0;j<str_len;j++){
|
||||
// printf("%02x ",tlv_data_value[j]);
|
||||
// }
|
||||
// tire_pressure_data_analysis(tlv_data_value);
|
||||
tire_pressure_data_analysis(tlv_data_value);
|
||||
mac_data = 0;
|
||||
}else if(bt_state){//存在呼吸 若呼吸不存在
|
||||
bt_communication_heartbeat = 3;
|
||||
@ -393,6 +393,7 @@ static void protocol_uart_rx_thread(void *param)
|
||||
Send_ota_state(1);
|
||||
}else{
|
||||
printf("enter ota sj.\n");
|
||||
bt_upgrade_flag = 1;
|
||||
Set_sys_power_on_self_test(150);
|
||||
Set_sys_upgrade_Flag(1);//进入ota界面
|
||||
Send_ota_state(0);
|
||||
@ -407,6 +408,7 @@ static void protocol_uart_rx_thread(void *param)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#if 1
|
||||
@ -525,6 +527,7 @@ static void protocol_uart_rx_thread(void *param)
|
||||
|
||||
int uart_communicates_with_bt(void)
|
||||
{
|
||||
printf("8018 Bluetooth Communicator > UART3 OPEN.\r\n");
|
||||
/* Create a task to process uart rx data */
|
||||
if (xTaskCreate(protocol_uart_rx_thread, "uart3rx", configMINIMAL_STACK_SIZE, NULL,
|
||||
configMAX_PRIORITIES / 3, NULL) != pdPASS)
|
||||
|
@ -52,296 +52,8 @@ static uint8_t file_state = UART_FILE_NORMAL;//文件接收状态
|
||||
static uint8_t uup_file_type = UART_FILE_NORMAL;//文件接收状态
|
||||
uint8_t wifi_file_state = UART_FILE_NORMAL;//文件接收状态
|
||||
|
||||
#define BYTESPERPAGE 256
|
||||
#define PAGESPERSECTORS 32//32//16
|
||||
#define UUP_BUF_SIZE (BYTESPERPAGE * PAGESPERSECTORS)
|
||||
#define NEW_APPLDR_CHECKSUM_OFFSET 0x14
|
||||
static unsigned int checksum = 0,calc_checksum = 0xffffffff,test_checksum = 0xffffffff;
|
||||
|
||||
#define NEW_APPFOOSET 0x17F0000
|
||||
#define AMT630_BIN_MAX_SIZE 0x700000
|
||||
|
||||
static uint32_t uup_burn_offset;
|
||||
// static unsigned char uup_buf[4096];
|
||||
static unsigned char uup_buf[8192];
|
||||
static unsigned int uup_buf_len = 0;
|
||||
static unsigned int uup_buf_len_detection = 0;
|
||||
static uint8_t checksum_flag = 0;
|
||||
|
||||
static int test_flag = 0;
|
||||
// static int number = 0;
|
||||
static void ota_update(char *framebuf, size_t len)
|
||||
{
|
||||
unsigned int framelen;
|
||||
framelen = len;
|
||||
sfud_flash *sflash = sfud_get_device(0);
|
||||
if(strcmp(framebuf, "AT_OTA_FINISH") == 0){
|
||||
if(file_state == UART_FILE_FILEXFER)
|
||||
file_state = UART_FILE_FINISH;
|
||||
}
|
||||
|
||||
switch(file_state){
|
||||
case UART_FILE_NORMAL://检测是否是升级
|
||||
if(strcmp(framebuf, "AT_OTA_START") == 0)
|
||||
file_state = UART_FILE_TYPE;
|
||||
break;
|
||||
case UART_FILE_TYPE://检测传输文件类型
|
||||
if(strncmp(framebuf, "AT_OTA_TYPE=",12) == 0 && (framelen == 13)){
|
||||
uup_file_type = framebuf[12] - '0';
|
||||
printf("uup_file_type = %d .\r\n",uup_file_type);
|
||||
if(uup_file_type<6){
|
||||
//擦除flash
|
||||
uup_burn_offset = NEW_APPFOOSET;
|
||||
printf("start erase add %X , size %X .\r\n",uup_burn_offset,AMT630_BIN_MAX_SIZE);
|
||||
if(sfud_erase(sflash, uup_burn_offset, AMT630_BIN_MAX_SIZE)==SFUD_SUCCESS){
|
||||
vTaskDelay(100);
|
||||
printf("UART_FRAME_START sfud erase ok.\n");
|
||||
}else{
|
||||
vTaskDelay(100);
|
||||
printf("UART_FRAME_START sfud erase fail.\n");
|
||||
}
|
||||
checksum_flag = 1;
|
||||
calc_checksum = 0xffffffff;
|
||||
test_checksum = 0xffffffff;
|
||||
test_flag = 0;
|
||||
uup_buf_len =0;
|
||||
checksum = 0;
|
||||
// number = 0;
|
||||
file_state = UART_FILE_START;
|
||||
}else
|
||||
file_state = UART_FILE_NORMAL;
|
||||
}else{
|
||||
file_state = UART_FILE_NORMAL;
|
||||
}
|
||||
|
||||
break;
|
||||
case UART_FILE_START://第一包数据 用于获取当前数据包的校验和
|
||||
if (uup_file_type == UART_FILE_AMT630H) {//代码文件
|
||||
unsigned int magic = framebuf[0] | (framebuf[1] << 8) | (framebuf[2] << 16) | (framebuf[3] << 24);
|
||||
if (magic != UPFILE_APP_MAGIC) {
|
||||
printf("Wrong app file magic. 0x%08X\n",magic);
|
||||
file_state = UART_FILE_NORMAL;
|
||||
break;
|
||||
}
|
||||
unsigned char *tmp = framebuf + NEW_APPLDR_CHECKSUM_OFFSET;
|
||||
checksum = tmp[0] | (tmp[1] <<8) | (tmp[2] << 16) | (tmp[3] << 24);
|
||||
}else if (uup_file_type == UART_FILE_BOOTANIM) {//动画文件
|
||||
BANIHEADER *header = (BANIHEADER *)&framebuf[0];
|
||||
if (header->magic != MKTAG('B', 'A', 'N', 'I')) {
|
||||
printf("Wrong animation file magic.\n");
|
||||
file_state = UART_FILE_NORMAL;
|
||||
break;
|
||||
}
|
||||
checksum = header->checksum;
|
||||
}else if (uup_file_type == UART_FILE_ROM) {//资源文件
|
||||
RomHeader *header = (RomHeader *)&framebuf[0];
|
||||
if (header->magic != MKTAG('R', 'O', 'M', 'A')) {
|
||||
printf("Wrong resource file magic.\n");
|
||||
file_state = UART_FILE_NORMAL;
|
||||
break;
|
||||
}
|
||||
checksum = header->checksum;
|
||||
}
|
||||
printf("uup_file_type = %d ,No1.checksum = 0x%X\n",uup_file_type,checksum);
|
||||
|
||||
uup_buf_len_detection = (uup_buf_len + framelen)>UUP_BUF_SIZE?(UUP_BUF_SIZE-uup_buf_len):0;
|
||||
// printf("1-- framelen = %d uup_buf_len_detection = %d .\r\n",framelen,uup_buf_len_detection);
|
||||
if(!uup_buf_len_detection){
|
||||
memcpy(uup_buf + uup_buf_len, framebuf, framelen);
|
||||
uup_buf_len += framelen;
|
||||
if (uup_buf_len == UUP_BUF_SIZE) {
|
||||
if(!checksum_flag)
|
||||
test_checksum = xcrc32(uup_buf, UUP_BUF_SIZE, test_checksum);//计算校验和
|
||||
sfud_write(sflash, uup_burn_offset, UUP_BUF_SIZE, uup_buf);
|
||||
if(checksum_flag){
|
||||
if (uup_file_type == UART_FILE_AMT630H) {//代码文件
|
||||
unsigned int *tmp = (unsigned int *)(uup_buf + NEW_APPLDR_CHECKSUM_OFFSET);
|
||||
*tmp = 0;
|
||||
}else if (uup_file_type == UART_FILE_BOOTANIM) {//动画文件
|
||||
BANIHEADER *pheader = (BANIHEADER *)uup_buf;
|
||||
pheader->checksum = 0;
|
||||
}else if (uup_file_type == UART_FILE_ROM) {//资源文件
|
||||
RomHeader *pheader = (RomHeader *)uup_buf;
|
||||
pheader->checksum = 0;
|
||||
}
|
||||
checksum_flag = 0;
|
||||
test_flag = 1;
|
||||
|
||||
}
|
||||
|
||||
|
||||
calc_checksum = xcrc32(uup_buf, UUP_BUF_SIZE, calc_checksum);//计算校验和
|
||||
if(test_flag){
|
||||
test_checksum = calc_checksum;
|
||||
printf("test_checksum == calc_checksum 0x%08X.\r\n",test_checksum);
|
||||
test_flag = 0;
|
||||
}
|
||||
|
||||
|
||||
if(calc_checksum != test_checksum){
|
||||
printf("error!!!test_checksum=0x%08X,calc_checksum=0x%08X.\r\n",test_checksum,calc_checksum);
|
||||
}
|
||||
uup_buf_len =0;
|
||||
uup_burn_offset += UUP_BUF_SIZE;
|
||||
//number++;
|
||||
//printf("number =%d,checksum = 0x%08X.\n",number,calc_checksum,checksum);
|
||||
}
|
||||
}else{
|
||||
memcpy(uup_buf + uup_buf_len, framebuf, uup_buf_len_detection);
|
||||
uup_buf_len += uup_buf_len_detection;
|
||||
|
||||
if (uup_buf_len == UUP_BUF_SIZE) {
|
||||
if(!checksum_flag)
|
||||
test_checksum = xcrc32(uup_buf, UUP_BUF_SIZE, test_checksum);//计算校验和
|
||||
sfud_write(sflash, uup_burn_offset, UUP_BUF_SIZE, uup_buf);
|
||||
if(checksum_flag){
|
||||
if (uup_file_type == UART_FILE_AMT630H) {//代码文件
|
||||
unsigned int *tmp = (unsigned int *)(uup_buf + NEW_APPLDR_CHECKSUM_OFFSET);
|
||||
*tmp = 0;
|
||||
}else if (uup_file_type == UART_FILE_BOOTANIM) {//动画文件
|
||||
BANIHEADER *pheader = (BANIHEADER *)uup_buf;
|
||||
pheader->checksum = 0;
|
||||
}else if (uup_file_type == UART_FILE_ROM) {//资源文件
|
||||
RomHeader *pheader = (RomHeader *)uup_buf;
|
||||
pheader->checksum = 0;
|
||||
unsigned int *tmp = (unsigned int *)(uup_buf + 0x0F);
|
||||
}
|
||||
checksum_flag = 0;
|
||||
test_flag = 1;
|
||||
}
|
||||
|
||||
calc_checksum = xcrc32(uup_buf, UUP_BUF_SIZE, calc_checksum);//计算校验和
|
||||
if(test_flag){
|
||||
test_checksum = calc_checksum;
|
||||
printf("test_checksum == calc_checksum 0x%08X.\r\n",test_checksum);
|
||||
test_flag = 0;
|
||||
}
|
||||
if(calc_checksum != test_checksum){
|
||||
printf("error!!!test_checksum=0x%08X,calc_checksum=0x%08X.\r\n",test_checksum,calc_checksum);
|
||||
}
|
||||
uup_buf_len =0;
|
||||
uup_burn_offset += UUP_BUF_SIZE;
|
||||
//number++;
|
||||
//printf("number =%d,checksum = 0x%08X.\n",number,calc_checksum,checksum);
|
||||
}
|
||||
// printf("2-- (framelen - uup_buf_len_detection) = %d .\r\n",(framelen - uup_buf_len_detection));
|
||||
memcpy(uup_buf + uup_buf_len, framebuf, (framelen - uup_buf_len_detection));
|
||||
uup_buf_len += (framelen - uup_buf_len_detection);
|
||||
}
|
||||
// printf(">>UART_FILE_FILEXFER.\r\n");
|
||||
file_state = UART_FILE_FILEXFER;
|
||||
|
||||
break;
|
||||
case UART_FILE_FILEXFER://传输过程中
|
||||
|
||||
uup_buf_len_detection = (uup_buf_len + framelen)>UUP_BUF_SIZE?(UUP_BUF_SIZE-uup_buf_len):0;
|
||||
// printf("uup_buf_len_detection=%d.\r\n",uup_buf_len_detection);
|
||||
if(!uup_buf_len_detection){
|
||||
memcpy(uup_buf + uup_buf_len, framebuf, framelen);
|
||||
uup_buf_len += framelen;
|
||||
// printf("uup_buf_len = %d .\r\n",uup_buf_len);
|
||||
|
||||
if (uup_buf_len == UUP_BUF_SIZE) {
|
||||
if(!checksum_flag)
|
||||
test_checksum = xcrc32(uup_buf, UUP_BUF_SIZE, test_checksum);//计算校验和
|
||||
sfud_write(sflash, uup_burn_offset, UUP_BUF_SIZE, uup_buf);
|
||||
if(checksum_flag){
|
||||
if (uup_file_type == UART_FILE_AMT630H) {//代码文件
|
||||
unsigned int *tmp = (unsigned int *)(uup_buf + NEW_APPLDR_CHECKSUM_OFFSET);
|
||||
*tmp = 0;
|
||||
}else if (uup_file_type == UART_FILE_BOOTANIM) {//动画文件
|
||||
BANIHEADER *pheader = (BANIHEADER *)uup_buf;
|
||||
pheader->checksum = 0;
|
||||
}else if (uup_file_type == UART_FILE_ROM) {//资源文件
|
||||
RomHeader *pheader = (RomHeader *)uup_buf;
|
||||
pheader->checksum = 0;
|
||||
unsigned int *tmp = (unsigned int *)(uup_buf + 0x0F);
|
||||
}
|
||||
checksum_flag = 0;
|
||||
test_flag = 1;
|
||||
}
|
||||
|
||||
calc_checksum = xcrc32(uup_buf, UUP_BUF_SIZE, calc_checksum);//计算校验和
|
||||
if(test_flag){
|
||||
test_checksum = calc_checksum;
|
||||
printf("test_checksum == calc_checksum 0x%08X.\r\n",test_checksum);
|
||||
test_flag = 0;
|
||||
}
|
||||
if(calc_checksum != test_checksum){
|
||||
printf("error!!!test_checksum=0x%08X,calc_checksum=0x%08X.\r\n",test_checksum,calc_checksum);
|
||||
}
|
||||
uup_buf_len =0;
|
||||
uup_burn_offset += UUP_BUF_SIZE;
|
||||
//number++;
|
||||
//printf("number =%d,checksum = 0x%08X.\n",number,calc_checksum,checksum);
|
||||
}
|
||||
}else{
|
||||
memcpy(uup_buf + uup_buf_len, framebuf, uup_buf_len_detection);
|
||||
uup_buf_len += uup_buf_len_detection;
|
||||
// printf("2---------------- uup_buf_len = %d .\r\n",uup_buf_len);
|
||||
|
||||
if (uup_buf_len == UUP_BUF_SIZE) {
|
||||
if(!checksum_flag)
|
||||
test_checksum = xcrc32(uup_buf, UUP_BUF_SIZE, test_checksum);//计算校验和
|
||||
sfud_write(sflash, uup_burn_offset, UUP_BUF_SIZE, uup_buf);
|
||||
if(checksum_flag){
|
||||
if (uup_file_type == UART_FILE_AMT630H) {//代码文件
|
||||
unsigned int *tmp = (unsigned int *)(uup_buf + NEW_APPLDR_CHECKSUM_OFFSET);
|
||||
*tmp = 0;
|
||||
}else if (uup_file_type == UART_FILE_BOOTANIM) {//动画文件
|
||||
BANIHEADER *pheader = (BANIHEADER *)uup_buf;
|
||||
pheader->checksum = 0;
|
||||
}else if (uup_file_type == UART_FILE_ROM) {//资源文件
|
||||
RomHeader *pheader = (RomHeader *)uup_buf;
|
||||
pheader->checksum = 0;
|
||||
unsigned int *tmp = (unsigned int *)(uup_buf + 0x0F);
|
||||
}
|
||||
checksum_flag = 0;
|
||||
test_flag = 1;
|
||||
}
|
||||
|
||||
calc_checksum = xcrc32(uup_buf, UUP_BUF_SIZE, calc_checksum);//计算校验和
|
||||
if(test_flag){
|
||||
test_checksum = calc_checksum;
|
||||
printf("test_checksum == calc_checksum 0x%08X.\r\n",test_checksum);
|
||||
test_flag = 0;
|
||||
}
|
||||
if(calc_checksum != test_checksum){
|
||||
printf("error!!!test_checksum=0x%08X,calc_checksum=0x%08X.\r\n",test_checksum,calc_checksum);
|
||||
}
|
||||
uup_buf_len =0;
|
||||
uup_burn_offset += UUP_BUF_SIZE;
|
||||
// number++;
|
||||
// printf("number =%d,checksum = 0x%08X.\n",number,calc_checksum,checksum);
|
||||
}
|
||||
memcpy(uup_buf + uup_buf_len, framebuf, (framelen - uup_buf_len_detection));
|
||||
uup_buf_len += (framelen - uup_buf_len_detection);
|
||||
// printf("2----uup_buf_len = %d .\r\n",uup_buf_len);
|
||||
}
|
||||
// file_state = UART_FILE_FILEXFER;
|
||||
break;
|
||||
case UART_FILE_FINISH://传输完成
|
||||
if(uup_buf_len){//若最后一包数据不为0 则存数据并且继续计算校验和
|
||||
sfud_write(sflash, uup_burn_offset, uup_buf_len, uup_buf);
|
||||
test_checksum = xcrc32(uup_buf, uup_buf_len, test_checksum);//计算校验和
|
||||
calc_checksum = xcrc32(uup_buf, uup_buf_len, calc_checksum);
|
||||
printf("enter2 uup_buf_len =%d calc_checksum================0x%08X,test_checksum=0x%08X\n",uup_buf_len,calc_checksum,test_checksum);
|
||||
}
|
||||
printf("calc_checksum = 0x%08X,checksum = 0x%08X.\n",calc_checksum,checksum);
|
||||
printf("test_checksum=0x%08X.\r\n",test_checksum);
|
||||
if (calc_checksum != checksum) {
|
||||
printf("fail !!!!!!!!!!!!\n");
|
||||
}else
|
||||
printf("whole crc check after burn ok!\n");
|
||||
file_state = UART_FILE_NORMAL;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(file_state != UART_FILE_FILEXFER)
|
||||
printf("now > file_state = %d .\r\n",file_state);
|
||||
}
|
||||
|
||||
static int uup_rx_state = 0;
|
||||
#define UUP_PACKET_SIZE 128
|
||||
#define UUP_MAX_FRAME_LEN (UUP_PACKET_SIZE + 16)
|
||||
@ -438,7 +150,6 @@ static void wifi_update_judge(char *uartrx, size_t len){
|
||||
uup_rx_state++;
|
||||
wifi_ota_request[6] = Get_sys_softwar_host();
|
||||
}else{
|
||||
|
||||
uup_rx_state = 0;
|
||||
}
|
||||
break;
|
||||
@ -559,15 +270,9 @@ static void wifi_ota_update(char *framebuf, size_t len)
|
||||
wifi_update_judge(framebuf,len);//升级判断
|
||||
printf("wifi_file_state > %d.\r\n",wifi_file_state);
|
||||
break;
|
||||
// case UART_FILE_TYPE://检测传输文件类型
|
||||
// break;
|
||||
case UART_FILE_START://升级流程
|
||||
wifi_update_technological_process(framebuf,len);//升级流程
|
||||
break;
|
||||
// case UART_FILE_FILEXFER://传输过程中
|
||||
// break;
|
||||
// case UART_FILE_FINISH://传输完成
|
||||
// break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -659,13 +364,8 @@ void app_wifi_update_demo(void)
|
||||
printf("client is disconnected\r\n");
|
||||
continue;
|
||||
}
|
||||
// printf("recv len:%d.\r\n", ret);
|
||||
if(timeout)
|
||||
timeout = 0;
|
||||
// if(ret<100)
|
||||
// printf("recv len:%d %s\r\n", ret, buf);
|
||||
// else
|
||||
// printf("recv len:%d.\r\n", ret);
|
||||
wifi_ota_update(buf,ret);
|
||||
memset(buf, 0, sizeof(buf));
|
||||
}
|
||||
@ -680,11 +380,7 @@ exit:
|
||||
|
||||
static void wifi_update_rx_thread(void *param)
|
||||
{
|
||||
// vTaskDelay(7000);
|
||||
// while(1){
|
||||
app_wifi_update_demo();
|
||||
// vTaskDelay(3000);
|
||||
// }
|
||||
app_wifi_update_demo();
|
||||
}
|
||||
|
||||
int wifi_update_init(void){
|
||||
@ -698,120 +394,3 @@ int wifi_update_init(void){
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
int test_udp_client(const char *ip_str, int port)
|
||||
{
|
||||
/* socket文件描述符 */
|
||||
int sock_fd = -1;
|
||||
|
||||
/* 建立udp socket */
|
||||
sock_fd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if(sock_fd < 0)
|
||||
{
|
||||
printf("client socket create failed.\r\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* 设置address */
|
||||
struct sockaddr_in addr_serv;
|
||||
int len;
|
||||
memset(&addr_serv, 0, sizeof(addr_serv));
|
||||
addr_serv.sin_family = AF_INET;
|
||||
addr_serv.sin_addr.s_addr = inet_addr(ip_str);
|
||||
addr_serv.sin_port = htons(port);
|
||||
len = sizeof(addr_serv);
|
||||
|
||||
|
||||
int send_num;
|
||||
int recv_num;
|
||||
char send_buf[20] = "hey, who are you?";
|
||||
char recv_buf[20];
|
||||
|
||||
printf("###client send: %s\n", send_buf);
|
||||
|
||||
send_num = sendto(sock_fd, send_buf, strlen(send_buf), 0, (struct sockaddr *)&addr_serv, len);
|
||||
|
||||
if(send_num < 0)
|
||||
{
|
||||
printf("sendto erro\r\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
recv_num = recvfrom(sock_fd, recv_buf, sizeof(recv_buf), 0, (struct sockaddr *)&addr_serv, (socklen_t *)&len);
|
||||
|
||||
if(recv_num <= 0)
|
||||
{
|
||||
printf("socket recv failed\r\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
recv_buf[recv_num] = '\0';
|
||||
printf("client receive %d bytes: %s\n", recv_num, recv_buf);
|
||||
exit:
|
||||
|
||||
if (-1 != sock_fd)
|
||||
close(sock_fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int test_udp_server(int port)
|
||||
{
|
||||
int sock_fd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if(sock_fd < 0)
|
||||
{
|
||||
printf("server socket create failed.\r\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
struct sockaddr_in addr_serv;
|
||||
int len;
|
||||
memset(&addr_serv, 0, sizeof(struct sockaddr_in));
|
||||
addr_serv.sin_family = AF_INET;
|
||||
addr_serv.sin_port = htons(port);
|
||||
|
||||
addr_serv.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
len = sizeof(addr_serv);
|
||||
|
||||
if(bind(sock_fd, (struct sockaddr *)&addr_serv, sizeof(addr_serv)) < 0)
|
||||
{
|
||||
printf("bind error\r\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
int recv_num;
|
||||
int send_num;
|
||||
char send_buf[20] = "i am server!";
|
||||
char recv_buf[20];
|
||||
struct sockaddr_in addr_client;
|
||||
|
||||
while(1)
|
||||
{
|
||||
printf("server wait:\n");
|
||||
|
||||
recv_num = recvfrom(sock_fd, recv_buf, sizeof(recv_buf), 0, (struct sockaddr *)&addr_client, (socklen_t *)&len);
|
||||
|
||||
if(recv_num < 0)
|
||||
{
|
||||
printf("recvfrom error:\r\n");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
recv_buf[recv_num] = '\0';
|
||||
printf("server receive %d bytes: %s\n", recv_num, recv_buf);
|
||||
|
||||
send_num = sendto(sock_fd, send_buf, recv_num, 0, (struct sockaddr *)&addr_client, len);
|
||||
|
||||
if(send_num <= 0)
|
||||
{
|
||||
printf("sendto error:");
|
||||
break;
|
||||
}
|
||||
}
|
||||
exit:
|
||||
if (-1 != sock_fd)
|
||||
close(sock_fd);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -3,288 +3,259 @@
|
||||
|
||||
#include "ECTypes.h"
|
||||
|
||||
#define ECSDK_VERSION "1.0.10"
|
||||
#define ECSDK_VERSION "1.0.13.1"
|
||||
|
||||
typedef struct {
|
||||
|
||||
/**
|
||||
* @brief 互联连接状态回调函数
|
||||
* @param status 互联连接状态
|
||||
* @param type 互联连接类型
|
||||
* @note 此函数是非常重要的回调函数。它会返回整个互联的状态。
|
||||
* 有部分互联功能接口,比如:EC_startMirror()/EC_enableDownloadPhoneAppHud()/EC_enableDownloadPhoneAppHud() 等,
|
||||
* 都需要 status为 EC_CONNECT_STATUS_CONNECT_SUCCEED 时,调用才能生效。
|
||||
* 因为这些接口都是在互联成功之后(ECTiny与手机app建立了通讯),才能发指令给手机app,对应功能才能开启。
|
||||
*/
|
||||
void (*onECConnectStatus)(ECConnectedStatus status, ECConnectedType type);
|
||||
|
||||
void (*onMirrorStatus)(ECMirrorStatus status);
|
||||
/**
|
||||
* @brief Called when EasyConnected status changed.
|
||||
*
|
||||
* @param status The changed EasyConnected message.
|
||||
* @brief 投屏状态
|
||||
* @param status 互联投屏状态
|
||||
*/
|
||||
void (*onMirrorStatus)(ECMirrorStatus status);
|
||||
|
||||
/**
|
||||
* @brief 互联状态变更通知
|
||||
* @param status 变更的状态
|
||||
*/
|
||||
void (*onECStatusMessage)(ECStatusMessage status);
|
||||
|
||||
/**
|
||||
* @brief Called when the phone app sends down HUD information.
|
||||
*
|
||||
* @param data HUD information.
|
||||
* @brief 手机下发HUD信息时回调
|
||||
* @param data HUD信息
|
||||
*/
|
||||
void (*onPhoneAppHUD)(const ECNavigationHudInfo *data);
|
||||
|
||||
/**
|
||||
* @brief Called when the phone app sends down HUD Road Junction Picture.
|
||||
* @brief 手机下发道路引导图时回调
|
||||
* @param data
|
||||
*/
|
||||
void (*onPhoneAppHUDRoadJunctionPicture)(const ECHudRoadJunctionPictureInfo* data);
|
||||
|
||||
/*
|
||||
* @brief Called when phone app tell the music info.
|
||||
*
|
||||
* @param data The information of music.
|
||||
*/
|
||||
/**
|
||||
* @brief 手机音乐信息变化时回调
|
||||
* @param data
|
||||
*/
|
||||
void (*onPhoneAppMusicInfo)(const ECAppMusicInfo *data);
|
||||
|
||||
/**
|
||||
* @brief Called when the phone app sends down some information.
|
||||
*
|
||||
* @param data Buffer of app information.
|
||||
*
|
||||
* @param length Buffer length.
|
||||
*
|
||||
* @note data is json string, the fields includes os, osVersion and ip.
|
||||
* Called when ECSDK::openTransport succeed.
|
||||
* @brief 手机下发app信息时回调
|
||||
* @param data app信息
|
||||
* @param length app信息长度
|
||||
* @note data 是json字符串, 包括手机类型、系统版本、ip地址等。
|
||||
* ECTiny 与 手机app建立通讯后会回调此函数
|
||||
*/
|
||||
void (*onPhoneAppInfo)(const void *data, uint32_t length);
|
||||
|
||||
/**
|
||||
* @brief Called when ECSDK wants car to do call operations(dial or hang up) via Bluetooth.
|
||||
*
|
||||
* @param type Operation type.
|
||||
*
|
||||
* @param name The person's name of corresponding number.
|
||||
*
|
||||
* @param number Phone numbers.
|
||||
*
|
||||
* @note Phone app is not able to dial or hang up automatically due to the latest system access limitation,
|
||||
* however, car is able to do it via Bluetooth. Therefore, ECSDK moves the call operations
|
||||
* to car, which can dial or hang up when this method is called.
|
||||
* @brief 需要拨打或者挂断蓝牙电话时回调
|
||||
* @param type 操作类型
|
||||
* @param name 电话拨打的姓名
|
||||
* @param number 电话号码
|
||||
* @note 受限于Android/iOS系统的权限,在车机上点击互联投屏的过来的拨打电话,ECTiny无法完成电话的拨打和接听操作,因此需要依赖于车机系统的蓝牙模块完成。
|
||||
* 车机的投屏界面上点击拨打蓝牙电话时,此回调函数会把拨打的用户姓名和电话号码传到车机上,由车机蓝牙模块完成电话的拨打
|
||||
* 1.需要车机端作为蓝牙免提设备(Hand-Free-Device)。
|
||||
* 2.亿连的蓝牙电话功能,需要在车机和手机的HFP保持连接后,才可以正常启用。
|
||||
*/
|
||||
void (*onCallAction)(ECCallType type, const char *name, const char *number);
|
||||
|
||||
/**
|
||||
* @brief Called when bulk data is received.
|
||||
*
|
||||
* @brief 接收手机端发送的数据块
|
||||
* @param data Buffer of bulk data.
|
||||
*
|
||||
* @param length Buffer length.
|
||||
*
|
||||
*/
|
||||
void (*onBulkDataReceived)(const void *data, uint32_t length);
|
||||
|
||||
|
||||
/**
|
||||
* @brief onRealMirrorSizeChanged
|
||||
* @param realWidth
|
||||
* @param realHeight
|
||||
*
|
||||
* \note The actual size of the projection screen does not equal the size of the video stream in some cases.
|
||||
* The surrounding area is filled with black. This message calls back the actual size of the projection screen
|
||||
* @brief 投屏状态变更
|
||||
* @param ECVideoInfo 视屏参数
|
||||
* @note 投屏的实际宽高、横竖屏切换时回调此函数
|
||||
*/
|
||||
void (*onMirrorInfoChanged)(const ECVideoInfo *info);
|
||||
|
||||
/**
|
||||
* @brief Called when the license authorization failed. After this interface was called,
|
||||
* all connections would be forced closed.
|
||||
*
|
||||
* @param errCode Error code.
|
||||
*
|
||||
* @param errMsg Error message.
|
||||
* @brief 鉴权失败时回调此函数。ECTiny功能全部不可用
|
||||
* @param errCode 主要用于亿连后台进行排查的错误码,无需关心具体值。
|
||||
* @param errMsg 错误信息。
|
||||
* @note 此回调函数需要处理,当出现激活失败时给与提示。
|
||||
* 该回调一般出现在互联建立过程中,出现时ECTiny会在内部进行释放动作。
|
||||
* ECTiny使用者需要保证合法的激活校验流程,之后重新初始化ECSDK方可使用。
|
||||
*/
|
||||
void (*onLicenseAuthFail)(int32_t errCode, const char *errMsg);
|
||||
|
||||
/**
|
||||
* @brief Called when the license authorization succeed.
|
||||
*
|
||||
* @param code success code. The code can gain specific meaning by ECAuthSuccessCode.
|
||||
*
|
||||
* @param msg success information.
|
||||
*
|
||||
* @param msg the description information.
|
||||
*
|
||||
* @brief 鉴权成时回调此函数
|
||||
* @param code 正常错误码,无需关心具体值。
|
||||
* @param msg 正常激活log信息。
|
||||
* @note 该接口回调一般出现在互联建立过程中,在首次进行激活(手机IME号备案激活)时,回调会包含剩余数量等信息,SDK使用者可根据具体的使用场景进行相关展示。
|
||||
*/
|
||||
void (*onLicenseAuthSuccess)(int32_t code, const char *msg);
|
||||
|
||||
/**
|
||||
* @brief Called when registered command was triggered by VR.
|
||||
*
|
||||
* @param carCmd The triggered command.
|
||||
*
|
||||
* @note Voice control can be implemented with this method by VR.
|
||||
*
|
||||
* @see ECSDK::registerCarCmds
|
||||
* @brief 当注册的控车指令被vr激活时回调
|
||||
* @param carCmd 触发的控车指令
|
||||
* @see EC_registerCarCmds()
|
||||
*/
|
||||
void (*onCarCmdNotified)(const ECCarCmd *carCmd);
|
||||
|
||||
/**
|
||||
* @brief Called when phone app request the HU to start input.
|
||||
*
|
||||
* @param info relevant parameters about the input.
|
||||
* @brief 监听手机端文字输入
|
||||
* @param info 当前需要输入的文字信息,包括输入类型(文字、数字、电话号码等),最大输入长度,默认的文字,最大行数,以及Enter键默认的显示效果及动作。
|
||||
* @note 监听手机端输入法的开始输入状态,并传递此次输入文字的相关信息。
|
||||
*/
|
||||
void (*onInputStart)(const ECInputInfo *info);
|
||||
|
||||
/**
|
||||
* @brief Called when phone app request the HU to cancel input.
|
||||
* @note 监听手机端输入法的结束或者取消的状态,此时车机端键盘也需要取消。
|
||||
*/
|
||||
void (*onInputCancel)();
|
||||
|
||||
/**
|
||||
* @brief Called when phone app tell the selection of input.
|
||||
* @brief 监听手机端输入光标位置、选择状态信息
|
||||
* @param start 光标开始的位置
|
||||
* @param stop 光标结束的位置
|
||||
* @note 监听手机端输入文字的选择状态,光标状态,车机端并做状态展示。仅对安卓手机有效,苹果手机互联无此回调。
|
||||
*/
|
||||
void (*onInputSelection)(int32_t start, int32_t stop);
|
||||
|
||||
/**
|
||||
* @brief Called when phone app tell the text of input.
|
||||
* @brief 同步当前手机端的文字信息到车机
|
||||
* @param text 当前手机端输入的文字信息。
|
||||
* @note 如在手机端也对输入框内的文字进行输入,需要同步至车机端,保持车机端和手机端的状态同步。
|
||||
*/
|
||||
void (*onInputText)(const char *text);
|
||||
|
||||
/**
|
||||
* @brief Called when phone app send the text of VR or TTS.
|
||||
* @brief 对识别内容进行展示
|
||||
* @param info 手机端语音引擎识别后的文字内容信息。
|
||||
*/
|
||||
void (*onVRTextReceived)(const ECVRTextInfo *info);
|
||||
|
||||
/**
|
||||
* @brief Called when phone app tell the page list.
|
||||
*
|
||||
* @param pages Array of the struct ECPageInfo.
|
||||
*
|
||||
* @param length The length of the array.
|
||||
* @brief 获取快捷方式列表信息
|
||||
* @param pages 返回快捷方式的数组,参考 ECTypes.h 的 ECPageInfo 定义,主要包含图标的编号、名称、icon的唯一标识信息;
|
||||
* @param length pages数组长度;
|
||||
* @note ECPageInfo::page 字段标识了每一个快捷方式的唯一标识,通过该标识,可以实现两个主要的功能:
|
||||
* 1. 通过page编号,可以通过调用 ECSDK::queryPageIcon 获取快捷方式的图标资源。
|
||||
* 2. 通过page编号,可以通过调用 ECSDK::openAppPage 实现快捷打开对应指定手机APP页面
|
||||
*/
|
||||
void (*onPageListReceived)(const ECPageInfo *pages, int32_t length);
|
||||
|
||||
/**
|
||||
* @brief Called when phone app tell the icons.
|
||||
*
|
||||
* @param icons Array of the struct ECIconInfo.
|
||||
*
|
||||
* @param length The length of the array.
|
||||
* @brief 手机app回调图标信息
|
||||
* @param icons 返回快捷方式图标资源的数组,参考 ECTypes.h 的 ECIconInfo 定义,主要包含icon的编号、icon的格式、icon图像数据、icon的数据长度;
|
||||
* @param length icons的数组长度。
|
||||
*/
|
||||
void (*onPageIconReceived)(const ECIconInfo *icons, int32_t length);
|
||||
|
||||
/**
|
||||
* @brief Called when phone app tell weather.
|
||||
*
|
||||
* @param data Buffer of weather information.
|
||||
*
|
||||
* @param length Buffer length.
|
||||
*
|
||||
* @note data pointed to a json string buffer.
|
||||
* @brief 回调天气信息
|
||||
* @param data 天气信息字符串
|
||||
* @param length 字符串长度
|
||||
* @note data 是一个固定格式的json字符串
|
||||
*/
|
||||
void (*onWeatherReceived)(const char *data, int32_t length);
|
||||
|
||||
/**
|
||||
* @brief Called when phone app tell vr tips.
|
||||
*
|
||||
* @param data Buffer of tips information.
|
||||
*
|
||||
* @param length Buffer length.
|
||||
*
|
||||
* @note data pointed to a json string buffer.
|
||||
* @brief 请求VR提醒文字
|
||||
* @param data VR文字
|
||||
* @param length data长度
|
||||
* @note data是一个json字符串
|
||||
* 在使用车机端本地语音助手时,一般需要有一些常驻提示类的使用帮助,这些文字主要通过手机端传输至车机端,由车机端系统完成展示。
|
||||
*/
|
||||
void (*onVRTipsReceived)(const char *data, int32_t length);
|
||||
|
||||
/**
|
||||
* @brief Called when the app requests networking
|
||||
*
|
||||
* @param clientInfo Mobile phone related information
|
||||
*
|
||||
* @note
|
||||
* @brief 手机app发送到车机的请求组网
|
||||
* @param clientInfo 手机app的相关信息
|
||||
* @note 此回调用于BLE组网
|
||||
*/
|
||||
void (*onRequestBuildNet)(const ECBTClientInfo *clientInfo);
|
||||
|
||||
/**
|
||||
* @brief Called when canceling networking
|
||||
*
|
||||
* @note
|
||||
* @brief 手机app取消组网时回调
|
||||
* @note 此回调用于BLE组网
|
||||
*/
|
||||
void (*onRequestBuildNetCancel)();
|
||||
|
||||
/**
|
||||
* @brief Called when networking is completed
|
||||
*
|
||||
* @note
|
||||
* @brief 手机app组网完成时回调
|
||||
* @note 此回调用于BLE组网
|
||||
*/
|
||||
void (*onPhoneBuildNetFinish)();
|
||||
void (*onPhoneBuildNetFinish)(const char* ip);
|
||||
|
||||
/**
|
||||
* @brief Called when app sends AP information
|
||||
*
|
||||
* @param netDeviceInfo AP information
|
||||
*
|
||||
* @note
|
||||
* @brief 手机app通知车机,手机创建的ap信息
|
||||
* @param netDeviceInfo AP信息
|
||||
* @note 此回调用于BLE组网
|
||||
*/
|
||||
void (*onPhoneAPInfo)(const ECBTNetInfo* netDeviceInfo);
|
||||
|
||||
/**
|
||||
* @brief Called when mobile phone has a notification message.
|
||||
* @param notification
|
||||
* @brief 收到手机消息通知时回调
|
||||
* @param notification 消息通知
|
||||
* @note 允许下发手机消息通知功能开启后,当收到短信、微信等消息时,此函数会回调消息到车机
|
||||
* @see EC_requestPhoneNotification()
|
||||
*/
|
||||
void (*onPhoneNotification)(const ECPhoneNotification* notification);
|
||||
|
||||
/**
|
||||
* @brief Called when the phone app sends down HUD lane guidance Picture.
|
||||
* @param notification
|
||||
* @brief HUD道路引导图
|
||||
* @param notification 引导图信息
|
||||
* @note 下发HUD导航功能开启后,导航时,有道路引导图时,此函数会回调
|
||||
* @see EC_enableDownloadPhoneAppHud()
|
||||
*/
|
||||
void (*onPhoneAppHUDLaneGuidancePicture)(const ECHudLaneGuidancePictureInfo * data);
|
||||
|
||||
/**
|
||||
* @brief Called when checkOTAUpdate was called, it will tell the result of checkOTAUpdate.
|
||||
*
|
||||
* @param downloadableSoftwares It pointer to a array of ECOTAUpdateSoftware, which is downloadable software.
|
||||
*
|
||||
* @param downloadableLength The length of the downloadable array, if downloadableLength < 0, means check occur error, downloadableLength is error value of ECOTAUpdateErrorCode.
|
||||
*
|
||||
* @param downloadedSoftwares It pointer to a array of ECOTAUpdateSoftware, which is downloaded software.
|
||||
*
|
||||
* @param downloadedLength The length of the downloaded array.
|
||||
* @brief 检测更新函数 EC_checkOTAUpdate()调用后, 此回调函数返回结果
|
||||
* @param downloadableSoftwares 可下载的软件包数组
|
||||
* @param downloadableLength 可下载的软件包数组大小, 如果 downloadableLength < 0 标识出现错误, 错误码参考:ECOTAUpdateErrorCode.
|
||||
* @param downloadedSoftwares 已下载的软件包数组
|
||||
* @param downloadedLength 已下载的软件包数组大小
|
||||
*/
|
||||
void (*onOTAUpdateCheckResult)(const ECOTAUpdateSoftware* downloadableSoftwares, const int32_t downloadableLength, const ECOTAUpdateSoftware* downloadedSoftwares, const uint32_t downloadedLength);
|
||||
|
||||
/**
|
||||
* @brief Called when remote downloadable software has been downloaded to phone.
|
||||
*
|
||||
* @param downloadableSoftwares It pointer to a array of ECOTAUpdateSoftware, which has been in phone, can be downloaded from phone to HU.
|
||||
*
|
||||
* @param downloadableLength The length of the downloadable array.
|
||||
* @brief 有软件包请求下载手机时回调
|
||||
* @param downloadableSoftwares 可下载的软件包数组
|
||||
* @param downloadableLength 可下载软件包数组大小
|
||||
* @note 软件包已存在手机,请求下载到车机
|
||||
*/
|
||||
void (*onOTAUpdateRequestDownload)(const ECOTAUpdateSoftware* downloadableSoftwares, const uint32_t downloadableLength);
|
||||
|
||||
/**
|
||||
* @brief Called when startOTAUpdate is called, it will notify the progress of downloading.
|
||||
*
|
||||
* @param downloadingSoftwareId The id of the downloading software.
|
||||
*
|
||||
* @param progress The progress of the downloading software,which is a percentage.
|
||||
*
|
||||
* @param softwareLeftTime The left time of the downloading software.
|
||||
*
|
||||
* @param otaLeftTime The left time of all the specified software by startOTAUpdate.
|
||||
* @brief EC_startOTAUpdate()调用之后, 此回调函数会回调下载进度
|
||||
* @param downloadingSoftwareId 下载的软件ID
|
||||
* @param progress 下载的进度
|
||||
* @param softwareLeftTime 剩余下载时间
|
||||
* @param otaLeftTime OTA剩余时间
|
||||
*/
|
||||
void (*onOTAUpdateProgress)(const char* downloadingSoftwareId, float progress, uint32_t softwareLeftTime, uint32_t otaLeftTime);
|
||||
|
||||
/**
|
||||
* @brief Called when startOTAUpdate is called, it will notify software is downloaded.
|
||||
*
|
||||
* @param downloadedSoftwareId The id of the downloaded software.
|
||||
*
|
||||
* @param md5Path The md5 file path.
|
||||
*
|
||||
* @param packagePath The software path.
|
||||
*
|
||||
* @param iconPath The icon path.
|
||||
*
|
||||
* @param leftSoftwareNum The amount of software remaining to be downloaded.
|
||||
* @brief EC_startOTAUpdate()调用之后, 下载完成时回调此函数
|
||||
* @param downloadedSoftwareId 下载的软件ID
|
||||
* @param md5Path md5文件路径
|
||||
* @param packagePath 升级包路径
|
||||
* @param iconPath 图标路径
|
||||
* @param leftSoftwareNum 剩余下载数量
|
||||
*/
|
||||
void (*onOTAUpdateCompleted)(const char* downloadedSoftwareId, const char* md5Path, const char* packagePath, const char* iconPath, uint32_t leftSoftwareNum);
|
||||
|
||||
/**
|
||||
* @brief Called when checkOTAUpdate or startOTAUpdate failed.
|
||||
*
|
||||
* @param errCode error code, see ECOTAUpdateErrorCode.
|
||||
*
|
||||
* @param softwarId the id of software.
|
||||
* @brief EC_checkOTAUpdate() 或者 EC_startOTAUpdate() 调用过程出错回调此函数
|
||||
* @param errCode 错误码, 参考:ECOTAUpdateErrorCode.
|
||||
* @param softwarId 软件id
|
||||
*/
|
||||
void (*onOTAUpdateError)(int32_t errCode, const char* softwareId);
|
||||
|
||||
@ -815,7 +786,7 @@ const char* EC_generateQRCodeUrl(ECQRInfo* info);
|
||||
* @param enable 0:禁止; 1:允许
|
||||
* @return EC_OK 为成功,其余值为失败。
|
||||
*/
|
||||
int32_t EC_requestPhoneNotification(int32_t enable);
|
||||
int32_t EC_requestPhoneNotification(uint32_t enable);
|
||||
|
||||
/**
|
||||
* @brief 检测OTA升级
|
||||
|
@ -194,6 +194,18 @@ enum ECProjectFlavor
|
||||
};
|
||||
typedef enum ECProjectFlavor ECProjectFlavor;
|
||||
|
||||
/**
|
||||
* @enum ECAuthCheckMode
|
||||
*
|
||||
*/
|
||||
enum ECAuthCheckMode {
|
||||
EC_AUTH_CHECK_DEFAULT = 0, ///< default check auth on phone
|
||||
EC_AUTH_CHECK_ON_CAR_NETWORK = 1, ///< check auth on car network
|
||||
EC_AUTH_CHECK_SCAN_CODE_TO_ACTIVATE_FOR_SUDING = 2, ///< scan the code to activate the certificate for suding
|
||||
EC_AUTH_CHECK_SCAN_CODE_TO_ACTIVATE = 4, ///< scan the code to activate the certificate
|
||||
};
|
||||
typedef enum ECAuthCheckMode ECAuthCheckMode;
|
||||
|
||||
/**
|
||||
* @struct ECAuthentication
|
||||
*
|
||||
@ -205,7 +217,7 @@ struct ECAuthentication
|
||||
char pwd[1024]; ///< the specific password for authentication powered by Carbit.
|
||||
char versionName[1024]; ///< the version name of EasyConn.
|
||||
uint32_t versionCode; ///< the version code of EasyConn.
|
||||
uint32_t autoAuthViaCar; ///< specify whether make automatic authentication via car's network.
|
||||
uint32_t authCheckMode; ///< the value of auth check model refer to ECAuthCheckMode.
|
||||
ECProjectFlavor flavor; ///< specify the HU Project market for sale,SDK will carry a flavor by default.see enum ECProjectFlavor in ECTypes.h
|
||||
char reserve[256]; ///< reserve
|
||||
};
|
||||
@ -373,11 +385,22 @@ struct ECOptions
|
||||
ECMirrorMode mirrorMode; ///< tell the app of connected phone which mirror mode would be used.
|
||||
uint32_t bluetoothPolicy; ///< the policy of A2DP message phone sent to the car.
|
||||
uint32_t disableShowCallInfo; ///< true:Don't show call info
|
||||
uint32_t disablePageInRVMap; ///< Block display of some page
|
||||
uint32_t socketTimeoutPeriod; ///< socket timeout period in seconds
|
||||
char reserve[256]; ///< reserve
|
||||
};
|
||||
typedef struct ECOptions ECOptions;
|
||||
|
||||
/**
|
||||
* @enum ECDisablePageInRVMap
|
||||
*
|
||||
*/
|
||||
enum ECDisablePageInRVMap {
|
||||
EC_DISABLE_PAGEINRVMAP_CALLPHONE = 0x0001, ///< Block call display
|
||||
EC_DISABLE_PAGEINRVMAP_MUSIC = 0x0002, ///< Block music display
|
||||
EC_DISABLE_PAGEINRVMAP_MESSAGE = 0x0004, ///< Block message display
|
||||
};
|
||||
|
||||
/**
|
||||
* @enum ECTransportType
|
||||
*
|
||||
|
@ -13,8 +13,6 @@
|
||||
#include "carlink_common.h"
|
||||
#include "carlink_video.h"
|
||||
|
||||
//不支持ble组网
|
||||
|
||||
#if CARLINK_EC
|
||||
#include "ECTiny.h"
|
||||
#include "ECTypes.h"
|
||||
@ -36,6 +34,9 @@ static ECQRInfo qr_info;
|
||||
extern int wps_connect_done;
|
||||
static bool g_ec_disable = false;
|
||||
|
||||
struct ICalinkEventCallbacks gCarlinkECEventCB;
|
||||
|
||||
|
||||
#if ENABLE_EC_DASHCAM
|
||||
int start_http_camera();
|
||||
void stop_http_camera();
|
||||
@ -191,7 +192,7 @@ void onRequestBuildNetCancel()
|
||||
}
|
||||
|
||||
|
||||
void onPhoneBuildNetFinish()
|
||||
void onPhoneBuildNetFinish(char const *str)
|
||||
{
|
||||
|
||||
}
|
||||
@ -544,10 +545,10 @@ void testThread()
|
||||
{
|
||||
int ret = carlink_common_init();
|
||||
ret = carlink_bt_wifi_init();
|
||||
struct ICalinkEventCallbacks carlinkEventCB = {0};
|
||||
carlinkEventCB.onEvent = onEventEC;
|
||||
carlinkEventCB.rfcomm_data_read = ec_ble_data_read;
|
||||
carlink_register_event_callbacks(&carlinkEventCB);
|
||||
|
||||
gCarlinkECEventCB.onEvent = onEventEC;
|
||||
gCarlinkECEventCB.rfcomm_data_read = ec_ble_data_read;
|
||||
carlink_register_event_callbacks(&gCarlinkECEventCB);
|
||||
initECTiny(NULL);
|
||||
}
|
||||
|
||||
|
@ -343,3 +343,5 @@ int ark_network_init()
|
||||
|
||||
return (int)ret;
|
||||
}
|
||||
|
||||
|
||||
|
@ -582,15 +582,12 @@ eDHCPCallbackAnswer_t xApplicationDHCPHook( eDHCPCallbackPhase_t eDHCPPhase,
|
||||
|
||||
static BaseType_t carlink_wifi_init()
|
||||
{
|
||||
static int wifi_sdio_status = MMCSD_HOST_UNPLUGED;
|
||||
|
||||
if (wifi_sdio_status == MMCSD_HOST_PLUGED)
|
||||
return 0;
|
||||
int status;
|
||||
WIFI_Context_init();
|
||||
WIFI_RegisterEvent(eWiFiEventMax, carlink_wifi_event_handler);
|
||||
for (;;) {
|
||||
wifi_sdio_status = mmcsd_wait_sdio_ready((int32_t)portMAX_DELAY);
|
||||
if (wifi_sdio_status == MMCSD_HOST_PLUGED) {
|
||||
status = mmcsd_wait_sdio_ready((int32_t)portMAX_DELAY);
|
||||
if (status == MMCSD_HOST_PLUGED) {
|
||||
printf("detect sdio device\r\n");
|
||||
break;
|
||||
}
|
||||
@ -616,14 +613,8 @@ static void bt_set_support_carplay_android_auto()//auto + cp
|
||||
console_send_atcmd(cmd_str, strlen(cmd_str));
|
||||
}
|
||||
|
||||
static void taskInitCarlinkWlanThread(void* param)
|
||||
{
|
||||
carlink_start_wlan();
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
int carlink_bt_wifi_init()
|
||||
{
|
||||
int retry_count = 0;
|
||||
pthread_mutex_lock(&btwifiLocker);
|
||||
if (g_bt_wifi_init_flag) {
|
||||
pthread_mutex_unlock(&btwifiLocker);
|
||||
@ -636,24 +627,14 @@ int carlink_bt_wifi_init()
|
||||
//bt_set_support_carplay();
|
||||
bt_set_support_carplay_android_auto();
|
||||
carlink_bt_open_nolock();
|
||||
lwip_tcpip_init_done_flag = 0;
|
||||
xTaskCreate(taskInitCarlinkWlanThread, "initThread", 2048 * 4, NULL, 1, NULL);
|
||||
|
||||
while(lwip_tcpip_init_done_flag == 0) {
|
||||
if (retry_count++ > 50)
|
||||
break;
|
||||
vTaskDelay(pdMS_TO_TICKS(300));
|
||||
}
|
||||
|
||||
if (lwip_tcpip_init_done_flag) {
|
||||
g_bt_wifi_init_flag = 1;
|
||||
printf("bt wlan init ok\r\n");
|
||||
} else {
|
||||
g_bt_wifi_init_flag = 0;
|
||||
printf("bt wlan init failed\r\n");
|
||||
}
|
||||
carlink_start_wlan();
|
||||
g_bt_wifi_init_flag = 1;
|
||||
pthread_mutex_unlock(&btwifiLocker);
|
||||
printf("bt wlan init is ok\r\n");
|
||||
|
||||
// app_wifi_update_demo();
|
||||
wifi_update_init();
|
||||
printf("app wlan update init ok\r\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ void carlink_register_event_callbacks(const struct ICalinkEventCallbacks *pcb)
|
||||
|
||||
int carlink_common_init()
|
||||
{
|
||||
//FF_Disk_t *sfdisk = NULL;
|
||||
FF_Disk_t *sfdisk = NULL;
|
||||
BaseType_t ret = -1;
|
||||
|
||||
pthread_mutex_lock(&carlink_com_locker);
|
||||
@ -120,14 +120,14 @@ int carlink_common_init()
|
||||
}
|
||||
|
||||
pthread_key_system_init();
|
||||
#if 0
|
||||
|
||||
sfdisk = FF_SFDiskInit("/sf");
|
||||
if (!sfdisk) {
|
||||
printf("FF_SFDiskInit fail.\r\n");
|
||||
//return;
|
||||
}
|
||||
#endif
|
||||
ret = xTaskCreate(carlink_event_proc, "cl_ev_proc", 2048, NULL, configMAX_PRIORITIES - 1, NULL);
|
||||
|
||||
ret = xTaskCreate(carlink_event_proc, "cl_ev_proc", 2048, NULL, configMAX_PRIORITIES / 5, NULL);
|
||||
g_comm_init_flag = 1;
|
||||
|
||||
exit:
|
||||
|
@ -31,11 +31,6 @@ void set_carlink_display_info(int x, int y, int w, int h);//set carlink show are
|
||||
void set_carlink_display_state(int on); // on: 1.display carlink; 0. display native ui
|
||||
void set_carlink_active_video_info(int x, int y);//for android auto
|
||||
|
||||
|
||||
void* h264_video_player_init();
|
||||
void h264_video_player_uninit(void* h264_Handle);
|
||||
int h264_video_player_proc(void* h264_Handle, const char *h264_buf, int h264_buf_len);
|
||||
|
||||
#define WRITE_BE32(ptr, val) \
|
||||
do { \
|
||||
uint8_t* __ptr = (uint8_t*)(ptr); \
|
||||
|
@ -726,6 +726,8 @@ extern int get_usb_mode();
|
||||
extern int ark_network_init(void);
|
||||
#endif
|
||||
|
||||
extern void Moto_speed_timer(void);
|
||||
|
||||
void awtk_thread(void *data)
|
||||
{
|
||||
printf("awtk thread start.\n");
|
||||
@ -774,10 +776,9 @@ void awtk_thread(void *data)
|
||||
#endif
|
||||
|
||||
/* uart rx demo */
|
||||
printf("MXC_A58 > UART3 OPEN.\r\n");
|
||||
uart_communicates_with_bt();
|
||||
printf("MXC_A58 > UART2 OPEN.\r\n");
|
||||
uart_rx_demo();
|
||||
|
||||
// uart_rx_demo();
|
||||
|
||||
|
||||
/* can demo */
|
||||
@ -827,8 +828,8 @@ void awtk_thread(void *data)
|
||||
carlink_ey_init();
|
||||
#endif
|
||||
#if CARLINK_EC
|
||||
set_carlink_display_info(0, 0, LCD_WIDTH, LCD_HEIGHT);
|
||||
set_carlink_video_info(LCD_WIDTH, LCD_HEIGHT, 30);
|
||||
set_carlink_display_info(0, 0, LCD_WIDTH, LCD_HEIGHT-100);
|
||||
set_carlink_video_info(LCD_WIDTH, LCD_HEIGHT-100, 30);
|
||||
carlink_ec_init(0, NULL);
|
||||
#endif
|
||||
|
||||
@ -861,6 +862,8 @@ void awtk_thread(void *data)
|
||||
// static float cell_value = 0;
|
||||
// static uint8_t cell_count = 0;
|
||||
|
||||
Moto_speed_timer();
|
||||
|
||||
while(1) {
|
||||
|
||||
#ifdef TASK_STATUS_MONITOR
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "awtk.h"
|
||||
#include "can_protocol.h"
|
||||
#include "moto_config.h"
|
||||
|
||||
uint8_t tcs_twinkle = 0;
|
||||
uint8_t tcs_switch = 0;
|
||||
@ -22,33 +23,6 @@ void tcsswitch_event_handing(int *buf){
|
||||
if(tcs_data<=1)
|
||||
tcs_switch = tcs_data;
|
||||
}
|
||||
//101
|
||||
void speed_event_handing(int *buf){
|
||||
uint16_t eng_temp = 0;
|
||||
uint16_t data = 0;
|
||||
uint8_t state_data = 0;
|
||||
double buf_value = 0;
|
||||
*(buf++);
|
||||
*(buf++);
|
||||
*(buf++);
|
||||
*(buf++);
|
||||
|
||||
data = *(buf++) &0xFF;
|
||||
data = (*(buf++)&0xFF) | data<<8;
|
||||
|
||||
buf_value = data;
|
||||
if(buf_value>5280)
|
||||
buf_value = 255;
|
||||
else if(buf_value>2730)
|
||||
buf_value = ((buf_value*0.1)-273);
|
||||
else
|
||||
buf_value = 0;
|
||||
eng_temp = (int)buf_value;
|
||||
Set_sys_can_temp(eng_temp);
|
||||
state_data = *(buf++);
|
||||
Set_sys_can_state(state_data);
|
||||
|
||||
}
|
||||
|
||||
//0xA5
|
||||
void abs_dtc_event_handing(int *buf){
|
||||
@ -71,57 +45,3 @@ void ecu_dtc_event_handing2(int *buf){
|
||||
dtc[0] = *(buf++)&0xFF;
|
||||
Set_can_abs_dtc(dtc);
|
||||
}
|
||||
|
||||
uint8_t dtc_flag = 0;
|
||||
void A59_dtc_event_handing(int *buf){
|
||||
uint32_t sum,sum1,sum2;
|
||||
sum = 0;
|
||||
sum1 = *(buf++)&0xFF;
|
||||
*(buf++)&0xFF;
|
||||
sum2 = *(buf++)&0xFF;
|
||||
////低位再前
|
||||
//sum = sum1 | sum2<<8;
|
||||
//高位再前
|
||||
sum = sum1<<8 | sum2;
|
||||
// if (sum !=0)
|
||||
Set_sys_now_defect_code(sum);
|
||||
|
||||
dtc_flag = *(buf++)&0xFF;
|
||||
|
||||
sum = 0;
|
||||
sum1 = *(buf++)&0xFF;
|
||||
*(buf++)&0xFF;
|
||||
sum2 = *(buf++)&0xFF;
|
||||
sum = sum1<<8 | sum2;
|
||||
// if (sum !=0)
|
||||
Set_sys_his_defect_code(sum);
|
||||
|
||||
}
|
||||
|
||||
//101
|
||||
void A59_speed_event_handing(int *buf){
|
||||
uint16_t eng_temp = 0;
|
||||
uint16_t data = 0;
|
||||
uint8_t state_data = 0;
|
||||
double buf_value = 0;
|
||||
*(buf++);
|
||||
*(buf++);
|
||||
*(buf++);
|
||||
*(buf++);
|
||||
|
||||
data = *(buf++) &0xFF;
|
||||
data = (*(buf++)&0xFF) | data<<8;
|
||||
|
||||
buf_value = data;
|
||||
if(buf_value>5280)
|
||||
buf_value = 255;
|
||||
else if(buf_value>2730)
|
||||
buf_value = ((buf_value*0.1)-273);
|
||||
else
|
||||
buf_value = 0;
|
||||
eng_temp = (int)buf_value;
|
||||
Set_sys_can_temp(eng_temp);
|
||||
state_data = *(buf++);
|
||||
Set_sys_can_state(state_data);
|
||||
|
||||
}
|
||||
|
@ -142,4 +142,23 @@ void Moto_gpio_timer(void) {
|
||||
}
|
||||
|
||||
}
|
||||
TimerHandle_t xspeedTimer;
|
||||
|
||||
void vTimerSpeedback(TimerHandle_t xTimer) {
|
||||
speed_convert_mile_calculation();
|
||||
}
|
||||
|
||||
void Moto_speed_timer(void){
|
||||
xspeedTimer = xTimerCreate("MyspeeSTimer", // 定时器名称
|
||||
pdMS_TO_TICKS(100), // 定时器周期(1000毫秒)
|
||||
pdTRUE, // 自动重载定时器
|
||||
(void *)0, // 定时器 ID
|
||||
vTimerSpeedback); // 回调函数
|
||||
|
||||
// 启动定时器
|
||||
if (xTimerStart(xspeedTimer, 0) != pdPASS) {
|
||||
// 启动定时器失败的处理
|
||||
printf("xTimer error!!!!!!!!!!!!!!!!!.\r\n");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -68,10 +68,10 @@ void check_key(void)
|
||||
gs_keyDat[i].flag_Reset=1;
|
||||
gs_keyDat[i].keyCnt=0;
|
||||
// printf("LV_KEY_OPTION key long key\r\n");
|
||||
if(Get_sys_wifi_state()){
|
||||
printf("key carplay -----------------maps.\r\n");
|
||||
request_UI("maps:");
|
||||
}else
|
||||
// if(Get_sys_wifi_state()){
|
||||
// printf("key carplay -----------------maps.\r\n");
|
||||
// request_UI("maps:");
|
||||
// }else
|
||||
Key_Distinction(KEY_LONG_ON,LV_KEY_OPTION);
|
||||
}
|
||||
if(i==1 && gs_keyDat[0].flag_Pressed==KEY_OFF)
|
||||
@ -79,11 +79,11 @@ void check_key(void)
|
||||
gs_keyDat[i].flag_Reset=1;
|
||||
gs_keyDat[i].keyCnt=0;
|
||||
// printf("LV_KEY_SELECT key long key\r\n");
|
||||
if(Get_sys_wifi_state()){
|
||||
printf("key carplay -----------------enter.\r\n");
|
||||
// KnobUpdate(1,0,0,0,0,0);
|
||||
sendKnobInfo(1, 0, 0, 0, 0, 0);
|
||||
}else
|
||||
// if(Get_sys_wifi_state()){
|
||||
// printf("key carplay -----------------enter.\r\n");
|
||||
// // KnobUpdate(1,0,0,0,0,0);
|
||||
// sendKnobInfo(1, 0, 0, 0, 0, 0);
|
||||
// }else
|
||||
Key_Distinction(KEY_LONG_ON,LV_KEY_SELECT);
|
||||
}
|
||||
|
||||
@ -109,11 +109,11 @@ void check_key(void)
|
||||
// // android_auto_send_knob_event(19,1);
|
||||
// // android_auto_send_knob_event(19,0);
|
||||
// }else
|
||||
if(Get_sys_wifi_state()){
|
||||
printf("key carplay -----------------previos.\r\n");
|
||||
// KnobUpdate(0,0,0,0,0,1);
|
||||
sendKnobInfo(0, 0, 0, 0, 0, 1);
|
||||
}else
|
||||
// if(Get_sys_wifi_state()){
|
||||
// printf("key carplay -----------------previos.\r\n");
|
||||
// // KnobUpdate(0,0,0,0,0,1);
|
||||
// sendKnobInfo(0, 0, 0, 0, 0, 1);
|
||||
// }else
|
||||
Key_Distinction(KEY_SHORT_ON,LV_KEY_OPTION);
|
||||
}
|
||||
else if(i==1 && gs_keyDat[0].flag_Pressed==KEY_OFF)
|
||||
@ -132,11 +132,11 @@ void check_key(void)
|
||||
// // android_auto_send_knob_event(20,1);
|
||||
// // android_auto_send_knob_event(20,0);
|
||||
// }else
|
||||
if(Get_sys_wifi_state()){
|
||||
printf("key carplay -----------------next.\r\n");
|
||||
// KnobUpdate(0,0,0,0,0,-1);
|
||||
sendKnobInfo(0, 0, 0, 0, 0, -1);
|
||||
}else
|
||||
// if(Get_sys_wifi_state()){
|
||||
// printf("key carplay -----------------next.\r\n");
|
||||
// // KnobUpdate(0,0,0,0,0,-1);
|
||||
// sendKnobInfo(0, 0, 0, 0, 0, -1);
|
||||
// }else
|
||||
Key_Distinction(KEY_SHORT_ON,LV_KEY_SELECT);
|
||||
}
|
||||
}
|
||||
|
@ -448,11 +448,11 @@ int flash_copy_demo(void)
|
||||
printf("start copy flash ok.\n");
|
||||
for(i=0;i<new_appsize/IMAGE_RW_SIZE;i++)
|
||||
{
|
||||
printf("i = %d start read .\r\n",i);
|
||||
// printf("i = %d start read .\r\n",i);
|
||||
sfud_read(sflash, new_appoffset+IMAGE_RW_SIZE*i, IMAGE_RW_SIZE, buf);
|
||||
printf("start erase write .\r\n");
|
||||
// printf("start erase write .\r\n");
|
||||
sfud_erase_write(sflash, imageoff+IMAGE_RW_SIZE*i, IMAGE_RW_SIZE, buf);
|
||||
printf("start erase write ok.\r\n");
|
||||
// printf("start erase write ok.\r\n");
|
||||
Set_sys_pace(i+1);
|
||||
if(i==0)
|
||||
{
|
||||
|
@ -9,13 +9,15 @@
|
||||
#include "board.h"
|
||||
#include "keypad.h"
|
||||
#include "moto_adc.h"
|
||||
#include "moto_config.h"
|
||||
|
||||
|
||||
extern double total_mile;
|
||||
uint8_t data_error_flag = 0;
|
||||
extern uint8_t wifi_time_flag;
|
||||
|
||||
uint32_t flash_trip_mile = 0;
|
||||
uint32_t flash_total_mile = 0;
|
||||
|
||||
#define KEY_DATA_PRESS 0x01 // 短按
|
||||
#define KEY_DATA_LONG_PRESS 0x02 // 长按
|
||||
enum
|
||||
@ -62,6 +64,11 @@ uint8_t getBit4Value(uint8_t count, int bitPosition) {
|
||||
return (count >> bitPosition) & 0xf;
|
||||
}
|
||||
|
||||
// 封装的函数,获取5个bit组合成的值
|
||||
uint8_t getBit5Value(uint8_t count, int bitPosition) {
|
||||
return (count >> bitPosition) & 0x1f;
|
||||
}
|
||||
|
||||
double adc_voltage_calculation(void){
|
||||
double value = 0;
|
||||
|
||||
@ -77,7 +84,7 @@ double adc_voltage_calculation(void){
|
||||
|
||||
//MOTO通讯 设备信息+时间戳解析协议
|
||||
void device_data_analysis(uint8_t *buf){
|
||||
// printf("device information............................................\r\n");
|
||||
printf("device information............................................\r\n");
|
||||
uint8_t data;
|
||||
uint8_t sum1,sum2,sum3,sum4;
|
||||
uint32_t save_total_mile,save_trip_mile;
|
||||
@ -87,12 +94,12 @@ void device_data_analysis(uint8_t *buf){
|
||||
char produce[5] = {0};
|
||||
char mac[6] = {0};
|
||||
data = *(buf++);
|
||||
if(data!=0xAA)
|
||||
return;
|
||||
// if(data!=0xAA)
|
||||
// return;
|
||||
|
||||
data = *(buf++);
|
||||
if(data!=0x55)
|
||||
return;
|
||||
// if(data!=0x55)
|
||||
// return;
|
||||
|
||||
//设备相关信息
|
||||
data = *(buf++);//0x01
|
||||
@ -269,6 +276,9 @@ void device_data_analysis(uint8_t *buf){
|
||||
int test_light = 0;
|
||||
//MOTO通讯协议
|
||||
void data_analysis(uint8_t *buf){
|
||||
#if (MOTO_WARE_HOSE == MOTO_TEST_DEMO)
|
||||
return;
|
||||
#endif
|
||||
// printf("data_analysis-------------.\r\n");
|
||||
uint32_t data;
|
||||
uint32_t sum,sum1,sum2,sum3,sum4;
|
||||
|
@ -0,0 +1,115 @@
|
||||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: Google
|
||||
AccessModifierOffset: -1
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: false
|
||||
AllowShortIfStatementsOnASingleLine: true
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 100
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IncludeCategories:
|
||||
- Regex: '^<ext/.*\.h>'
|
||||
Priority: 2
|
||||
- Regex: '^<.*\.h>'
|
||||
Priority: 1
|
||||
- Regex: '^<.*'
|
||||
Priority: 2
|
||||
- Regex: '.*'
|
||||
Priority: 3
|
||||
IncludeIsMainRegex: '([-_](test|unittest))?$'
|
||||
IndentCaseLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 2
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: false
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 1
|
||||
PenaltyBreakComment: 600
|
||||
PenaltyBreakFirstLessLess: 100
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 200
|
||||
PointerAlignment: Left
|
||||
RawStringFormats:
|
||||
- Language: TextProto
|
||||
BasedOnStyle: google
|
||||
ReflowComments: false
|
||||
SortIncludes: false
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 2
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Auto
|
||||
TabWidth: 2
|
||||
UseTab: Never
|
||||
...
|
||||
|
33
MXC_A27-PCB4.5-270T/lib/awtk/awtk-examples/MOTO_A270S/3rd/awtk-widget-number-label/.gitignore
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
*.swp
|
||||
*.pdb
|
||||
*.ilk
|
||||
*.idb
|
||||
*.obj
|
||||
*.exe
|
||||
*.pyc
|
||||
/bin
|
||||
/lib
|
||||
.sconsign.dblite
|
||||
lua/demo1
|
||||
lua/lftk_run
|
||||
tags
|
||||
bin/demo1*
|
||||
bin/demo_animator*
|
||||
bin/demo_thread*
|
||||
bin/demotr*
|
||||
bin/demovg*
|
||||
bin/fontgen*
|
||||
bin/preview_ui*
|
||||
bin/resgen*
|
||||
bin/runLua*
|
||||
bin/runTest*
|
||||
bin/strgen*
|
||||
bin/image*
|
||||
bin/hello*
|
||||
.vscode
|
||||
.vs
|
||||
*.os
|
||||
res
|
@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random
|
||||
Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
@ -0,0 +1,99 @@
|
||||
# awtk-widget-number-label
|
||||
|
||||
number_label 控件。用于显示数值的文本控件。
|
||||
|
||||

|
||||
|
||||
## 准备
|
||||
|
||||
1. 获取 awtk 并编译
|
||||
|
||||
```
|
||||
git clone https://github.com/zlgopen/awtk.git
|
||||
cd awtk; scons; cd -
|
||||
```
|
||||
|
||||
2. 获取 awtk-widget-number-label
|
||||
|
||||
```
|
||||
git clone https://github.com/zlgopen/awtk-widget-number-label.git
|
||||
cd awtk-widget-number-label
|
||||
```
|
||||
|
||||
## 运行
|
||||
|
||||
1. 生成示例代码的资源
|
||||
|
||||
```
|
||||
python scripts/update_res.py all
|
||||
```
|
||||
> 也可以使用 Designer 打开项目,之后点击 “打包” 按钮进行生成;
|
||||
> 如果资源发生修改,则需要重新生成资源。
|
||||
|
||||
如果 PIL 没有安装,执行上述脚本可能会出现如下错误:
|
||||
```cmd
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
ModuleNotFoundError: No module named 'PIL'
|
||||
```
|
||||
请用 pip 安装:
|
||||
```cmd
|
||||
pip install Pillow
|
||||
```
|
||||
|
||||
2. 编译
|
||||
|
||||
* 编译 PC 版本
|
||||
|
||||
```
|
||||
scons
|
||||
```
|
||||
|
||||
* 编译 LINUX FB 版本
|
||||
|
||||
```
|
||||
scons LINUX_FB=true
|
||||
```
|
||||
|
||||
> 完整编译选项请参考 [编译选项](https://github.com/zlgopen/awtk-widget-generator/blob/master/docs/build_options.md)
|
||||
|
||||
3. 运行
|
||||
|
||||
```
|
||||
./bin/demo
|
||||
```
|
||||
|
||||
## 如何使用 number-label 控件
|
||||
|
||||
在 xml 文件中创建 number-label 控件
|
||||
|
||||
```xml
|
||||
<number_label name="number_label" x="c" y="m" w="100" h="50" value="200.2" format="%.2lf" decimal_font_size_scale="0.5"/>
|
||||
```
|
||||
|
||||
number_label 各属性的功能如下表所示:
|
||||
|
||||
| 属性名 | 作用 |
|
||||
| ----------------------- | -------------------------------------------- |
|
||||
| value | 数值 |
|
||||
| format | 格式化显示的值 |
|
||||
| decimal_font_size_scale | 小数部分字体大小与整数部分字体大小之比 |
|
||||
| min | 最小值 |
|
||||
| max | 最大值 |
|
||||
| step | 步长,用于上下键修改时,一次增加或减少的数值 |
|
||||
| loop | 用上下键修改时,值是否循环 |
|
||||
| readonly | 编辑器是否只读 |
|
||||
|
||||
如果需要修改字体大小或颜色,可以通过修改 `font_size` 和 `text_color` 样式来修改。
|
||||
|
||||
**注意事项**
|
||||
|
||||
当 readonly 属性不为 true 时,可以用方向键修改控件的值。如果同时使用方向键切换焦点,会存在焦点进入本控件后无法出来的问题。为了避免这个问题,可以采用以下几种措施之一:
|
||||
|
||||
* readonly 设置为 true
|
||||
* 把按键事件重新映射。请参考 [键值映射](https://github.com/zlgopen/awtk/blob/master/docs/map_key.md)。
|
||||
* 使用极简键盘。请参考 [支持极简键盘](https://github.com/zlgopen/awtk/blob/master/docs/how_to_support_5keys_3keys.md)。
|
||||
|
||||
## 文档
|
||||
|
||||
[完善自定义控件](https://github.com/zlgopen/awtk-widget-generator/blob/master/docs/improve_generated_widget.md)
|
@ -0,0 +1,8 @@
|
||||
import os
|
||||
import scripts.app_helper as app
|
||||
|
||||
helper = app.Helper(ARGUMENTS)
|
||||
helper.set_dll_def('src/number_label.def').set_libs(['number_label']).call(DefaultEnvironment)
|
||||
|
||||
SConscriptFiles = ['src/SConscript']
|
||||
helper.SConscript(SConscriptFiles)
|
@ -0,0 +1,460 @@
|
||||
<window>
|
||||
<style name="default">
|
||||
<normal bg_color="#ffffff"/>
|
||||
</style>
|
||||
</window>
|
||||
|
||||
<dialog>
|
||||
<style name="default" border_color="#c2c2c2">
|
||||
<normal bg_color="#ffffff"/>
|
||||
</style>
|
||||
</dialog>
|
||||
|
||||
<popup>
|
||||
<style name="default" border_color="#c2c2c2">
|
||||
<normal bg_color="#ffffff"/>
|
||||
</style>
|
||||
</popup>
|
||||
|
||||
<overlay>
|
||||
<style name="default" border_color="#c2c2c2">
|
||||
<normal bg_color="#ffffff"/>
|
||||
</style>
|
||||
</overlay>
|
||||
|
||||
<system_bar>
|
||||
<style name="default" border="bottom" border_color="#c2c2c2">
|
||||
<normal bg_color="#ffffff"/>
|
||||
</style>
|
||||
</system_bar>
|
||||
|
||||
<system_bar_bottom>
|
||||
<style name="default" border="top" border_color="#c2c2c2">
|
||||
<normal bg_color="#ffffff"/>
|
||||
</style>
|
||||
</system_bar_bottom>
|
||||
|
||||
<keyboard>
|
||||
<style name="default" border_color="#c2c2c2">
|
||||
<normal bg_color="#e1e1e1"/>
|
||||
</style>
|
||||
</keyboard>
|
||||
|
||||
<button>
|
||||
<style name="default" round_radius="4">
|
||||
<normal text_color="#444444" bg_color="#f4f4f4" border_color="#c2c2c2"/>
|
||||
<pressed text_color="#ffffff" bg_color="#1971dd" border_color="#1971dd"/>
|
||||
<over text_color="#ffffff" bg_color="#338fff" border_color="#338fff"/>
|
||||
<focused text_color="#444444" bg_color="#f4f4f4" border_color="#338fff" />
|
||||
<disable text_color="#44444466" bg_color="#f4f4f466" border_color="#c2c2c266" />
|
||||
</style>
|
||||
|
||||
<style name="combobox_down" border_color="#c2c2c2" bg_color="#f2f2f2">
|
||||
<normal icon="arrow_down_n"/>
|
||||
<pressed icon="arrow_down_p"/>
|
||||
<over icon="arrow_down_o"/>
|
||||
<disable icon="arrow_down_d" border_color="#c2c2c266" bg_color="#f2f2f266"/>
|
||||
</style>
|
||||
|
||||
<style name="spinbox_down" border_color="#c2c2c2" bg_color="#f2f2f2">
|
||||
<normal icon="arrow_down_n"/>
|
||||
<pressed icon="arrow_down_p"/>
|
||||
<over icon="arrow_down_o"/>
|
||||
<disable icon="arrow_down_d" border_color="#c2c2c266" bg_color="#f2f2f266"/>
|
||||
</style>
|
||||
|
||||
<style name="spinbox_up" border_color="#c2c2c2" bg_color="#f2f2f2">
|
||||
<normal icon="arrow_up_n"/>
|
||||
<pressed icon="arrow_up_p"/>
|
||||
<over icon="arrow_up_o"/>
|
||||
<disable icon="arrow_up_d" border_color="#c2c2c266" bg_color="#f2f2f266"/>
|
||||
</style>
|
||||
|
||||
<style name="spinbox_left" border_color="#c2c2c2" bg_color="#f2f2f2">
|
||||
<normal icon="arrow_left_n"/>
|
||||
<pressed icon="arrow_left_p"/>
|
||||
<over icon="arrow_left_o"/>
|
||||
<disable icon="arrow_left_d" border_color="#c2c2c266" bg_color="#f2f2f266"/>
|
||||
</style>
|
||||
|
||||
<style name="spinbox_right" border_color="#c2c2c2" bg_color="#f2f2f2">
|
||||
<normal icon="arrow_right_n"/>
|
||||
<pressed icon="arrow_right_p"/>
|
||||
<over icon="arrow_right_o"/>
|
||||
<disable icon="arrow_right_d" border_color="#c2c2c266" bg_color="#f2f2f266"/>
|
||||
</style>
|
||||
|
||||
<style name="scroll_down" bg_color="#f2f2f2">
|
||||
<normal icon="arrow_down_n"/>
|
||||
<pressed icon="arrow_down_p"/>
|
||||
<over icon="arrow_down_o"/>
|
||||
<disable icon="arrow_down_d" border_color="#c2c2c266" bg_color="#f2f2f266"/>
|
||||
</style>
|
||||
|
||||
<style name="scroll_up" bg_color="#f2f2f2">
|
||||
<normal icon="arrow_up_n"/>
|
||||
<pressed icon="arrow_up_p"/>
|
||||
<over icon="arrow_up_o"/>
|
||||
<disable icon="arrow_up_d" bg_color="#f2f2f266"/>
|
||||
</style>
|
||||
|
||||
<style name="scroll_left" bg_color="#f2f2f2">
|
||||
<normal icon="arrow_left_n"/>
|
||||
<pressed icon="arrow_left_p"/>
|
||||
<over icon="arrow_left_o"/>
|
||||
<disable icon="arrow_left_d" bg_color="#f2f2f266"/>
|
||||
</style>
|
||||
|
||||
<style name="scroll_right" bg_color="#f2f2f2">
|
||||
<normal icon="arrow_right_n"/>
|
||||
<pressed icon="arrow_right_p"/>
|
||||
<over icon="arrow_right_o"/>
|
||||
<disable icon="arrow_right_d" bg_color="#f2f2f266"/>
|
||||
</style>
|
||||
|
||||
</button>
|
||||
|
||||
<edit selected_text_color="#010101" selected_bg_color="#b5d7fd">
|
||||
<style name="default" bg_color="#f7f7f7" text_color="#444444" text_align_h="left">
|
||||
<normal border_color="#c2c2c2"/>
|
||||
<focused border_color="#338fff"/>
|
||||
<disable bg_color="#f7f7f766" border_color="#c2c2c266" text_color="#44444466" />
|
||||
<error border_color="#ff0000" />
|
||||
<empty border_color="#c2c2c2" text_color="#959494"/>
|
||||
<empty_focus border_color="#c2c2c2" text_color="#959494"/>
|
||||
<over border_color="#338fff"/>
|
||||
</style>
|
||||
</edit>
|
||||
|
||||
|
||||
<spin_box selected_text_color="#010101" selected_bg_color="#b5d7fd">
|
||||
<style name="default" bg_color="#f7f7f7" text_color="#444444" text_align_h="left">
|
||||
<normal border_color="#c2c2c2"/>
|
||||
<focused border_color="#338fff"/>
|
||||
<disable bg_color="#f7f7f766" border_color="#c2c2c266" text_color="#44444466"/>
|
||||
<error border_color="#ff0000"/>
|
||||
<empty border_color="#c2c2c2" text_color="#959494"/>
|
||||
<empty_focus border_color="#c2c2c2" text_color="#959494"/>
|
||||
<over border_color="#338fff"/>
|
||||
<has_value has_value="1"/>
|
||||
</style>
|
||||
</spin_box>
|
||||
|
||||
<digit_clock>
|
||||
<style name="default">
|
||||
<normal text_color="#444444" />
|
||||
</style>
|
||||
</digit_clock>
|
||||
|
||||
<label>
|
||||
<style name="default">
|
||||
<normal text_color="#444444"/>
|
||||
<disable text_color="#44444466"/>
|
||||
</style>
|
||||
</label>
|
||||
|
||||
<progress_bar>
|
||||
<style name="default" round_radius="5">
|
||||
<normal text_color="#444444" bg_color="#d8d8d8" fg_color="#338fff" border_color="#d8d8d8"/>
|
||||
<disable text_color="#44444466" bg_color="#d8d8d866" fg_color="#338fff66" border_color="#d8d8d866"/>
|
||||
</style>
|
||||
</progress_bar>
|
||||
|
||||
<slider>
|
||||
<style name="default" round_radius="5">
|
||||
<normal bg_color="#d8d8d8" fg_color="#338fff" border_color="#bfbfbf"/>
|
||||
<pressed bg_color="#d8d8d8" fg_color="#338fff" border_color="#1456d6"/>
|
||||
<over bg_color="#d8d8d8" fg_color="#338fff" border_color="#54d8ff"/>
|
||||
<focused bg_color="#d8d8d8" fg_color="#338fff" border_color="#54d8ff"/>
|
||||
<disable bg_color="#d8d8d866" fg_color="#338fff66" border_color="#ececec"/>
|
||||
</style>
|
||||
</slider>
|
||||
|
||||
<check_button>
|
||||
<style name="default" icon_at="left" text_color="#444444">
|
||||
<normal icon="check_unchecked" />
|
||||
<pressed icon="check_unchecked" />
|
||||
<over icon="check_unchecked" />
|
||||
<focused icon="check_unchecked" />
|
||||
<disable icon="check_unchecked_d" text_color="#44444466"/>
|
||||
<normal_of_checked icon="check_checked" />
|
||||
<pressed_of_checked icon="check_checked" />
|
||||
<over_of_checked icon="check_checked" />
|
||||
<focused_of_checked icon="check_checked" />
|
||||
<disable_of_checked icon="check_checked_d" text_color="#44444466"/>
|
||||
</style>
|
||||
</check_button>
|
||||
|
||||
<radio_button>
|
||||
<style name="default" text_color="#444444" icon_at="left">
|
||||
<normal icon="radio_unchecked" />
|
||||
<pressed icon="radio_unchecked" />
|
||||
<over icon="radio_unchecked" />
|
||||
<focused icon="radio_unchecked" />
|
||||
<disable icon="radio_unchecked_d" text_color="#44444466"/>
|
||||
<normal_of_checked icon="radio_checked"/>
|
||||
<pressed_of_checked icon="radio_checked"/>
|
||||
<over_of_checked icon="radio_checked"/>
|
||||
<focused_of_checked icon="radio_checked" />
|
||||
<disable_of_checked icon="radio_checked_d" text_color="#44444466"/>
|
||||
</style>
|
||||
</radio_button>
|
||||
|
||||
<image>
|
||||
<style name="default" text_color="#444444">
|
||||
<normal />
|
||||
</style>
|
||||
</image>
|
||||
|
||||
<scroll_bar_m>
|
||||
<style name="default">
|
||||
<normal fg_color="#808080"/>
|
||||
<disable fg_color="#80808066"/>
|
||||
</style>
|
||||
</scroll_bar_m>
|
||||
|
||||
<scroll_bar_d>
|
||||
<style name="default" border_color="#bebebe">
|
||||
<normal bg_color="#f0f0f0"/>
|
||||
<over bg_color="#f0f0f0" />
|
||||
<pressed bg_color="#f0f0f0" />
|
||||
<disable bg_color="#f0f0f066" border_color="#bebebe66"/>
|
||||
</style>
|
||||
</scroll_bar_d>
|
||||
|
||||
<dragger>
|
||||
<style name="default" bg_color="#9e9e9e">
|
||||
<normal />
|
||||
<pressed />
|
||||
<over />
|
||||
</style>
|
||||
<style name="scroll_bar">
|
||||
<normal bg_color="#d0d0d0" />
|
||||
<pressed bg_color="#c0c0c0" />
|
||||
<over bg_color="#c0c0c0" />
|
||||
<disable bg_color="#c0c0c066" />
|
||||
</style>
|
||||
</dragger>
|
||||
|
||||
<list_item>
|
||||
<style name="default" border_color="#e9e9e9" text_color="#444444">
|
||||
<normal bg_color="#ffffff" />
|
||||
<pressed bg_color="#338fff" text_color="#ffffff" />
|
||||
<over bg_color="#ffffff" border_color="#338fff"/>
|
||||
<disable border_color="#e9e9e966" text_color="#44444466"/>
|
||||
</style>
|
||||
</list_item>
|
||||
|
||||
<tab_button>
|
||||
<style name="default" border_color="#c2c2c2" text_color="#444444">
|
||||
<normal bg_color="#f4f4f4" />
|
||||
<pressed bg_color="#cecdcd" />
|
||||
<over bg_color="#ffffff" text_color="#1971dd"/>
|
||||
<normal_of_active bg_color="#ffffff" border="top|left|right"/>
|
||||
<pressed_of_active bg_color="#ffffff" text_color="#1971dd" border="top|left|right"/>
|
||||
<over_of_active bg_color="#ffffff" text_color="#1971dd" border="top|left|right"/>
|
||||
<disable_of_active border_color="#c2c2c266" bg_color="#f4f4f466" text_color="#44444466" border="top|left|right"/>
|
||||
<disable border_color="#c2c2c266" bg_color="#f4f4f466" text_color="#44444466"/>
|
||||
</style>
|
||||
</tab_button>
|
||||
|
||||
<tab_button_group >
|
||||
<style name="default">
|
||||
<normal/>
|
||||
</style>
|
||||
|
||||
<style name="scrollable" border_color="#a0a0a0" border="left|right">
|
||||
<normal/>
|
||||
</style>
|
||||
</tab_button_group>
|
||||
|
||||
|
||||
<combo_box selected_text_color="#010101" selected_bg_color="#b5d7fd">
|
||||
<style name="default" bg_color="#f7f7f7" text_color="#444444" text_align_h="left" border_color="#c2c2c2">
|
||||
<normal border_color="#c2c2c2"/>
|
||||
<focused border_color="#338fff"/>
|
||||
<disable bg_color="#f7f7f766" border_color="#c2c2c266" text_color="#44444466"/>
|
||||
<error border_color="#ff0000"/>
|
||||
<empty border_color="#c2c2c2" text_color="#959494"/>
|
||||
<empty_focus border_color="#c2c2c2" text_color="#959494"/>
|
||||
<over border_color="#338fff"/>
|
||||
</style>
|
||||
</combo_box>
|
||||
|
||||
|
||||
<combo_box_ex selected_text_color="#010101" selected_bg_color="#b5d7fd">
|
||||
<style name="default" bg_color="#f7f7f7" text_color="#444444" text_align_h="left" border_color="#c2c2c2">
|
||||
<normal border_color="#c2c2c2"/>
|
||||
<focused border_color="#338fff"/>
|
||||
<disable bg_color="#f7f7f766" border_color="#c2c2c266" text_color="#44444466"/>
|
||||
<error border_color="#ff0000"/>
|
||||
<empty border_color="#c2c2c2" text_color="#959494"/>
|
||||
<empty_focus border_color="#c2c2c2" text_color="#959494"/>
|
||||
<over border_color="#338fff"/>
|
||||
</style>
|
||||
</combo_box_ex>
|
||||
|
||||
<combo_box_item>
|
||||
<style name="default" icon_at="left" text_color="#444444" bg_color="#ffffff">
|
||||
<normal />
|
||||
<pressed bg_color="#338fff" text_color="#ffffff" />
|
||||
<over bg_color="#1971dd" text_color="#ffffff" />
|
||||
<focused bg_color="#1296db" text_color="#ffffff" />
|
||||
<normal_of_checked bg_color="#338fff" text_color="#ffffff"/>
|
||||
<focused_of_checked bg_color="#338fff" text_color="#ffffff"/>
|
||||
<pressed_of_checked bg_color="#338fff" text_color="#ffffff" />
|
||||
<over_of_checked bg_color="#1971dd" text_color="#ffffff" />
|
||||
<disable_of_checked bg_color="#f4f4f466" text_color="#44444466" />
|
||||
<disable bg_color="#f4f4f466" text_color="#44444466"/>
|
||||
</style>
|
||||
</combo_box_item>
|
||||
|
||||
<text_selector>
|
||||
<style name="default" fg_color="#c2c2c2" text_color="#444444" text_align_h="center" bg_color="#ffffff">
|
||||
<normal mask_color="#404040" border_color="#c2c2c2"/>
|
||||
<disable mask_color="#c0c0c0" border_color="#c2c2c266" text_color="#44444466" />
|
||||
</style>
|
||||
</text_selector>
|
||||
|
||||
<switch>
|
||||
<style name="default" margin="2" round_radius="11" fg_color="#ffffff">
|
||||
<normal bg_color="#828282" selected_bg_color="#338fff"/>
|
||||
<disable bg_color="#82828266" selected_bg_color="#338fff66"/>
|
||||
</style>
|
||||
</switch>
|
||||
|
||||
<slide_indicator>
|
||||
<style name="default">
|
||||
<normal fg_color="#338fff40" selected_fg_color="#338fff"/>
|
||||
<disable fg_color="#338fff20" selected_fg_color="#338fff66"/>
|
||||
</style>
|
||||
</slide_indicator>
|
||||
|
||||
<slide_indicator_arc>
|
||||
<style name="default">
|
||||
<normal fg_color="#338fff40" selected_fg_color="#338fff"/>
|
||||
<disable fg_color="#338fff20" selected_fg_color="#338fff66"/>
|
||||
</style>
|
||||
</slide_indicator_arc>
|
||||
|
||||
|
||||
<progress_circle>
|
||||
<style name="default">
|
||||
<normal text_color="#444444" fg_color="#338fff"/>
|
||||
<disable text_color="#44444466" fg_color="#338fff66"/>
|
||||
</style>
|
||||
</progress_circle>
|
||||
|
||||
<svg>
|
||||
<style name="default" text_color="#444444">
|
||||
<normal/>
|
||||
</style>
|
||||
</svg>
|
||||
|
||||
<gif>
|
||||
<style name="default">
|
||||
<normal/>
|
||||
</style>
|
||||
</gif>
|
||||
|
||||
<slide_menu>
|
||||
<style name="default">
|
||||
<normal/>
|
||||
</style>
|
||||
</slide_menu>
|
||||
|
||||
<mledit selected_fg_color="#020202" selected_text_color="#010101" selected_bg_color="#b5d7fd">
|
||||
<style name="default" border_color="#a0a0a0" text_color="#444444" text_align_h="left">
|
||||
<normal bg_color="#ffffff" />
|
||||
<focused bg_color="#ffffff"/>
|
||||
<disable bg_color="gray" text_color="#44444466" />
|
||||
<error bg_color="#ffffff" text_color="red" />
|
||||
<empty bg_color="#ffffff" text_color="#a0a0a0" />
|
||||
<empty_focus bg_color="#ffffff" text_color="#a0a0a0"/>
|
||||
</style>
|
||||
</mledit>
|
||||
|
||||
<line_number>
|
||||
<style name="default" text_align_h="center">
|
||||
<normal text_color="#444444" bg_color="#d0d0d0"/>
|
||||
<disable text_color="#44444466" bg_color="#d0d0d066"/>
|
||||
</style>
|
||||
</line_number>
|
||||
|
||||
<hscroll_label>
|
||||
<style name="default" text_color="#444444">
|
||||
<normal />
|
||||
<disable text_color="#44444466"/>
|
||||
</style>
|
||||
</hscroll_label>
|
||||
|
||||
<color_tile>
|
||||
<style name="default">
|
||||
<normal border_color="#c2c2c2"/>
|
||||
<focused border_color="#338fff"/>
|
||||
<disable border_color="#c2c2c266"/>
|
||||
</style>
|
||||
</color_tile>
|
||||
|
||||
<view>
|
||||
<style name="default">
|
||||
<normal />
|
||||
</style>
|
||||
</view>
|
||||
|
||||
<tab_control>
|
||||
<style name="default">
|
||||
<normal />
|
||||
</style>
|
||||
</tab_control>
|
||||
|
||||
<scroll_view>
|
||||
<style name="default">
|
||||
<normal />
|
||||
</style>
|
||||
</scroll_view>
|
||||
|
||||
<list_view>
|
||||
<style name="default" border_color="#c2c2c2" bg_color="#f4f4f4">
|
||||
<normal />
|
||||
<disable border_color="#c2c2c266" bg_color="#f4f4f466"/>
|
||||
</style>
|
||||
</list_view>
|
||||
|
||||
<list_view_h>
|
||||
<style name="default" border_color="#c2c2c2" bg_color="#f4f4f4">
|
||||
<normal />
|
||||
<disable border_color="#c2c2c266" bg_color="#f4f4f466"/>
|
||||
</style>
|
||||
</list_view_h>
|
||||
|
||||
<pages>
|
||||
<style name="default" border_color="#c2c2c2">
|
||||
<normal />
|
||||
</style>
|
||||
</pages>
|
||||
|
||||
<slide_view>
|
||||
<style name="default">
|
||||
<normal />
|
||||
</style>
|
||||
</slide_view>
|
||||
|
||||
<color_picker>
|
||||
<style name="default">
|
||||
<normal />
|
||||
</style>
|
||||
</color_picker>
|
||||
|
||||
<color_component>
|
||||
<style name="default" border_color="#c2c2c2">
|
||||
<normal />
|
||||
</style>
|
||||
</color_component>
|
||||
|
||||
<candidates>
|
||||
<style name="default" text_color="#444444" bg_color="#fafafa">
|
||||
<normal />
|
||||
</style>
|
||||
</candidates>
|
||||
|
@ -0,0 +1,14 @@
|
||||
<number_label>
|
||||
<style name="default" font_size="32">
|
||||
<normal text_color="black" />
|
||||
</style>
|
||||
|
||||
<style name="green" font_name="led" font_size="32">
|
||||
<normal text_color="green" />
|
||||
</style>
|
||||
|
||||
<style name="grab_focus" font_size="32">
|
||||
<normal text_color="black" />
|
||||
<focused text_color="black" border_color="green"/>
|
||||
</style>
|
||||
</number_label>
|
@ -0,0 +1,20 @@
|
||||
<window theme="main" move_focus_prev_key="up" move_focus_next_key="down">
|
||||
<view x="c" y="m" w="100%" h="100%" children_layout="default(h=40,c=2,s=10,m=10)">
|
||||
<number_label name="num1" format="%d" value="100"/>
|
||||
<number_label name="num2" format="%d" value="200"/>
|
||||
<number_label name="num3" format="%.1lf" value="100.20"/>
|
||||
<number_label name="num4" format="%.2lf" value="100.20"/>
|
||||
<number_label name="num5" format="%.3lf" value="200.20"/>
|
||||
<number_label name="num6" format="%.4lf" value="300.33" style="green"/>
|
||||
|
||||
<label text="Focusable:" />
|
||||
<number_label name="num7" style="grab_focus" format="%d"
|
||||
focusable="true" value="100"/>
|
||||
|
||||
<label text="Focusable:" />
|
||||
<number_label name="num8" style="grab_focus" format="%.1lf" loop="true"
|
||||
focusable="true" value="5" min="0" max="10" step="0.1"/>
|
||||
|
||||
<button name="close" text="Close" floating="true" x="c" y="b:10" w="128" h="30" />
|
||||
</view>
|
||||
</window>
|
@ -0,0 +1,57 @@
|
||||
# AWTK 如何集成第三方库
|
||||
|
||||
AWTK 集成第三方库非常简单,这里以集成 sqlite3 介绍一下具体方法。
|
||||
|
||||
## 一、编译第三方库
|
||||
|
||||
* 优先使用第三方库自己的构建方法。
|
||||
|
||||
* 如果第三方使用autoconf等方法构建,在Windows平台上就会遇到问题。此时可以使用scons重写构建脚本。
|
||||
|
||||
比如:
|
||||
|
||||
> 以下是给sqlite3写的scons构建脚本。
|
||||
|
||||
```
|
||||
import os
|
||||
import platform
|
||||
|
||||
env=DefaultEnvironment().Clone()
|
||||
LIB_DIR=os.environ['LIB_DIR'];
|
||||
BIN_DIR=os.environ['BIN_DIR'];
|
||||
|
||||
env.Library(os.path.join(LIB_DIR, 'sqlite3'), Glob("sqlite3.c"))
|
||||
env.Program(os.path.join(BIN_DIR, 'sqlite3'), Glob("shell.c"))
|
||||
```
|
||||
|
||||
> 请参考 awtk-hello 中的 [3rd/sqlite3/SConscript](https://github.com/zlgopen/awtk-hello/blob/master/3rd/sqlite3/SConscript)
|
||||
|
||||
## 二、在SConstruct中引入第三方库
|
||||
|
||||
* 在 APP_LIBPATH 变量中加入库的路径
|
||||
* 在 APP_LIBS 变量中加入库的名称。
|
||||
* 在 APP_CPPPATH 变量中加头文件路径。
|
||||
|
||||
比如:
|
||||
|
||||
|
||||
```
|
||||
APP_CCFLAGS = ''
|
||||
APP_LINKFLAGS=''
|
||||
APP_LIBPATH = [APP_LIB_DIR]
|
||||
APP_LIBS = ['assets', 'sqlite3']
|
||||
APP_CPPPATH=[os.path.join(APP_ROOT, '3rd/sqlite3')]
|
||||
|
||||
DefaultEnvironment(
|
||||
LINKFLAGS = APP_LINKFLAGS + awtk.LINKFLAGS,
|
||||
CPPPATH = APP_CPPPATH + awtk.CPPPATH,
|
||||
LIBS = APP_LIBS + awtk.LIBS,
|
||||
LIBPATH = APP_LIBPATH + awtk.LIBPATH,
|
||||
CCFLAGS = APP_CCFLAGS + awtk.CCFLAGS,
|
||||
OS_SUBSYSTEM_CONSOLE=awtk.OS_SUBSYSTEM_CONSOLE,
|
||||
OS_SUBSYSTEM_WINDOWS=awtk.OS_SUBSYSTEM_WINDOWS)
|
||||
|
||||
```
|
||||
|
||||
> 请参考 awtk-hello 中的 [SConstruct](https://github.com/zlgopen/awtk-hello/blob/master/SConstruct)
|
||||
|
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 50 KiB |
@ -0,0 +1,6 @@
|
||||
find src -name \*.c -exec clang-format -i {} \;
|
||||
find src -name \*.h -exec clang-format -i {} \;
|
||||
find src -name \*.cc -exec clang-format -i {} \;
|
||||
find src -name \*.cpp -exec clang-format -i {} \;
|
||||
find src -name \*.inc -exec clang-format -i {} \;
|
||||
|
@ -0,0 +1,3 @@
|
||||
|
||||
node ../awtk/tools/idl_gen/index.js idl/idl.json src/
|
||||
node ../awtk/tools/dll_def_gen/index.js idl/idl.json src/number_label.def
|
@ -0,0 +1,360 @@
|
||||
[
|
||||
{
|
||||
"params": [],
|
||||
"annotation": {
|
||||
"global": true
|
||||
},
|
||||
"desc": "注册数值文本控件。",
|
||||
"name": "number_label_register",
|
||||
"return": {
|
||||
"type": "ret_t",
|
||||
"desc": "返回RET_OK表示成功,否则表示失败。"
|
||||
},
|
||||
"type": "method",
|
||||
"header": "src/number_label_register.h",
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"params": [],
|
||||
"annotation": {
|
||||
"global": true
|
||||
},
|
||||
"desc": "获取支持的渲染模式。",
|
||||
"name": "number_label_supported_render_mode",
|
||||
"return": {
|
||||
"type": "const char*",
|
||||
"desc": "返回渲染模式。"
|
||||
},
|
||||
"type": "method",
|
||||
"header": "src/number_label_register.h",
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"type": "class",
|
||||
"methods": [
|
||||
{
|
||||
"params": [
|
||||
{
|
||||
"type": "widget_t*",
|
||||
"name": "parent",
|
||||
"desc": "父控件"
|
||||
},
|
||||
{
|
||||
"type": "xy_t",
|
||||
"name": "x",
|
||||
"desc": "x坐标"
|
||||
},
|
||||
{
|
||||
"type": "xy_t",
|
||||
"name": "y",
|
||||
"desc": "y坐标"
|
||||
},
|
||||
{
|
||||
"type": "wh_t",
|
||||
"name": "w",
|
||||
"desc": "宽度"
|
||||
},
|
||||
{
|
||||
"type": "wh_t",
|
||||
"name": "h",
|
||||
"desc": "高度"
|
||||
}
|
||||
],
|
||||
"annotation": {
|
||||
"constructor": true,
|
||||
"scriptable": true
|
||||
},
|
||||
"desc": "创建number_label对象",
|
||||
"name": "number_label_create",
|
||||
"return": {
|
||||
"type": "widget_t*",
|
||||
"desc": "对象。"
|
||||
}
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
{
|
||||
"type": "widget_t*",
|
||||
"name": "widget",
|
||||
"desc": "number_label对象。"
|
||||
}
|
||||
],
|
||||
"annotation": {
|
||||
"cast": true,
|
||||
"scriptable": true
|
||||
},
|
||||
"desc": "转换为number_label对象(供脚本语言使用)。",
|
||||
"name": "number_label_cast",
|
||||
"return": {
|
||||
"type": "widget_t*",
|
||||
"desc": "number_label对象。"
|
||||
}
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
{
|
||||
"type": "widget_t*",
|
||||
"name": "widget",
|
||||
"desc": "控件对象。"
|
||||
},
|
||||
{
|
||||
"type": "const char*",
|
||||
"name": "format",
|
||||
"desc": "格式字符串。"
|
||||
}
|
||||
],
|
||||
"annotation": {
|
||||
"scriptable": true
|
||||
},
|
||||
"desc": "设置格式字符串(用于将浮点数转换为字符串)。",
|
||||
"name": "number_label_set_format",
|
||||
"return": {
|
||||
"type": "ret_t",
|
||||
"desc": "返回RET_OK表示成功,否则表示失败。"
|
||||
}
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
{
|
||||
"type": "widget_t*",
|
||||
"name": "widget",
|
||||
"desc": "控件对象。"
|
||||
},
|
||||
{
|
||||
"type": "double",
|
||||
"name": "decimal_font_size_scale",
|
||||
"desc": "小数部分字体大小与整数部分字体大小之比。"
|
||||
}
|
||||
],
|
||||
"annotation": {
|
||||
"scriptable": true
|
||||
},
|
||||
"desc": "设置小数部分字体大小与整数部分字体大小之比。",
|
||||
"name": "number_label_set_decimal_font_size_scale",
|
||||
"return": {
|
||||
"type": "ret_t",
|
||||
"desc": "返回RET_OK表示成功,否则表示失败。"
|
||||
}
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
{
|
||||
"type": "widget_t*",
|
||||
"name": "widget",
|
||||
"desc": "widget对象。"
|
||||
},
|
||||
{
|
||||
"type": "bool_t",
|
||||
"name": "readonly",
|
||||
"desc": "只读。"
|
||||
}
|
||||
],
|
||||
"annotation": {
|
||||
"scriptable": true
|
||||
},
|
||||
"desc": "设置控件是否为只读。",
|
||||
"name": "number_label_set_readonly",
|
||||
"return": {
|
||||
"type": "ret_t",
|
||||
"desc": "返回RET_OK表示成功,否则表示失败。"
|
||||
}
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
{
|
||||
"type": "widget_t*",
|
||||
"name": "widget",
|
||||
"desc": "widget对象。"
|
||||
},
|
||||
{
|
||||
"type": "bool_t",
|
||||
"name": "loop",
|
||||
"desc": "值是否循环。"
|
||||
}
|
||||
],
|
||||
"annotation": {
|
||||
"scriptable": true
|
||||
},
|
||||
"desc": "设置 值是否循环",
|
||||
"name": "number_label_set_loop",
|
||||
"return": {
|
||||
"type": "ret_t",
|
||||
"desc": "返回RET_OK表示成功,否则表示失败。"
|
||||
}
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
{
|
||||
"type": "widget_t*",
|
||||
"name": "widget",
|
||||
"desc": "widget对象。"
|
||||
},
|
||||
{
|
||||
"type": "double",
|
||||
"name": "min",
|
||||
"desc": "最小值。"
|
||||
},
|
||||
{
|
||||
"type": "double",
|
||||
"name": "max",
|
||||
"desc": "最大值。"
|
||||
},
|
||||
{
|
||||
"type": "double",
|
||||
"name": "step",
|
||||
"desc": "步长。"
|
||||
}
|
||||
],
|
||||
"annotation": {
|
||||
"scriptable": true
|
||||
},
|
||||
"desc": "设置取值范围和步长。",
|
||||
"name": "number_label_set_limit",
|
||||
"return": {
|
||||
"type": "ret_t",
|
||||
"desc": "返回RET_OK表示成功,否则表示失败。"
|
||||
}
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
{
|
||||
"type": "widget_t*",
|
||||
"name": "widget",
|
||||
"desc": "控件对象。"
|
||||
},
|
||||
{
|
||||
"type": "double",
|
||||
"name": "value",
|
||||
"desc": "数值。"
|
||||
}
|
||||
],
|
||||
"annotation": {
|
||||
"scriptable": true
|
||||
},
|
||||
"desc": "设置数值。",
|
||||
"name": "number_label_set_value",
|
||||
"return": {
|
||||
"type": "ret_t",
|
||||
"desc": "返回RET_OK表示成功,否则表示失败。"
|
||||
}
|
||||
}
|
||||
],
|
||||
"events": [],
|
||||
"properties": [
|
||||
{
|
||||
"name": "format",
|
||||
"desc": "格式字符串。",
|
||||
"type": "char*",
|
||||
"annotation": {
|
||||
"set_prop": true,
|
||||
"get_prop": true,
|
||||
"readable": true,
|
||||
"persitent": true,
|
||||
"design": true,
|
||||
"scriptable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "decimal_font_size_scale",
|
||||
"desc": "小数部分字体大小与整数部分字体大小之比。\n通常设置为0.5到1之间,让小数部分字体变小,用于强调整数部分。",
|
||||
"type": "double",
|
||||
"annotation": {
|
||||
"set_prop": true,
|
||||
"get_prop": true,
|
||||
"readable": true,
|
||||
"persitent": true,
|
||||
"design": true,
|
||||
"scriptable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "value",
|
||||
"desc": "数值。",
|
||||
"type": "double",
|
||||
"annotation": {
|
||||
"set_prop": true,
|
||||
"get_prop": true,
|
||||
"readable": true,
|
||||
"persitent": true,
|
||||
"design": true,
|
||||
"scriptable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "readonly",
|
||||
"desc": "编辑器是否为只读。",
|
||||
"type": "bool_t",
|
||||
"annotation": {
|
||||
"set_prop": true,
|
||||
"get_prop": true,
|
||||
"readable": true,
|
||||
"persitent": true,
|
||||
"design": true,
|
||||
"scriptable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "loop",
|
||||
"desc": "值是否循环。用上下键修改时,到达最小值时是否跳到最大值,到达最大值时是否跳到最小值。",
|
||||
"type": "bool_t",
|
||||
"annotation": {
|
||||
"set_prop": true,
|
||||
"get_prop": true,
|
||||
"readable": true,
|
||||
"persitent": true,
|
||||
"design": true,
|
||||
"scriptable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "min",
|
||||
"desc": "最小值。",
|
||||
"type": "double",
|
||||
"annotation": {
|
||||
"set_prop": true,
|
||||
"get_prop": true,
|
||||
"readable": true,
|
||||
"persitent": true,
|
||||
"design": true,
|
||||
"scriptable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "max",
|
||||
"desc": "最大值。",
|
||||
"type": "double",
|
||||
"annotation": {
|
||||
"set_prop": true,
|
||||
"get_prop": true,
|
||||
"readable": true,
|
||||
"persitent": true,
|
||||
"design": true,
|
||||
"scriptable": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "step",
|
||||
"desc": "步长。\n用上下键修改时,一次增加和减少时的数值。",
|
||||
"type": "double",
|
||||
"annotation": {
|
||||
"set_prop": true,
|
||||
"get_prop": true,
|
||||
"readable": true,
|
||||
"persitent": true,
|
||||
"design": true,
|
||||
"scriptable": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"header": "number_label/number_label.h",
|
||||
"desc": "数值文本控件。\n\n用于显示数值的文本控件。\n\n可以通过指定属性 format 来改变小数的有效位数。\n可以通过指定属性 decimal\\_font\\_size\\_scale 来减小小数部分的字体大小,以强调整数部分的重要性。\n\nnumber\\_label\\_t是[widget\\_t](widget_t.md)的子类控件,widget\\_t的函数均适用于number\\_label\\_t控件。\n\n在xml中使用\"number\\_label\"标签创建数值文本控件。如:\n\n```xml\n<!-- ui -->\n<number_label x=\"c\" y=\"50\" w=\"100\" h=\"40\" value=\"-128\" format=\"%.4lf\" decimal_font_size_scale=\"0.5\"/>\n```\n\n在c代码中使用函数number\\_label\\_create创建数值文本控件。如:\n\n```c\nwidget_t* number_label = number_label_create(win, 10, 10, 128, 30);\n```\n\n可用通过style来设置控件的显示风格,如字体的大小和颜色等等。如:\n\n```xml\n<!-- style -->\n<number_label>\n<style name=\"default\" font_size=\"32\">\n<normal text_color=\"black\" />\n</style>\n</number_label>\n```",
|
||||
"name": "number_label_t",
|
||||
"parent": "widget_t",
|
||||
"annotation": {
|
||||
"scriptable": true,
|
||||
"design": true,
|
||||
"widget": true
|
||||
},
|
||||
"level": 2
|
||||
}
|
||||
]
|
@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "number_label",
|
||||
"version": "1.0.1",
|
||||
"date":"2020-05-31",
|
||||
"team":"AWTK Develop Team",
|
||||
"author":"Li XianJing <xianjimli@hotmail.com>",
|
||||
"desc":"用于显示数值的文本控件。",
|
||||
"copyright":"Guangzhou ZHIYUAN Electronics Co.,Ltd.",
|
||||
"type": "PROJECT_CUSTOM_WIDGET",
|
||||
"entry": "main",
|
||||
"assets": {
|
||||
"activedTheme": "default",
|
||||
"outputDir": "res",
|
||||
"loadFrom": "any",
|
||||
"const": "resource_data",
|
||||
"screenDPR": "x1",
|
||||
"defaultLanguage": "zh",
|
||||
"defaultCountry": "CN",
|
||||
"themes": {
|
||||
"default": {
|
||||
"activedSystemBar": "system_bar",
|
||||
"activedBottomSystemBar": "system_bar_b",
|
||||
"packaged": true,
|
||||
"fonts": {
|
||||
"default": {
|
||||
"text": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~,。?!确定取消"
|
||||
}
|
||||
},
|
||||
"lcd": {
|
||||
"width": "320",
|
||||
"height": "480",
|
||||
"colorDepth": "16bit",
|
||||
"colorFormat": "BGR(A)"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"creator": {
|
||||
"name": "AWTK Designer",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"awtkRoot": "${DesignerPath}/SDK/awtk"
|
||||
}
|
@ -0,0 +1,2 @@
|
||||
__pycache__
|
||||
*.pyc
|
@ -0,0 +1,7 @@
|
||||
import os
|
||||
import sys
|
||||
APP_SCRIPTS_ROOT = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
print('APP_SCRIPTS_ROOT:' + APP_SCRIPTS_ROOT)
|
||||
|
||||
sys.path.insert(0, APP_SCRIPTS_ROOT)
|
@ -0,0 +1,7 @@
|
||||
import awtk_locator as locator
|
||||
|
||||
def Helper(ARGUMENTS):
|
||||
locator.init(ARGUMENTS)
|
||||
|
||||
from app_helper_base import AppHelperBase
|
||||
return AppHelperBase(ARGUMENTS)
|
@ -0,0 +1,62 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
AWTK_ROOT = ''
|
||||
|
||||
def getAwtkRoot():
|
||||
return AWTK_ROOT
|
||||
|
||||
def getAwtkSDKPath():
|
||||
env = os.environ
|
||||
if 'AWTK_SDK_PATH' in env:
|
||||
return env['AWTK_SDK_PATH']
|
||||
else:
|
||||
return ''
|
||||
|
||||
def getAwtkOrAwtkLinuxFbRoot(is_linux_fb):
|
||||
if is_linux_fb:
|
||||
return locateAWTK('awtk-linux-fb')
|
||||
else:
|
||||
return locateAWTK('awtk')
|
||||
|
||||
def locateAWTK(awtk):
|
||||
awtk_root = ''
|
||||
|
||||
if not os.path.exists(awtk_root):
|
||||
dirnames = ['../'+awtk, '../../'+awtk, '../../../'+awtk]
|
||||
for dirname in dirnames:
|
||||
if os.path.exists(dirname):
|
||||
awtk_root = dirname
|
||||
break
|
||||
|
||||
if not os.path.exists(awtk_root):
|
||||
awtk_sdk_path = getAwtkSDKPath();
|
||||
if os.path.exists(awtk_sdk_path):
|
||||
awtk_root = awtk_sdk_path + '/' + awtk
|
||||
|
||||
return os.path.abspath(awtk_root)
|
||||
|
||||
def init(ARGUMENTS = None):
|
||||
global AWTK_ROOT
|
||||
global LINUX_FB
|
||||
|
||||
if ARGUMENTS:
|
||||
AWTK_ROOT = ARGUMENTS.get('AWTK_ROOT', '')
|
||||
LINUX_FB = ARGUMENTS.get('LINUX_FB', '')
|
||||
else:
|
||||
LINUX_FB = ''
|
||||
|
||||
if not os.path.exists(AWTK_ROOT):
|
||||
AWTK_ROOT = getAwtkOrAwtkLinuxFbRoot(LINUX_FB != '')
|
||||
elif os.path.exists(LINUX_FB):
|
||||
print(' do not set LINUX_FB and AWTK_ROOT !!!')
|
||||
sys.exit()
|
||||
|
||||
if LINUX_FB:
|
||||
AWTK_SCRIPTS_ROOT = os.path.join(AWTK_ROOT, '../awtk/scripts')
|
||||
else:
|
||||
AWTK_SCRIPTS_ROOT = os.path.join(AWTK_ROOT, 'scripts')
|
||||
sys.path.insert(0, AWTK_SCRIPTS_ROOT)
|
||||
|
||||
print('AWTK_ROOT: ' + AWTK_ROOT)
|
||||
print('AWTK_SCRIPTS_ROOT: ' + AWTK_SCRIPTS_ROOT)
|
@ -0,0 +1,41 @@
|
||||
import sys
|
||||
import awtk_locator as locator
|
||||
|
||||
LONGSOPTS = ['awtk_root=', 'AWTK_ROOT=']
|
||||
def get_args(args, longsopts = []) :
|
||||
list_opts = []
|
||||
for arg in args:
|
||||
if arg.startswith('--') :
|
||||
tmp_opt = '';
|
||||
for opt in longsopts:
|
||||
if arg.find(opt) > 0 :
|
||||
tmp_opt = opt;
|
||||
break
|
||||
if tmp_opt != '' :
|
||||
list_opts.append(arg.split(tmp_opt)[1])
|
||||
continue
|
||||
else :
|
||||
print(arg + " not find command, command :")
|
||||
print(longsopts)
|
||||
sys.exit()
|
||||
return list_opts
|
||||
|
||||
|
||||
def update_res(ARGUMENTS, is_new_usage):
|
||||
locator.init(ARGUMENTS)
|
||||
|
||||
import update_res_app as updater
|
||||
if is_new_usage and not hasattr(updater, "getopt") :
|
||||
print(" must update awtk !!!")
|
||||
sys.exit()
|
||||
updater.run(locator.getAwtkRoot())
|
||||
|
||||
is_new_usage = False
|
||||
opts = get_args(sys.argv[1:], LONGSOPTS)
|
||||
ARGUMENTS = dict()
|
||||
if len(opts) > 0 :
|
||||
is_new_usage = True
|
||||
ARGUMENTS['AWTK_ROOT'] = opts[0]
|
||||
else :
|
||||
ARGUMENTS['AWTK_ROOT'] = ''
|
||||
update_res(ARGUMENTS, is_new_usage)
|
@ -0,0 +1,22 @@
|
||||
import os
|
||||
import sys
|
||||
import platform
|
||||
|
||||
OS_NAME = platform.system();
|
||||
LIB_DIR=os.environ['LIB_DIR'];
|
||||
BIN_DIR=os.environ['BIN_DIR'];
|
||||
|
||||
env=DefaultEnvironment().Clone()
|
||||
SOURCES=Glob('number_label/*.c') + Glob('*.c')
|
||||
|
||||
EXPORT_DEF=''
|
||||
if OS_NAME == 'Windows' and os.environ['TOOLS_NAME'] == '':
|
||||
EXPORT_DEF = ' /DEF:"src/number_label.def" '
|
||||
|
||||
if 'BUILD_SHARED' in os.environ and os.environ['BUILD_SHARED'] == 'True':
|
||||
LIBS=['awtk'];
|
||||
LINKFLAGS=env['LINKFLAGS'] + EXPORT_DEF
|
||||
env.SharedLibrary(os.path.join(BIN_DIR, 'number_label'), SOURCES, LIBS=LIBS, LINKFLAGS=LINKFLAGS);
|
||||
else:
|
||||
env.Library(os.path.join(LIB_DIR, 'number_label'), SOURCES);
|
||||
|
@ -0,0 +1,12 @@
|
||||
LIBRARY number_label
|
||||
EXPORTS
|
||||
number_label_register
|
||||
number_label_supported_render_mode
|
||||
number_label_create
|
||||
number_label_cast
|
||||
number_label_set_format
|
||||
number_label_set_decimal_font_size_scale
|
||||
number_label_set_readonly
|
||||
number_label_set_loop
|
||||
number_label_set_limit
|
||||
number_label_set_value
|
@ -0,0 +1,362 @@
|
||||
/**
|
||||
* File: number_label.h
|
||||
* Author: AWTK Develop Team
|
||||
* Brief: number_label
|
||||
*
|
||||
* Copyright (c) 2020 - 2020 Guangzhou ZHIYUAN Electronics Co.,Ltd.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* License file for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* History:
|
||||
* ================================================================
|
||||
* 2020-05-19 Li XianJing <xianjimli@hotmail.com> created
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tkc/mem.h"
|
||||
#include "tkc/utils.h"
|
||||
#include "base/widget_vtable.h"
|
||||
#include "number_label.h"
|
||||
|
||||
ret_t number_label_set_format(widget_t* widget, const char* format) {
|
||||
number_label_t* number_label = NUMBER_LABEL(widget);
|
||||
return_value_if_fail(widget != NULL, RET_BAD_PARAMS);
|
||||
return_value_if_fail(format != NULL, RET_BAD_PARAMS);
|
||||
|
||||
number_label->format = tk_str_copy(number_label->format, format);
|
||||
|
||||
return widget_invalidate(widget, NULL);
|
||||
}
|
||||
|
||||
ret_t number_label_set_value(widget_t* widget, double value) {
|
||||
number_label_t* number_label = NUMBER_LABEL(widget);
|
||||
return_value_if_fail(widget != NULL, RET_BAD_PARAMS);
|
||||
|
||||
number_label->value = value;
|
||||
|
||||
return widget_invalidate(widget, NULL);
|
||||
}
|
||||
|
||||
ret_t number_label_set_decimal_font_size_scale(widget_t* widget, double decimal_font_size_scale) {
|
||||
number_label_t* number_label = NUMBER_LABEL(widget);
|
||||
return_value_if_fail(widget != NULL, RET_BAD_PARAMS);
|
||||
|
||||
number_label->decimal_font_size_scale = decimal_font_size_scale;
|
||||
|
||||
return widget_invalidate(widget, NULL);
|
||||
}
|
||||
|
||||
static ret_t number_label_get_prop(widget_t* widget, const char* name, value_t* v) {
|
||||
number_label_t* number_label = NUMBER_LABEL(widget);
|
||||
return_value_if_fail(widget != NULL && name != NULL && v != NULL, RET_BAD_PARAMS);
|
||||
|
||||
if (tk_str_eq(name, WIDGET_PROP_MIN)) {
|
||||
value_set_double(v, number_label->min);
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_MAX)) {
|
||||
value_set_double(v, number_label->max);
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_STEP)) {
|
||||
value_set_double(v, number_label->step);
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_READONLY)) {
|
||||
value_set_bool(v, number_label->readonly);
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_LOOP)) {
|
||||
value_set_bool(v, number_label->loop);
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_VALUE)) {
|
||||
value_set_double(v, number_label->value);
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_FORMAT)) {
|
||||
value_set_str(v, number_label->format);
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, NUMBER_LABEL_PROP_DECIMAL_FONT_SIZE_SCALE)) {
|
||||
value_set_double(v, number_label->decimal_font_size_scale);
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
return RET_NOT_FOUND;
|
||||
}
|
||||
|
||||
static ret_t number_label_set_prop(widget_t* widget, const char* name, const value_t* v) {
|
||||
number_label_t* number_label = NUMBER_LABEL(widget);
|
||||
return_value_if_fail(widget != NULL && name != NULL && v != NULL, RET_BAD_PARAMS);
|
||||
|
||||
if (tk_str_eq(name, WIDGET_PROP_MIN)) {
|
||||
number_label->min = value_double(v);
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_MAX)) {
|
||||
number_label->max = value_double(v);
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_STEP)) {
|
||||
number_label->step = value_double(v);
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_READONLY)) {
|
||||
number_label->readonly = value_bool(v);
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_LOOP)) {
|
||||
number_label->loop = value_bool(v);
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_VALUE)) {
|
||||
number_label_set_value(widget, value_double(v));
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, WIDGET_PROP_FORMAT)) {
|
||||
number_label_set_format(widget, value_str(v));
|
||||
return RET_OK;
|
||||
} else if (tk_str_eq(name, NUMBER_LABEL_PROP_DECIMAL_FONT_SIZE_SCALE)) {
|
||||
number_label_set_decimal_font_size_scale(widget, value_double(v));
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
return RET_NOT_FOUND;
|
||||
}
|
||||
|
||||
static ret_t number_label_on_destroy(widget_t* widget) {
|
||||
number_label_t* number_label = NUMBER_LABEL(widget);
|
||||
return_value_if_fail(widget != NULL && number_label != NULL, RET_BAD_PARAMS);
|
||||
|
||||
TKMEM_FREE(number_label->format);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t number_label_paint_text(widget_t* widget, canvas_t* c, wstr_t* text) {
|
||||
int32_t x = 0;
|
||||
int32_t y = 0;
|
||||
int32_t w = widget->w;
|
||||
int32_t h = widget->h;
|
||||
float_t font_height = 0;
|
||||
float_t text_width = 0;
|
||||
float_t int_part_width = 0;
|
||||
float_t decimal_part_width = 0;
|
||||
int32_t int_part_len = 0;
|
||||
int32_t decimal_part_len = 0;
|
||||
style_t* style = widget->astyle;
|
||||
color_t trans = color_init(0, 0, 0, 0);
|
||||
number_label_t* number_label = NUMBER_LABEL(widget);
|
||||
color_t tc = style_get_color(style, STYLE_ID_TEXT_COLOR, trans);
|
||||
const char* font_name = style_get_str(style, STYLE_ID_FONT_NAME, NULL);
|
||||
int32_t margin = style_get_int(style, STYLE_ID_MARGIN, 0);
|
||||
int32_t margin_top = style_get_int(style, STYLE_ID_MARGIN_TOP, margin);
|
||||
int32_t margin_left = style_get_int(style, STYLE_ID_MARGIN_LEFT, margin);
|
||||
int32_t margin_bottom = style_get_int(style, STYLE_ID_MARGIN_BOTTOM, margin);
|
||||
uint16_t font_size = style_get_int(style, STYLE_ID_FONT_SIZE, TK_DEFAULT_FONT_SIZE);
|
||||
uint16_t decimal_font_size = font_size * number_label->decimal_font_size_scale;
|
||||
align_h_t align_h = (align_h_t)style_get_int(style, STYLE_ID_TEXT_ALIGN_H, ALIGN_H_CENTER);
|
||||
align_v_t align_v = (align_v_t)style_get_int(style, STYLE_ID_TEXT_ALIGN_V, ALIGN_V_MIDDLE);
|
||||
|
||||
while (text->str[int_part_len] != 0 && text->str[int_part_len] != '.') {
|
||||
int_part_len++;
|
||||
}
|
||||
int_part_len++;
|
||||
decimal_part_len = text->size - int_part_len;
|
||||
decimal_part_len = tk_max(decimal_part_len, 0);
|
||||
|
||||
canvas_set_text_color(c, tc);
|
||||
canvas_set_text_align(c, align_h, align_v);
|
||||
|
||||
canvas_set_font(c, font_name, font_size);
|
||||
int_part_width = canvas_measure_text(c, text->str, int_part_len);
|
||||
|
||||
canvas_set_font(c, font_name, decimal_font_size);
|
||||
decimal_part_width = canvas_measure_text(c, text->str + int_part_len, decimal_part_len);
|
||||
|
||||
text_width = int_part_width + decimal_part_width;
|
||||
switch (align_h) {
|
||||
case ALIGN_H_LEFT: {
|
||||
x = margin_left;
|
||||
break;
|
||||
}
|
||||
case ALIGN_H_RIGHT: {
|
||||
x = w - margin_left - text_width;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
x = (w - text_width) / 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
canvas_set_font(c, font_name, font_size);
|
||||
font_height = canvas_get_font_height(c);
|
||||
switch (align_v) {
|
||||
case ALIGN_V_TOP: {
|
||||
y = margin_top;
|
||||
canvas_draw_text(c, text->str, int_part_len, x, y);
|
||||
|
||||
break;
|
||||
}
|
||||
case ALIGN_V_BOTTOM: {
|
||||
y = h - margin_bottom - font_height;
|
||||
canvas_draw_text(c, text->str, int_part_len, x, y);
|
||||
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
y = (h - font_height) / 2;
|
||||
canvas_draw_text(c, text->str, int_part_len, x, y);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
canvas_set_font(c, font_name, decimal_font_size);
|
||||
y += font_height * (1 - number_label->decimal_font_size_scale) - 1;
|
||||
x += int_part_width;
|
||||
canvas_draw_text(c, text->str + int_part_len, decimal_part_len, x, y);
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t number_label_on_paint_self(widget_t* widget, canvas_t* c) {
|
||||
char buff[64];
|
||||
wstr_t* text = &(widget->text);
|
||||
number_label_t* number_label = NUMBER_LABEL(widget);
|
||||
const char* format =
|
||||
number_label->format != NULL ? number_label->format : NUMBER_LABEL_DEFAULT_FORMAT;
|
||||
return_value_if_fail(widget->astyle != NULL, RET_BAD_PARAMS);
|
||||
|
||||
memset(buff, 0x00, sizeof(buff));
|
||||
|
||||
if (strchr(format, 'd') != NULL) {
|
||||
tk_snprintf(buff, sizeof(buff) - 1, format, (int)(number_label->value));
|
||||
} else {
|
||||
tk_snprintf(buff, sizeof(buff) - 1, format, number_label->value);
|
||||
}
|
||||
|
||||
wstr_set_utf8(text, buff);
|
||||
|
||||
return number_label_paint_text(widget, c, text);
|
||||
}
|
||||
|
||||
ret_t number_label_set_limit(widget_t* widget, double min, double max, double step) {
|
||||
number_label_t* number_label = NUMBER_LABEL(widget);
|
||||
return_value_if_fail(number_label != NULL, RET_BAD_PARAMS);
|
||||
|
||||
number_label->min = min;
|
||||
number_label->max = max;
|
||||
number_label->step = step;
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
ret_t number_label_set_readonly(widget_t* widget, bool_t readonly) {
|
||||
number_label_t* number_label = NUMBER_LABEL(widget);
|
||||
return_value_if_fail(number_label != NULL, RET_BAD_PARAMS);
|
||||
|
||||
number_label->readonly = readonly;
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
ret_t number_label_set_loop(widget_t* widget, bool_t loop) {
|
||||
number_label_t* number_label = NUMBER_LABEL(widget);
|
||||
return_value_if_fail(number_label != NULL, RET_BAD_PARAMS);
|
||||
|
||||
number_label->loop = loop;
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t number_label_add_delta(widget_t* widget, double delta) {
|
||||
number_label_t* number_label = NUMBER_LABEL(widget);
|
||||
double value = number_label->value + delta;
|
||||
|
||||
if (number_label->min < number_label->max) {
|
||||
if (value < number_label->min) {
|
||||
value = number_label->loop ? number_label->max : number_label->min;
|
||||
}
|
||||
|
||||
if (value > number_label->max) {
|
||||
value = number_label->loop ? number_label->min : number_label->max;
|
||||
}
|
||||
}
|
||||
|
||||
if (!tk_fequal(number_label->value, value)) {
|
||||
value_change_event_t evt;
|
||||
value_change_event_init(&evt, EVT_VALUE_WILL_CHANGE, widget);
|
||||
value_set_double(&(evt.old_value), number_label->value);
|
||||
value_set_double(&(evt.new_value), value);
|
||||
|
||||
if (widget_dispatch(widget, (event_t*)&evt) != RET_STOP) {
|
||||
number_label->value = value;
|
||||
evt.e.type = EVT_VALUE_CHANGED;
|
||||
widget_dispatch(widget, (event_t*)&evt);
|
||||
widget_invalidate(widget, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
ret_t number_label_on_event(widget_t* widget, event_t* e) {
|
||||
ret_t ret = RET_OK;
|
||||
number_label_t* number_label = NUMBER_LABEL(widget);
|
||||
|
||||
switch (e->type) {
|
||||
case EVT_KEY_DOWN: {
|
||||
key_event_t* evt = (key_event_t*)e;
|
||||
if (!(number_label->readonly)) {
|
||||
return_value_if_fail(number_label->step != 0, RET_FAIL);
|
||||
|
||||
if (evt->key == TK_KEY_UP || evt->key == TK_KEY_LEFT) {
|
||||
number_label_add_delta(widget, number_label->step);
|
||||
ret = RET_STOP;
|
||||
} else if (evt->key == TK_KEY_DOWN || evt->key == TK_KEY_RIGHT) {
|
||||
number_label_add_delta(widget, -number_label->step);
|
||||
ret = RET_STOP;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const char* s_number_label_properties[] = {NUMBER_LABEL_PROP_DECIMAL_FONT_SIZE_SCALE,
|
||||
WIDGET_PROP_MIN,
|
||||
WIDGET_PROP_MAX,
|
||||
WIDGET_PROP_STEP,
|
||||
WIDGET_PROP_LOOP,
|
||||
WIDGET_PROP_READONLY,
|
||||
WIDGET_PROP_FORMAT,
|
||||
WIDGET_PROP_VALUE,
|
||||
NULL};
|
||||
|
||||
TK_DECL_VTABLE(number_label) = {.size = sizeof(number_label_t),
|
||||
.type = WIDGET_TYPE_NUMBER_LABEL,
|
||||
.parent = NULL,
|
||||
.clone_properties = s_number_label_properties,
|
||||
.persistent_properties = s_number_label_properties,
|
||||
.create = number_label_create,
|
||||
.on_paint_self = number_label_on_paint_self,
|
||||
.set_prop = number_label_set_prop,
|
||||
.get_prop = number_label_get_prop,
|
||||
.on_event = number_label_on_event,
|
||||
.on_destroy = number_label_on_destroy};
|
||||
|
||||
widget_t* number_label_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h) {
|
||||
number_label_t* number_label =
|
||||
NUMBER_LABEL(widget_create(parent, TK_REF_VTABLE(number_label), x, y, w, h));
|
||||
number_label->format = tk_strdup(NUMBER_LABEL_DEFAULT_FORMAT);
|
||||
number_label->min = 0;
|
||||
number_label->max = 0;
|
||||
number_label->step = 1;
|
||||
number_label->readonly = FALSE;
|
||||
number_label->decimal_font_size_scale = 0.6;
|
||||
|
||||
return (widget_t*)number_label;
|
||||
}
|
||||
|
||||
widget_t* number_label_cast(widget_t* widget) {
|
||||
return_value_if_fail(WIDGET_IS_INSTANCE_OF(widget, number_label), NULL);
|
||||
|
||||
return widget;
|
||||
}
|
@ -0,0 +1,238 @@
|
||||
/**
|
||||
* File: number_label.h
|
||||
* Author: AWTK Develop Team
|
||||
* Brief: number_label
|
||||
*
|
||||
* Copyright (c) 2020 - 2020 Guangzhou ZHIYUAN Electronics Co.,Ltd.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* License file for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* History:
|
||||
* ================================================================
|
||||
* 2020-05-19 Li XianJing <xianjimli@hotmail.com> created
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TK_NUMBER_LABEL_H
|
||||
#define TK_NUMBER_LABEL_H
|
||||
|
||||
#include "base/widget.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/**
|
||||
* @class number_label_t
|
||||
* @parent widget_t
|
||||
* @annotation ["scriptable","design","widget"]
|
||||
* 数值文本控件。
|
||||
*
|
||||
* 用于显示数值的文本控件。
|
||||
*
|
||||
* 可以通过指定属性 format 来改变小数的有效位数。
|
||||
* 可以通过指定属性 decimal\_font\_size\_scale 来减小小数部分的字体大小,以强调整数部分的重要性。
|
||||
*
|
||||
* number\_label\_t是[widget\_t](widget_t.md)的子类控件,widget\_t的函数均适用于number\_label\_t控件。
|
||||
*
|
||||
* 在xml中使用"number\_label"标签创建数值文本控件。如:
|
||||
*
|
||||
* ```xml
|
||||
* <!-- ui -->
|
||||
* <number_label x="c" y="50" w="100" h="40" value="-128" format="%.4lf" decimal_font_size_scale="0.5"/>
|
||||
* ```
|
||||
*
|
||||
* 在c代码中使用函数number\_label\_create创建数值文本控件。如:
|
||||
*
|
||||
* ```c
|
||||
* widget_t* number_label = number_label_create(win, 10, 10, 128, 30);
|
||||
* ```
|
||||
*
|
||||
* 可用通过style来设置控件的显示风格,如字体的大小和颜色等等。如:
|
||||
*
|
||||
* ```xml
|
||||
* <!-- style -->
|
||||
* <number_label>
|
||||
* <style name="default" font_size="32">
|
||||
* <normal text_color="black" />
|
||||
* </style>
|
||||
* </number_label>
|
||||
* ```
|
||||
*/
|
||||
typedef struct _number_label_t {
|
||||
widget_t widget;
|
||||
|
||||
/**
|
||||
* @property {char*} format
|
||||
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
|
||||
*
|
||||
* 格式字符串。
|
||||
*
|
||||
*/
|
||||
char* format;
|
||||
|
||||
/**
|
||||
* @property {double} decimal_font_size_scale
|
||||
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
|
||||
*
|
||||
* 小数部分字体大小与整数部分字体大小之比。
|
||||
* 通常设置为0.5到1之间,让小数部分字体变小,用于强调整数部分。
|
||||
*
|
||||
*/
|
||||
double decimal_font_size_scale;
|
||||
|
||||
/**
|
||||
* @property {double} value
|
||||
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
|
||||
* 数值。
|
||||
*
|
||||
*/
|
||||
double value;
|
||||
|
||||
/**
|
||||
* @property {bool_t} readonly
|
||||
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
|
||||
* 编辑器是否为只读。
|
||||
*/
|
||||
bool_t readonly;
|
||||
|
||||
/**
|
||||
* @property {bool_t} loop
|
||||
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
|
||||
* 值是否循环。用上下键修改时,到达最小值时是否跳到最大值,到达最大值时是否跳到最小值。
|
||||
*/
|
||||
bool_t loop;
|
||||
|
||||
/**
|
||||
* @property {double} min
|
||||
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
|
||||
* 最小值。
|
||||
*/
|
||||
double min;
|
||||
|
||||
/**
|
||||
* @property {double} max
|
||||
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
|
||||
* 最大值。
|
||||
*/
|
||||
double max;
|
||||
|
||||
/**
|
||||
* @property {double} step
|
||||
* @annotation ["set_prop","get_prop","readable","persitent","design","scriptable"]
|
||||
* 步长。
|
||||
* 用上下键修改时,一次增加和减少时的数值。
|
||||
*/
|
||||
double step;
|
||||
|
||||
/*private*/
|
||||
} number_label_t;
|
||||
|
||||
/**
|
||||
* @method number_label_create
|
||||
* 创建number_label对象
|
||||
* @annotation ["constructor", "scriptable"]
|
||||
* @param {widget_t*} parent 父控件
|
||||
* @param {xy_t} x x坐标
|
||||
* @param {xy_t} y y坐标
|
||||
* @param {wh_t} w 宽度
|
||||
* @param {wh_t} h 高度
|
||||
*
|
||||
* @return {widget_t*} 对象。
|
||||
*/
|
||||
widget_t* number_label_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h);
|
||||
|
||||
/**
|
||||
* @method number_label_cast
|
||||
* 转换为number_label对象(供脚本语言使用)。
|
||||
* @annotation ["cast", "scriptable"]
|
||||
* @param {widget_t*} widget number_label对象。
|
||||
*
|
||||
* @return {widget_t*} number_label对象。
|
||||
*/
|
||||
widget_t* number_label_cast(widget_t* widget);
|
||||
|
||||
/**
|
||||
* @method number_label_set_format
|
||||
* 设置格式字符串(用于将浮点数转换为字符串)。
|
||||
* @annotation ["scriptable"]
|
||||
* @param {widget_t*} widget 控件对象。
|
||||
* @param {const char*} format 格式字符串。
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
ret_t number_label_set_format(widget_t* widget, const char* format);
|
||||
|
||||
/**
|
||||
* @method number_label_set_decimal_font_size_scale
|
||||
* 设置小数部分字体大小与整数部分字体大小之比。
|
||||
*
|
||||
* @annotation ["scriptable"]
|
||||
* @param {widget_t*} widget 控件对象。
|
||||
* @param {double} decimal_font_size_scale 小数部分字体大小与整数部分字体大小之比。
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
ret_t number_label_set_decimal_font_size_scale(widget_t* widget, double decimal_font_size_scale);
|
||||
|
||||
/**
|
||||
* @method number_label_set_readonly
|
||||
* 设置控件是否为只读。
|
||||
* @annotation ["scriptable"]
|
||||
* @param {widget_t*} widget widget对象。
|
||||
* @param {bool_t} readonly 只读。
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
ret_t number_label_set_readonly(widget_t* widget, bool_t readonly);
|
||||
|
||||
/**
|
||||
* @method number_label_set_loop
|
||||
* 设置 值是否循环
|
||||
* @annotation ["scriptable"]
|
||||
* @param {widget_t*} widget widget对象。
|
||||
* @param {bool_t} loop 值是否循环。
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
ret_t number_label_set_loop(widget_t* widget, bool_t loop);
|
||||
|
||||
/**
|
||||
* @method number_label_set_limit
|
||||
* 设置取值范围和步长。
|
||||
* @annotation ["scriptable"]
|
||||
* @param {widget_t*} widget widget对象。
|
||||
* @param {double} min 最小值。
|
||||
* @param {double} max 最大值。
|
||||
* @param {double} step 步长。
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
ret_t number_label_set_limit(widget_t* widget, double min, double max, double step);
|
||||
|
||||
/**
|
||||
* @method number_label_set_value
|
||||
* 设置数值。
|
||||
*
|
||||
* @annotation ["scriptable"]
|
||||
* @param {widget_t*} widget 控件对象。
|
||||
* @param {double} value 数值。
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
ret_t number_label_set_value(widget_t* widget, double value);
|
||||
|
||||
#define NUMBER_LABEL_PROP_FORMAT "format"
|
||||
#define NUMBER_LABEL_PROP_DECIMAL_FONT_SIZE_SCALE "decimal_font_size_scale"
|
||||
|
||||
#define WIDGET_TYPE_NUMBER_LABEL "number_label"
|
||||
#define NUMBER_LABEL(widget) ((number_label_t*)(number_label_cast(WIDGET(widget))))
|
||||
#define NUMBER_LABEL_DEFAULT_FORMAT "%.02lf"
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /*TK_NUMBER_LABEL_H*/
|
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* File: number_label_register.c
|
||||
* Author: AWTK Develop Team
|
||||
* Brief: number label register
|
||||
*
|
||||
* Copyright (c) 2020 - 2020 Guangzhou ZHIYUAN Electronics Co.,Ltd.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* License file for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* History:
|
||||
* ================================================================
|
||||
* 2020-05-19 Li XianJing <xianjimli@hotmail.com> created
|
||||
*
|
||||
*/
|
||||
|
||||
#include "tkc/mem.h"
|
||||
#include "tkc/utils.h"
|
||||
#include "base/widget_factory.h"
|
||||
#include "number_label_register.h"
|
||||
#include "number_label/number_label.h"
|
||||
|
||||
ret_t number_label_register(void) {
|
||||
return widget_factory_register(widget_factory(), WIDGET_TYPE_NUMBER_LABEL, number_label_create);
|
||||
}
|
||||
|
||||
const char* number_label_supported_render_mode(void) {
|
||||
return "OpenGL|AGGE-BGR565|AGGE-BGRA8888|AGGE-MONO";
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/**
|
||||
* File: number_label_register.h
|
||||
* Author: AWTK Develop Team
|
||||
* Brief: number label register
|
||||
*
|
||||
* Copyright (c) 2020 - 2020 Guangzhou ZHIYUAN Electronics Co.,Ltd.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* License file for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* History:
|
||||
* ================================================================
|
||||
* 2020-05-19 Li XianJing <xianjimli@hotmail.com> created
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef TK_NUMBER_LABEL_REGISTER_H
|
||||
#define TK_NUMBER_LABEL_REGISTER_H
|
||||
|
||||
#include "base/widget.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
/**
|
||||
* @method number_label_register
|
||||
* 注册数值文本控件。
|
||||
*
|
||||
* @annotation ["global"]
|
||||
*
|
||||
* @return {ret_t} 返回RET_OK表示成功,否则表示失败。
|
||||
*/
|
||||
ret_t number_label_register(void);
|
||||
|
||||
/**
|
||||
* @method number_label_supported_render_mode
|
||||
* 获取支持的渲染模式。
|
||||
*
|
||||
* @annotation ["global"]
|
||||
*
|
||||
* @return {const char*} 返回渲染模式。
|
||||
*/
|
||||
const char* number_label_supported_render_mode(void);
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif /*TK_NUMBER_LABEL_REGISTER_H*/
|
@ -0,0 +1,115 @@
|
||||
---
|
||||
Language: Cpp
|
||||
# BasedOnStyle: Google
|
||||
AccessModifierOffset: -1
|
||||
AlignAfterOpenBracket: Align
|
||||
AlignConsecutiveAssignments: false
|
||||
AlignConsecutiveDeclarations: false
|
||||
AlignEscapedNewlines: Left
|
||||
AlignOperands: true
|
||||
AlignTrailingComments: true
|
||||
AllowAllParametersOfDeclarationOnNextLine: true
|
||||
AllowShortBlocksOnASingleLine: false
|
||||
AllowShortCaseLabelsOnASingleLine: false
|
||||
AllowShortFunctionsOnASingleLine: false
|
||||
AllowShortIfStatementsOnASingleLine: true
|
||||
AllowShortLoopsOnASingleLine: true
|
||||
AlwaysBreakAfterDefinitionReturnType: None
|
||||
AlwaysBreakAfterReturnType: None
|
||||
AlwaysBreakBeforeMultilineStrings: true
|
||||
AlwaysBreakTemplateDeclarations: true
|
||||
BinPackArguments: true
|
||||
BinPackParameters: true
|
||||
BraceWrapping:
|
||||
AfterClass: false
|
||||
AfterControlStatement: false
|
||||
AfterEnum: false
|
||||
AfterFunction: false
|
||||
AfterNamespace: false
|
||||
AfterObjCDeclaration: false
|
||||
AfterStruct: false
|
||||
AfterUnion: false
|
||||
AfterExternBlock: false
|
||||
BeforeCatch: false
|
||||
BeforeElse: false
|
||||
IndentBraces: false
|
||||
SplitEmptyFunction: true
|
||||
SplitEmptyRecord: true
|
||||
SplitEmptyNamespace: true
|
||||
BreakBeforeBinaryOperators: None
|
||||
BreakBeforeBraces: Attach
|
||||
BreakBeforeInheritanceComma: false
|
||||
BreakBeforeTernaryOperators: true
|
||||
BreakConstructorInitializersBeforeComma: false
|
||||
BreakConstructorInitializers: BeforeColon
|
||||
BreakAfterJavaFieldAnnotations: false
|
||||
BreakStringLiterals: true
|
||||
ColumnLimit: 100
|
||||
CommentPragmas: '^ IWYU pragma:'
|
||||
CompactNamespaces: false
|
||||
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||
ConstructorInitializerIndentWidth: 4
|
||||
ContinuationIndentWidth: 4
|
||||
Cpp11BracedListStyle: true
|
||||
DerivePointerAlignment: false
|
||||
DisableFormat: false
|
||||
ExperimentalAutoDetectBinPacking: false
|
||||
FixNamespaceComments: true
|
||||
ForEachMacros:
|
||||
- foreach
|
||||
- Q_FOREACH
|
||||
- BOOST_FOREACH
|
||||
IncludeCategories:
|
||||
- Regex: '^<ext/.*\.h>'
|
||||
Priority: 2
|
||||
- Regex: '^<.*\.h>'
|
||||
Priority: 1
|
||||
- Regex: '^<.*'
|
||||
Priority: 2
|
||||
- Regex: '.*'
|
||||
Priority: 3
|
||||
IncludeIsMainRegex: '([-_](test|unittest))?$'
|
||||
IndentCaseLabels: true
|
||||
IndentPPDirectives: None
|
||||
IndentWidth: 2
|
||||
IndentWrappedFunctionNames: false
|
||||
JavaScriptQuotes: Leave
|
||||
JavaScriptWrapImports: true
|
||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
MacroBlockBegin: ''
|
||||
MacroBlockEnd: ''
|
||||
MaxEmptyLinesToKeep: 1
|
||||
NamespaceIndentation: None
|
||||
ObjCBlockIndentWidth: 2
|
||||
ObjCSpaceAfterProperty: false
|
||||
ObjCSpaceBeforeProtocolList: false
|
||||
PenaltyBreakAssignment: 2
|
||||
PenaltyBreakBeforeFirstCallParameter: 1
|
||||
PenaltyBreakComment: 600
|
||||
PenaltyBreakFirstLessLess: 100
|
||||
PenaltyBreakString: 1000
|
||||
PenaltyExcessCharacter: 1000000
|
||||
PenaltyReturnTypeOnItsOwnLine: 200
|
||||
PointerAlignment: Left
|
||||
RawStringFormats:
|
||||
- Language: TextProto
|
||||
BasedOnStyle: google
|
||||
ReflowComments: false
|
||||
SortIncludes: false
|
||||
SortUsingDeclarations: true
|
||||
SpaceAfterCStyleCast: false
|
||||
SpaceAfterTemplateKeyword: true
|
||||
SpaceBeforeAssignmentOperators: true
|
||||
SpaceBeforeParens: ControlStatements
|
||||
SpaceInEmptyParentheses: false
|
||||
SpacesBeforeTrailingComments: 2
|
||||
SpacesInAngles: false
|
||||
SpacesInContainerLiterals: true
|
||||
SpacesInCStyleCastParentheses: false
|
||||
SpacesInParentheses: false
|
||||
SpacesInSquareBrackets: false
|
||||
Standard: Auto
|
||||
TabWidth: 2
|
||||
UseTab: Never
|
||||
...
|
||||
|
34
MXC_A27-PCB4.5-270T/lib/awtk/awtk-examples/MOTO_A270S/3rd/awtk-widget-qr/.gitignore
vendored
Normal file
@ -0,0 +1,34 @@
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
*.swp
|
||||
*.pdb
|
||||
*.ilk
|
||||
*.idb
|
||||
*.obj
|
||||
*.exe
|
||||
*.os
|
||||
*.pyc
|
||||
/bin
|
||||
/lib
|
||||
.sconsign.dblite
|
||||
lua/demo1
|
||||
lua/lftk_run
|
||||
tags
|
||||
bin/demo1*
|
||||
bin/demo_animator*
|
||||
bin/demo_thread*
|
||||
bin/demotr*
|
||||
bin/demovg*
|
||||
bin/fontgen*
|
||||
bin/preview_ui*
|
||||
bin/resgen*
|
||||
bin/runLua*
|
||||
bin/runTest*
|
||||
bin/strgen*
|
||||
bin/image*
|
||||
bin/hello*
|
||||
.vscode
|
||||
.vs
|
||||
*.os
|
||||
res
|
@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
|
||||
USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random
|
||||
Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
@ -0,0 +1,143 @@
|
||||
# awtk-widget-qr
|
||||
|
||||
qr 控件。用于显示二维码控件。
|
||||
|
||||

|
||||
|
||||
* 本项目使用 [libqrencode](https://github.com/fukuchi/libqrencode) 生成二维码。
|
||||
|
||||
* 本项目使用 [awtk-widget-generator](https://github.com/zlgopen/awtk-widget-generator) 生成代码框架。
|
||||
|
||||
## 准备
|
||||
|
||||
1. 获取 awtk 并编译
|
||||
|
||||
```
|
||||
git clone https://github.com/zlgopen/awtk.git
|
||||
cd awtk; scons; cd -
|
||||
```
|
||||
|
||||
2. 获取 awtk-widget-qr 并编译
|
||||
```
|
||||
git clone https://github.com/zlgopen/awtk-widget-qr.git
|
||||
cd awtk-widget-qr; scons
|
||||
```
|
||||
|
||||
## 运行
|
||||
|
||||
1. 生成示例代码的资源
|
||||
|
||||
```
|
||||
python scripts/update_res.py all
|
||||
```
|
||||
> 也可以使用 Designer 打开项目,之后点击 “打包” 按钮进行生成;
|
||||
> 如果资源发生修改,则需要重新生成资源。
|
||||
|
||||
如果 PIL 没有安装,执行上述脚本可能会出现如下错误:
|
||||
```cmd
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
ModuleNotFoundError: No module named 'PIL'
|
||||
```
|
||||
请用 pip 安装:
|
||||
```cmd
|
||||
pip install Pillow
|
||||
```
|
||||
|
||||
2. 编译
|
||||
|
||||
* 编译PC版本
|
||||
|
||||
```
|
||||
scons
|
||||
```
|
||||
|
||||
* 编译LINUX FB版本
|
||||
|
||||
```
|
||||
scons LINUX_FB=true
|
||||
```
|
||||
|
||||
> 完整编译选项请参考[编译选项](https://github.com/zlgopen/awtk-widget-generator/blob/master/docs/build_options.md)
|
||||
|
||||
|
||||
3. 运行
|
||||
|
||||
```
|
||||
./bin/demo
|
||||
```
|
||||
|
||||
## 如何使用二维码控件
|
||||
|
||||
### 设置需要转成二维码的字符串
|
||||
|
||||
qr 控件 `value` 属性内容就是转成二维码的字符串内容。
|
||||
|
||||
在界面描述文件设置:
|
||||
|
||||
```xml
|
||||
<window theme="main" name="main">
|
||||
<qr name="qr" x="c" y="m" w="50%" h="50%" value="https://github.com/zlgopen/awtk"/>
|
||||
</window>
|
||||
```
|
||||
|
||||
或在代码中设置:
|
||||
|
||||
```c
|
||||
widget_t* win = window_open("main");
|
||||
widget_t* qr = widget_lookup(win, "qr", TRUE);
|
||||
qr_set_value(qr, "https://github.com/zlgopen/awtk");
|
||||
```
|
||||
|
||||
按照上述例子设置完成后,用手机扫该二维码就会打开[ https://github.com/zlgopen/awtk ](https://github.com/zlgopen/awtk)网址。
|
||||
|
||||
### 设置二维码中的颜色与图片
|
||||
|
||||
添加图片资源到项目中:
|
||||
|
||||

|
||||
|
||||
在样式文件中设置 qr 控件样式在对应状态设置 `fg_color` ,`bg_color`,`bg_image` 属性:
|
||||
|
||||
```xml
|
||||
<qr>
|
||||
<style name="default">
|
||||
<!-- fg_color 为二维码颜色,bg_color 为二维码背景色 -->
|
||||
<normal fg_color="black" bg_color="white" bg_image="message"/>
|
||||
|
||||
<!-- disable 状态用于模拟 被扫描 状态 -->
|
||||
<!-- 不设置 bg_image 属性,则该状态二维码中间没有图片 -->
|
||||
<disable fg_color="gray" bg_color="#f0f0f0"/>
|
||||
</style>
|
||||
</qr>
|
||||
```
|
||||
|
||||
从上述例子得到的效果为:
|
||||
|
||||
正常状态:
|
||||
|
||||

|
||||
|
||||
被扫描状态:
|
||||
|
||||

|
||||
|
||||
**注意**:图片大小不可以大于二维码的 `45%` ,否则图片将会被裁剪:
|
||||
|
||||
图片资源:
|
||||
|
||||

|
||||
|
||||
得到的二维码:
|
||||
|
||||

|
||||
|
||||
qr 控件的属性名及作用如下表所示:
|
||||
|
||||
| 属性名 | 作用 |
|
||||
| ------ | ---------------------- |
|
||||
| value | 要转换为二维码的字符串 |
|
||||
|
||||
## 文档
|
||||
|
||||
[完善自定义控件](https://github.com/zlgopen/awtk-widget-generator/blob/master/docs/improve_generated_widget.md)
|
@ -0,0 +1,8 @@
|
||||
import os
|
||||
import scripts.app_helper as app
|
||||
|
||||
helper = app.Helper(ARGUMENTS)
|
||||
helper.set_dll_def('src/qr.def').set_libs(['qr']).call(DefaultEnvironment)
|
||||
|
||||
SConscriptFiles = ['src/SConscript']
|
||||
SConscript(SConscriptFiles)
|
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 9.8 KiB |
After Width: | Height: | Size: 25 KiB |
@ -0,0 +1,459 @@
|
||||
<window>
|
||||
<style name="default">
|
||||
<normal bg_color="#ffffff"/>
|
||||
</style>
|
||||
</window>
|
||||
|
||||
<dialog>
|
||||
<style name="default" border_color="#c2c2c2">
|
||||
<normal bg_color="#ffffff"/>
|
||||
</style>
|
||||
</dialog>
|
||||
|
||||
<popup>
|
||||
<style name="default" border_color="#c2c2c2">
|
||||
<normal bg_color="#ffffff"/>
|
||||
</style>
|
||||
</popup>
|
||||
|
||||
<overlay>
|
||||
<style name="default" border_color="#c2c2c2">
|
||||
<normal bg_color="#ffffff"/>
|
||||
</style>
|
||||
</overlay>
|
||||
|
||||
<system_bar>
|
||||
<style name="default" border="bottom" border_color="#c2c2c2">
|
||||
<normal bg_color="#ffffff"/>
|
||||
</style>
|
||||
</system_bar>
|
||||
|
||||
<system_bar_bottom>
|
||||
<style name="default" border="top" border_color="#c2c2c2">
|
||||
<normal bg_color="#ffffff"/>
|
||||
</style>
|
||||
</system_bar_bottom>
|
||||
|
||||
<keyboard>
|
||||
<style name="default" border_color="#c2c2c2">
|
||||
<normal bg_color="#e1e1e1"/>
|
||||
</style>
|
||||
</keyboard>
|
||||
|
||||
<button>
|
||||
<style name="default" round_radius="4">
|
||||
<normal text_color="#444444" bg_color="#f4f4f4" border_color="#c2c2c2"/>
|
||||
<pressed text_color="#ffffff" bg_color="#1971dd" border_color="#1971dd"/>
|
||||
<over text_color="#ffffff" bg_color="#338fff" border_color="#338fff"/>
|
||||
<focused text_color="#444444" bg_color="#f4f4f4" border_color="#338fff" />
|
||||
<disable text_color="#44444466" bg_color="#f4f4f466" border_color="#c2c2c266" />
|
||||
</style>
|
||||
|
||||
<style name="combobox_down" border_color="#c2c2c2" bg_color="#f2f2f2">
|
||||
<normal icon="arrow_down_n"/>
|
||||
<pressed icon="arrow_down_p"/>
|
||||
<over icon="arrow_down_o"/>
|
||||
<disable icon="arrow_down_d" border_color="#c2c2c266" bg_color="#f2f2f266"/>
|
||||
</style>
|
||||
|
||||
<style name="spinbox_down" border_color="#c2c2c2" bg_color="#f2f2f2">
|
||||
<normal icon="arrow_down_n"/>
|
||||
<pressed icon="arrow_down_p"/>
|
||||
<over icon="arrow_down_o"/>
|
||||
<disable icon="arrow_down_d" border_color="#c2c2c266" bg_color="#f2f2f266"/>
|
||||
</style>
|
||||
|
||||
<style name="spinbox_up" border_color="#c2c2c2" bg_color="#f2f2f2">
|
||||
<normal icon="arrow_up_n"/>
|
||||
<pressed icon="arrow_up_p"/>
|
||||
<over icon="arrow_up_o"/>
|
||||
<disable icon="arrow_up_d" border_color="#c2c2c266" bg_color="#f2f2f266"/>
|
||||
</style>
|
||||
|
||||
<style name="spinbox_left" border_color="#c2c2c2" bg_color="#f2f2f2">
|
||||
<normal icon="arrow_left_n"/>
|
||||
<pressed icon="arrow_left_p"/>
|
||||
<over icon="arrow_left_o"/>
|
||||
<disable icon="arrow_left_d" border_color="#c2c2c266" bg_color="#f2f2f266"/>
|
||||
</style>
|
||||
|
||||
<style name="spinbox_right" border_color="#c2c2c2" bg_color="#f2f2f2">
|
||||
<normal icon="arrow_right_n"/>
|
||||
<pressed icon="arrow_right_p"/>
|
||||
<over icon="arrow_right_o"/>
|
||||
<disable icon="arrow_right_d" border_color="#c2c2c266" bg_color="#f2f2f266"/>
|
||||
</style>
|
||||
|
||||
<style name="scroll_down" bg_color="#f2f2f2">
|
||||
<normal icon="arrow_down_n"/>
|
||||
<pressed icon="arrow_down_p"/>
|
||||
<over icon="arrow_down_o"/>
|
||||
<disable icon="arrow_down_d" border_color="#c2c2c266" bg_color="#f2f2f266"/>
|
||||
</style>
|
||||
|
||||
<style name="scroll_up" bg_color="#f2f2f2">
|
||||
<normal icon="arrow_up_n"/>
|
||||
<pressed icon="arrow_up_p"/>
|
||||
<over icon="arrow_up_o"/>
|
||||
<disable icon="arrow_up_d" bg_color="#f2f2f266"/>
|
||||
</style>
|
||||
|
||||
<style name="scroll_left" bg_color="#f2f2f2">
|
||||
<normal icon="arrow_left_n"/>
|
||||
<pressed icon="arrow_left_p"/>
|
||||
<over icon="arrow_left_o"/>
|
||||
<disable icon="arrow_left_d" bg_color="#f2f2f266"/>
|
||||
</style>
|
||||
|
||||
<style name="scroll_right" bg_color="#f2f2f2">
|
||||
<normal icon="arrow_right_n"/>
|
||||
<pressed icon="arrow_right_p"/>
|
||||
<over icon="arrow_right_o"/>
|
||||
<disable icon="arrow_right_d" bg_color="#f2f2f266"/>
|
||||
</style>
|
||||
|
||||
</button>
|
||||
|
||||
<edit selected_text_color="#010101" selected_bg_color="#b5d7fd">
|
||||
<style name="default" bg_color="#f7f7f7" text_color="#444444" text_align_h="left">
|
||||
<normal border_color="#c2c2c2"/>
|
||||
<focused border_color="#338fff"/>
|
||||
<disable bg_color="#f7f7f766" border_color="#c2c2c266" text_color="#44444466" />
|
||||
<error border_color="#ff0000" />
|
||||
<empty border_color="#c2c2c2" text_color="#959494"/>
|
||||
<empty_focus border_color="#c2c2c2" text_color="#959494"/>
|
||||
<over border_color="#338fff"/>
|
||||
</style>
|
||||
</edit>
|
||||
|
||||
|
||||
<spin_box selected_text_color="#010101" selected_bg_color="#b5d7fd">
|
||||
<style name="default" bg_color="#f7f7f7" text_color="#444444" text_align_h="left">
|
||||
<normal border_color="#c2c2c2"/>
|
||||
<focused border_color="#338fff"/>
|
||||
<disable bg_color="#f7f7f766" border_color="#c2c2c266" text_color="#44444466"/>
|
||||
<error border_color="#ff0000"/>
|
||||
<empty border_color="#c2c2c2" text_color="#959494"/>
|
||||
<empty_focus border_color="#c2c2c2" text_color="#959494"/>
|
||||
<over border_color="#338fff"/>
|
||||
<has_value has_value="1"/>
|
||||
</style>
|
||||
</spin_box>
|
||||
|
||||
<digit_clock>
|
||||
<style name="default">
|
||||
<normal text_color="#444444" />
|
||||
</style>
|
||||
</digit_clock>
|
||||
|
||||
<label>
|
||||
<style name="default">
|
||||
<normal text_color="#444444"/>
|
||||
<disable text_color="#44444466"/>
|
||||
</style>
|
||||
</label>
|
||||
|
||||
<progress_bar>
|
||||
<style name="default" round_radius="5">
|
||||
<normal text_color="#444444" bg_color="#d8d8d8" fg_color="#338fff" border_color="#d8d8d8"/>
|
||||
<disable text_color="#44444466" bg_color="#d8d8d866" fg_color="#338fff66" border_color="#d8d8d866"/>
|
||||
</style>
|
||||
</progress_bar>
|
||||
|
||||
<slider>
|
||||
<style name="default" round_radius="5">
|
||||
<normal bg_color="#d8d8d8" fg_color="#338fff" border_color="#bfbfbf"/>
|
||||
<pressed bg_color="#d8d8d8" fg_color="#338fff" border_color="#1456d6"/>
|
||||
<over bg_color="#d8d8d8" fg_color="#338fff" border_color="#54d8ff"/>
|
||||
<focused bg_color="#d8d8d8" fg_color="#338fff" border_color="#54d8ff"/>
|
||||
<disable bg_color="#d8d8d866" fg_color="#338fff66" border_color="#ececec"/>
|
||||
</style>
|
||||
</slider>
|
||||
|
||||
<check_button>
|
||||
<style name="default" icon_at="left" text_color="#444444">
|
||||
<normal icon="check_unchecked" />
|
||||
<pressed icon="check_unchecked" />
|
||||
<over icon="check_unchecked" />
|
||||
<focused icon="check_unchecked" />
|
||||
<disable icon="check_unchecked_d" text_color="#44444466"/>
|
||||
<normal_of_checked icon="check_checked" />
|
||||
<pressed_of_checked icon="check_checked" />
|
||||
<over_of_checked icon="check_checked" />
|
||||
<focused_of_checked icon="check_checked" />
|
||||
<disable_of_checked icon="check_checked_d" text_color="#44444466"/>
|
||||
</style>
|
||||
</check_button>
|
||||
|
||||
<radio_button>
|
||||
<style name="default" text_color="#444444" icon_at="left">
|
||||
<normal icon="radio_unchecked" />
|
||||
<pressed icon="radio_unchecked" />
|
||||
<over icon="radio_unchecked" />
|
||||
<focused icon="radio_unchecked" />
|
||||
<disable icon="radio_unchecked_d" text_color="#44444466"/>
|
||||
<normal_of_checked icon="radio_checked"/>
|
||||
<pressed_of_checked icon="radio_checked"/>
|
||||
<over_of_checked icon="radio_checked"/>
|
||||
<focused_of_checked icon="radio_checked" />
|
||||
<disable_of_checked icon="radio_checked_d" text_color="#44444466"/>
|
||||
</style>
|
||||
</radio_button>
|
||||
|
||||
<image>
|
||||
<style name="default" text_color="#444444">
|
||||
<normal />
|
||||
</style>
|
||||
</image>
|
||||
|
||||
<scroll_bar_m>
|
||||
<style name="default">
|
||||
<normal fg_color="#808080"/>
|
||||
<disable fg_color="#80808066"/>
|
||||
</style>
|
||||
</scroll_bar_m>
|
||||
|
||||
<scroll_bar_d>
|
||||
<style name="default" border_color="#bebebe">
|
||||
<normal bg_color="#f0f0f0"/>
|
||||
<over bg_color="#f0f0f0" />
|
||||
<pressed bg_color="#f0f0f0" />
|
||||
<disable bg_color="#f0f0f066" border_color="#bebebe66"/>
|
||||
</style>
|
||||
</scroll_bar_d>
|
||||
|
||||
<dragger>
|
||||
<style name="default" bg_color="#9e9e9e">
|
||||
<normal />
|
||||
<pressed />
|
||||
<over />
|
||||
</style>
|
||||
<style name="scroll_bar">
|
||||
<normal bg_color="#d0d0d0" />
|
||||
<pressed bg_color="#c0c0c0" />
|
||||
<over bg_color="#c0c0c0" />
|
||||
<disable bg_color="#c0c0c066" />
|
||||
</style>
|
||||
</dragger>
|
||||
|
||||
<list_item>
|
||||
<style name="default" border_color="#e9e9e9" text_color="#444444">
|
||||
<normal bg_color="#ffffff" />
|
||||
<pressed bg_color="#338fff" text_color="#ffffff" />
|
||||
<over bg_color="#ffffff" border_color="#338fff"/>
|
||||
<disable border_color="#e9e9e966" text_color="#44444466"/>
|
||||
</style>
|
||||
</list_item>
|
||||
|
||||
<tab_button>
|
||||
<style name="default" border_color="#c2c2c2" text_color="#444444">
|
||||
<normal bg_color="#f4f4f4" />
|
||||
<pressed bg_color="#cecdcd" />
|
||||
<over bg_color="#ffffff" text_color="#1971dd"/>
|
||||
<normal_of_active bg_color="#ffffff" border="top|left|right"/>
|
||||
<pressed_of_active bg_color="#ffffff" text_color="#1971dd" border="top|left|right"/>
|
||||
<over_of_active bg_color="#ffffff" text_color="#1971dd" border="top|left|right"/>
|
||||
<disable_of_active border_color="#c2c2c266" bg_color="#f4f4f466" text_color="#44444466" border="top|left|right"/>
|
||||
<disable border_color="#c2c2c266" bg_color="#f4f4f466" text_color="#44444466"/>
|
||||
</style>
|
||||
</tab_button>
|
||||
|
||||
<tab_button_group >
|
||||
<style name="default">
|
||||
<normal/>
|
||||
</style>
|
||||
|
||||
<style name="scrollable" border_color="#a0a0a0" border="left|right">
|
||||
<normal/>
|
||||
</style>
|
||||
</tab_button_group>
|
||||
|
||||
|
||||
<combo_box selected_text_color="#010101" selected_bg_color="#b5d7fd">
|
||||
<style name="default" bg_color="#f7f7f7" text_color="#444444" text_align_h="left" border_color="#c2c2c2">
|
||||
<normal border_color="#c2c2c2"/>
|
||||
<focused border_color="#338fff"/>
|
||||
<disable bg_color="#f7f7f766" border_color="#c2c2c266" text_color="#44444466"/>
|
||||
<error border_color="#ff0000"/>
|
||||
<empty border_color="#c2c2c2" text_color="#959494"/>
|
||||
<empty_focus border_color="#c2c2c2" text_color="#959494"/>
|
||||
<over border_color="#338fff"/>
|
||||
</style>
|
||||
</combo_box>
|
||||
|
||||
|
||||
<combo_box_ex selected_text_color="#010101" selected_bg_color="#b5d7fd">
|
||||
<style name="default" bg_color="#f7f7f7" text_color="#444444" text_align_h="left" border_color="#c2c2c2">
|
||||
<normal border_color="#c2c2c2"/>
|
||||
<focused border_color="#338fff"/>
|
||||
<disable bg_color="#f7f7f766" border_color="#c2c2c266" text_color="#44444466"/>
|
||||
<error border_color="#ff0000"/>
|
||||
<empty border_color="#c2c2c2" text_color="#959494"/>
|
||||
<empty_focus border_color="#c2c2c2" text_color="#959494"/>
|
||||
<over border_color="#338fff"/>
|
||||
</style>
|
||||
</combo_box_ex>
|
||||
|
||||
<combo_box_item>
|
||||
<style name="default" icon_at="left" text_color="#444444" bg_color="#ffffff">
|
||||
<normal />
|
||||
<pressed bg_color="#338fff" text_color="#ffffff" />
|
||||
<over bg_color="#1971dd" text_color="#ffffff" />
|
||||
<focused bg_color="#1296db" text_color="#ffffff" />
|
||||
<normal_of_checked bg_color="#338fff" text_color="#ffffff"/>
|
||||
<focused_of_checked bg_color="#338fff" text_color="#ffffff"/>
|
||||
<pressed_of_checked bg_color="#338fff" text_color="#ffffff" />
|
||||
<over_of_checked bg_color="#1971dd" text_color="#ffffff" />
|
||||
<disable_of_checked bg_color="#f4f4f466" text_color="#44444466" />
|
||||
<disable bg_color="#f4f4f466" text_color="#44444466"/>
|
||||
</style>
|
||||
</combo_box_item>
|
||||
|
||||
<text_selector>
|
||||
<style name="default" fg_color="#c2c2c2" text_color="#444444" text_align_h="center" bg_color="#ffffff">
|
||||
<normal mask_color="#404040" border_color="#c2c2c2"/>
|
||||
<disable mask_color="#c0c0c0" border_color="#c2c2c266" text_color="#44444466" />
|
||||
</style>
|
||||
</text_selector>
|
||||
|
||||
<switch>
|
||||
<style name="default" margin="2" round_radius="11" fg_color="#ffffff">
|
||||
<normal bg_color="#828282" selected_bg_color="#338fff"/>
|
||||
<disable bg_color="#82828266" selected_bg_color="#338fff66"/>
|
||||
</style>
|
||||
</switch>
|
||||
|
||||
<slide_indicator>
|
||||
<style name="default">
|
||||
<normal fg_color="#338fff40" selected_fg_color="#338fff"/>
|
||||
<disable fg_color="#338fff20" selected_fg_color="#338fff66"/>
|
||||
</style>
|
||||
</slide_indicator>
|
||||
|
||||
<slide_indicator_arc>
|
||||
<style name="default">
|
||||
<normal fg_color="#338fff40" selected_fg_color="#338fff"/>
|
||||
<disable fg_color="#338fff20" selected_fg_color="#338fff66"/>
|
||||
</style>
|
||||
</slide_indicator_arc>
|
||||
|
||||
|
||||
<progress_circle>
|
||||
<style name="default">
|
||||
<normal text_color="#444444" fg_color="#338fff"/>
|
||||
<disable text_color="#44444466" fg_color="#338fff66"/>
|
||||
</style>
|
||||
</progress_circle>
|
||||
|
||||
<svg>
|
||||
<style name="default" text_color="#444444">
|
||||
<normal/>
|
||||
</style>
|
||||
</svg>
|
||||
|
||||
<gif>
|
||||
<style name="default">
|
||||
<normal/>
|
||||
</style>
|
||||
</gif>
|
||||
|
||||
<slide_menu>
|
||||
<style name="default">
|
||||
<normal/>
|
||||
</style>
|
||||
</slide_menu>
|
||||
|
||||
<mledit selected_fg_color="#020202" selected_text_color="#010101" selected_bg_color="#b5d7fd">
|
||||
<style name="default" border_color="#a0a0a0" text_color="#444444" text_align_h="left">
|
||||
<normal bg_color="#ffffff" />
|
||||
<focused bg_color="#ffffff"/>
|
||||
<disable bg_color="gray" text_color="#44444466" />
|
||||
<error bg_color="#ffffff" text_color="red" />
|
||||
<empty bg_color="#ffffff" text_color="#a0a0a0" />
|
||||
<empty_focus bg_color="#ffffff" text_color="#a0a0a0"/>
|
||||
</style>
|
||||
</mledit>
|
||||
|
||||
<line_number>
|
||||
<style name="default" text_align_h="center">
|
||||
<normal text_color="#444444" bg_color="#d0d0d0"/>
|
||||
<disable text_color="#44444466" bg_color="#d0d0d066"/>
|
||||
</style>
|
||||
</line_number>
|
||||
|
||||
<hscroll_label>
|
||||
<style name="default" text_color="#444444">
|
||||
<normal />
|
||||
<disable text_color="#44444466"/>
|
||||
</style>
|
||||
</hscroll_label>
|
||||
|
||||
<color_tile>
|
||||
<style name="default">
|
||||
<normal border_color="#c2c2c2"/>
|
||||
<focused border_color="#338fff"/>
|
||||
<disable border_color="#c2c2c266"/>
|
||||
</style>
|
||||
</color_tile>
|
||||
|
||||
<view>
|
||||
<style name="default">
|
||||
<normal />
|
||||
</style>
|
||||
</view>
|
||||
|
||||
<tab_control>
|
||||
<style name="default">
|
||||
<normal />
|
||||
</style>
|
||||
</tab_control>
|
||||
|
||||
<scroll_view>
|
||||
<style name="default">
|
||||
<normal />
|
||||
</style>
|
||||
</scroll_view>
|
||||
|
||||
<list_view>
|
||||
<style name="default" border_color="#c2c2c2" bg_color="#f4f4f4">
|
||||
<normal />
|
||||
<disable border_color="#c2c2c266" bg_color="#f4f4f466"/>
|
||||
</style>
|
||||
</list_view>
|
||||
|
||||
<list_view_h>
|
||||
<style name="default" border_color="#c2c2c2" bg_color="#f4f4f4">
|
||||
<normal />
|
||||
<disable border_color="#c2c2c266" bg_color="#f4f4f466"/>
|
||||
</style>
|
||||
</list_view_h>
|
||||
|
||||
<pages>
|
||||
<style name="default" border_color="#c2c2c2">
|
||||
<normal />
|
||||
</style>
|
||||
</pages>
|
||||
|
||||
<slide_view>
|
||||
<style name="default">
|
||||
<normal />
|
||||
</style>
|
||||
</slide_view>
|
||||
|
||||
<color_picker>
|
||||
<style name="default">
|
||||
<normal />
|
||||
</style>
|
||||
</color_picker>
|
||||
|
||||
<color_component>
|
||||
<style name="default" border_color="#c2c2c2">
|
||||
<normal />
|
||||
</style>
|
||||
</color_component>
|
||||
|
||||
<candidates>
|
||||
<style name="default" text_color="#444444" bg_color="#fafafa">
|
||||
<normal />
|
||||
</style>
|
||||
</candidates>
|
@ -0,0 +1,6 @@
|
||||
<qr>
|
||||
<style name="default" >
|
||||
<normal fg_color="black" bg_color="white" bg_image="message"/>
|
||||
<disable fg_color="gray" bg_color="#f0f0f0"/>
|
||||
</style>
|
||||
</qr>
|
@ -0,0 +1,4 @@
|
||||
<window theme="main">
|
||||
<qr x="c" y="m" w="240" h="240" value="https://github.com/zlgopen/awtk"/>
|
||||
<button x="c" y="b:30" w="80" h="30" name="close" text="Close"/>
|
||||
</window>
|
@ -0,0 +1,6 @@
|
||||
### 2021/11/25
|
||||
* 去除没有使用到的宏和变量(感谢兆坤提供补丁)
|
||||
* 修复logo裁剪区域未还原导致的界面显示问题(感谢兆坤提供补丁)
|
||||
|
||||
### 2021/10/26
|
||||
* 中间支持LOGO(感谢兆坤提供补丁)
|
After Width: | Height: | Size: 31 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 9.4 KiB |
After Width: | Height: | Size: 7.9 KiB |
After Width: | Height: | Size: 71 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 58 KiB |
@ -0,0 +1,6 @@
|
||||
find src -name \*.c -exec clang-format -i {} \;
|
||||
find src -name \*.h -exec clang-format -i {} \;
|
||||
find src -name \*.cc -exec clang-format -i {} \;
|
||||
find src -name \*.cpp -exec clang-format -i {} \;
|
||||
find src -name \*.inc -exec clang-format -i {} \;
|
||||
|
@ -0,0 +1,3 @@
|
||||
|
||||
node ../awtk/tools/idl_gen/index.js idl/idl.json src/
|
||||
node ../awtk/tools/dll_def_gen/index.js idl/idl.json src/qr.def
|
@ -0,0 +1,154 @@
|
||||
[
|
||||
{
|
||||
"params": [],
|
||||
"annotation": {
|
||||
"global": true
|
||||
},
|
||||
"desc": "注册控件。",
|
||||
"name": "qr_register",
|
||||
"return": {
|
||||
"type": "ret_t",
|
||||
"desc": "返回RET_OK表示成功,否则表示失败。"
|
||||
},
|
||||
"type": "method",
|
||||
"header": "src/qr_register.h",
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"params": [],
|
||||
"annotation": {
|
||||
"global": true
|
||||
},
|
||||
"desc": "获取支持的渲染模式。",
|
||||
"name": "qr_supported_render_mode",
|
||||
"return": {
|
||||
"type": "const char*",
|
||||
"desc": "返回渲染模式。"
|
||||
},
|
||||
"type": "method",
|
||||
"header": "src/qr_register.h",
|
||||
"level": 1
|
||||
},
|
||||
{
|
||||
"type": "class",
|
||||
"methods": [
|
||||
{
|
||||
"params": [
|
||||
{
|
||||
"type": "widget_t*",
|
||||
"name": "parent",
|
||||
"desc": "父控件"
|
||||
},
|
||||
{
|
||||
"type": "xy_t",
|
||||
"name": "x",
|
||||
"desc": "x坐标"
|
||||
},
|
||||
{
|
||||
"type": "xy_t",
|
||||
"name": "y",
|
||||
"desc": "y坐标"
|
||||
},
|
||||
{
|
||||
"type": "wh_t",
|
||||
"name": "w",
|
||||
"desc": "宽度"
|
||||
},
|
||||
{
|
||||
"type": "wh_t",
|
||||
"name": "h",
|
||||
"desc": "高度"
|
||||
}
|
||||
],
|
||||
"annotation": {
|
||||
"constructor": true,
|
||||
"scriptable": true
|
||||
},
|
||||
"desc": "创建qr对象",
|
||||
"name": "qr_create",
|
||||
"return": {
|
||||
"type": "widget_t*",
|
||||
"desc": "qr对象。"
|
||||
}
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
{
|
||||
"type": "widget_t*",
|
||||
"name": "widget",
|
||||
"desc": "qr对象。"
|
||||
}
|
||||
],
|
||||
"annotation": {
|
||||
"cast": true,
|
||||
"scriptable": true
|
||||
},
|
||||
"desc": "转换为qr对象(供脚本语言使用)。",
|
||||
"name": "qr_cast",
|
||||
"return": {
|
||||
"type": "widget_t*",
|
||||
"desc": "qr对象。"
|
||||
}
|
||||
},
|
||||
{
|
||||
"params": [
|
||||
{
|
||||
"type": "widget_t*",
|
||||
"name": "widget",
|
||||
"desc": "widget对象。"
|
||||
},
|
||||
{
|
||||
"type": "const char*",
|
||||
"name": "value",
|
||||
"desc": "格式字符串。"
|
||||
}
|
||||
],
|
||||
"annotation": {
|
||||
"scriptable": true
|
||||
},
|
||||
"desc": "设置要转成二维码的字符串。",
|
||||
"name": "new_qr_set_value",
|
||||
"return": {
|
||||
"type": "ret_t",
|
||||
"desc": "返回RET_OK表示成功,否则表示失败。"
|
||||
}
|
||||
},
|
||||
{
|
||||
"params": [],
|
||||
"annotation": {},
|
||||
"desc": "获取 qr 虚表。",
|
||||
"name": "qr_get_widget_vtable",
|
||||
"return": {
|
||||
"type": "const widget_vtable_t*",
|
||||
"desc": "成功返回 qr 虚表。"
|
||||
}
|
||||
}
|
||||
],
|
||||
"events": [],
|
||||
"properties": [
|
||||
{
|
||||
"name": "value",
|
||||
"desc": "要转成二维码的字符串。值。",
|
||||
"type": "char*",
|
||||
"annotation": {
|
||||
"set_prop": true,
|
||||
"get_prop": true,
|
||||
"readable": true,
|
||||
"persitent": true,
|
||||
"design": true,
|
||||
"scriptable": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"header": "qr/qr.h",
|
||||
"desc": "显示二维码的控件\nqr\\_t是[widget\\_t](widget_t.md)的子类控件,widget\\_t的函数均适用于qr\\_t控件。\n\n在xml中使用\"qr\"标签创建数值文本控件。如:\n\n```xml\n<!-- ui -->\n<qr x=\"c\" y=\"m\" w=\"240\" h=\"240\" value=\"https://github.com/zlgopen/awtk\"/>\n```\n在c代码中使用函数qr\\_create创建数值文本控件。如:\n\n```c\nwidget_t* qr = qr_create(win, 10, 10, 128, 128);\n```\n可用通过style来设置控件的显示风格,如字体的大小和颜色等等。如:\n\n```xml\n<!-- style -->\n<qr>\n<style name=\"default\" >\n<normal fg_color=\"black\" bg_color=\"white\" bg_image=\"message\"/>\n<disable fg_color=\"gray\" bg_color=\"#f0f0f0\"/>\n</style>\n</qr>\n```",
|
||||
"name": "qr_t",
|
||||
"parent": "widget_t",
|
||||
"annotation": {
|
||||
"scriptable": true,
|
||||
"design": true,
|
||||
"widget": true
|
||||
},
|
||||
"level": 2
|
||||
}
|
||||
]
|
@ -0,0 +1,46 @@
|
||||
{
|
||||
"name": "qr",
|
||||
"version": "1.0.1",
|
||||
"date": "2020-06-01",
|
||||
"team": "AWTK Develop Team",
|
||||
"author": "Li XianJing <xianjimli@hotmail.com>",
|
||||
"desc": "显示二维码的控件",
|
||||
"copyright": "Guangzhou ZHIYUAN Electronics Co.,Ltd.",
|
||||
"type": "PROJECT_CUSTOM_WIDGET",
|
||||
"entry": "main",
|
||||
"assets": {
|
||||
"activedTheme": "default",
|
||||
"outputDir": "res",
|
||||
"loadFrom": "any",
|
||||
"const": "resource_data",
|
||||
"screenDPR": "x1",
|
||||
"defaultLanguage": "zh",
|
||||
"defaultCountry": "CN",
|
||||
"themes": {
|
||||
"default": {
|
||||
"activedSystemBar": "system_bar",
|
||||
"activedBottomSystemBar": "system_bar_b",
|
||||
"packaged": true,
|
||||
"fonts": {
|
||||
"default": {
|
||||
"text": " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~,。?!确定取消"
|
||||
}
|
||||
},
|
||||
"lcd": {
|
||||
"width": "320",
|
||||
"height": "480",
|
||||
"colorDepth": "16bit",
|
||||
"colorFormat": "BGR(A)"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"creator": {
|
||||
"name": "AWTK Designer",
|
||||
"version": "2.0.21"
|
||||
},
|
||||
"awtkRoot": "${AWTK_SDK_PATH}/awtk",
|
||||
"dependencies": {
|
||||
"awtk": ">=2112"
|
||||
}
|
||||
}
|
2
MXC_A27-PCB4.5-270T/lib/awtk/awtk-examples/MOTO_A270S/3rd/awtk-widget-qr/scripts/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
__pycache__
|
||||
*.pyc
|
@ -0,0 +1,7 @@
|
||||
import os
|
||||
import sys
|
||||
APP_SCRIPTS_ROOT = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
print('APP_SCRIPTS_ROOT:' + APP_SCRIPTS_ROOT)
|
||||
|
||||
sys.path.insert(0, APP_SCRIPTS_ROOT)
|
@ -0,0 +1,7 @@
|
||||
import awtk_locator as locator
|
||||
|
||||
def Helper(ARGUMENTS):
|
||||
locator.init(ARGUMENTS)
|
||||
|
||||
from app_helper_base import AppHelperBase
|
||||
return AppHelperBase(ARGUMENTS)
|
@ -0,0 +1,62 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
AWTK_ROOT = ''
|
||||
|
||||
def getAwtkRoot():
|
||||
return AWTK_ROOT
|
||||
|
||||
def getAwtkSDKPath():
|
||||
env = os.environ
|
||||
if 'AWTK_SDK_PATH' in env:
|
||||
return env['AWTK_SDK_PATH']
|
||||
else:
|
||||
return ''
|
||||
|
||||
def getAwtkOrAwtkLinuxFbRoot(is_linux_fb):
|
||||
if is_linux_fb:
|
||||
return locateAWTK('awtk-linux-fb')
|
||||
else:
|
||||
return locateAWTK('awtk')
|
||||
|
||||
def locateAWTK(awtk):
|
||||
awtk_root = ''
|
||||
|
||||
if not os.path.exists(awtk_root):
|
||||
dirnames = ['../'+awtk, '../../'+awtk, '../../../'+awtk]
|
||||
for dirname in dirnames:
|
||||
if os.path.exists(dirname):
|
||||
awtk_root = dirname
|
||||
break
|
||||
|
||||
if not os.path.exists(awtk_root):
|
||||
awtk_sdk_path = getAwtkSDKPath();
|
||||
if os.path.exists(awtk_sdk_path):
|
||||
awtk_root = awtk_sdk_path + '/' + awtk
|
||||
|
||||
return os.path.abspath(awtk_root)
|
||||
|
||||
def init(ARGUMENTS = None):
|
||||
global AWTK_ROOT
|
||||
global LINUX_FB
|
||||
|
||||
if ARGUMENTS:
|
||||
AWTK_ROOT = ARGUMENTS.get('AWTK_ROOT', '')
|
||||
LINUX_FB = ARGUMENTS.get('LINUX_FB', '')
|
||||
else:
|
||||
LINUX_FB = ''
|
||||
|
||||
if not os.path.exists(AWTK_ROOT):
|
||||
AWTK_ROOT = getAwtkOrAwtkLinuxFbRoot(LINUX_FB != '')
|
||||
elif os.path.exists(LINUX_FB):
|
||||
print(' do not set LINUX_FB and AWTK_ROOT !!!')
|
||||
sys.exit()
|
||||
|
||||
if LINUX_FB:
|
||||
AWTK_SCRIPTS_ROOT = os.path.join(AWTK_ROOT, '../awtk/scripts')
|
||||
else:
|
||||
AWTK_SCRIPTS_ROOT = os.path.join(AWTK_ROOT, 'scripts')
|
||||
sys.path.insert(0, AWTK_SCRIPTS_ROOT)
|
||||
|
||||
print('AWTK_ROOT: ' + AWTK_ROOT)
|
||||
print('AWTK_SCRIPTS_ROOT: ' + AWTK_SCRIPTS_ROOT)
|
@ -0,0 +1,41 @@
|
||||
import sys
|
||||
import awtk_locator as locator
|
||||
|
||||
LONGSOPTS = ['awtk_root=', 'AWTK_ROOT=']
|
||||
def get_args(args, longsopts = []) :
|
||||
list_opts = []
|
||||
for arg in args:
|
||||
if arg.startswith('--') :
|
||||
tmp_opt = '';
|
||||
for opt in longsopts:
|
||||
if arg.find(opt) > 0 :
|
||||
tmp_opt = opt;
|
||||
break
|
||||
if tmp_opt != '' :
|
||||
list_opts.append(arg.split(tmp_opt)[1])
|
||||
continue
|
||||
else :
|
||||
print(arg + " not find command, command :")
|
||||
print(longsopts)
|
||||
sys.exit()
|
||||
return list_opts
|
||||
|
||||
|
||||
def update_res(ARGUMENTS, is_new_usage):
|
||||
locator.init(ARGUMENTS)
|
||||
|
||||
import update_res_app as updater
|
||||
if is_new_usage and not hasattr(updater, "getopt") :
|
||||
print(" must update awtk !!!")
|
||||
sys.exit()
|
||||
updater.run(locator.getAwtkRoot())
|
||||
|
||||
is_new_usage = False
|
||||
opts = get_args(sys.argv[1:], LONGSOPTS)
|
||||
ARGUMENTS = dict()
|
||||
if len(opts) > 0 :
|
||||
is_new_usage = True
|
||||
ARGUMENTS['AWTK_ROOT'] = opts[0]
|
||||
else :
|
||||
ARGUMENTS['AWTK_ROOT'] = ''
|
||||
update_res(ARGUMENTS, is_new_usage)
|
@ -0,0 +1,22 @@
|
||||
import os
|
||||
import sys
|
||||
import platform
|
||||
|
||||
OS_NAME = platform.system();
|
||||
LIB_DIR=os.environ['LIB_DIR'];
|
||||
BIN_DIR=os.environ['BIN_DIR'];
|
||||
|
||||
env=DefaultEnvironment().Clone()
|
||||
SOURCES=Glob('qr/*.cpp') + Glob('qr/*.c') + Glob('*.c')
|
||||
|
||||
EXPORT_DEF=''
|
||||
if OS_NAME == 'Windows' and os.environ['TOOLS_NAME'] == '':
|
||||
EXPORT_DEF = ' /DEF:"src/qr.def" '
|
||||
|
||||
if 'BUILD_SHARED' in os.environ and os.environ['BUILD_SHARED'] == 'True':
|
||||
LIBS=['awtk'];
|
||||
LINKFLAGS=env['LINKFLAGS'] + EXPORT_DEF
|
||||
env.SharedLibrary(os.path.join(BIN_DIR, 'qr'), SOURCES, LIBS=LIBS, LINKFLAGS=LINKFLAGS);
|
||||
else:
|
||||
env.Library(os.path.join(LIB_DIR, 'qr'), SOURCES);
|
||||
|
@ -0,0 +1,8 @@
|
||||
LIBRARY qr
|
||||
EXPORTS
|
||||
qr_register
|
||||
qr_supported_render_mode
|
||||
qr_create
|
||||
qr_cast
|
||||
new_qr_set_value
|
||||
qr_get_widget_vtable
|
@ -0,0 +1,229 @@
|
||||
/*
|
||||
* qrencode - QR Code encoder
|
||||
*
|
||||
* Binary sequence class.
|
||||
* Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
# include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "bitstream.h"
|
||||
|
||||
#define DEFAULT_BUFSIZE (128)
|
||||
|
||||
BitStream *BitStream_new(void)
|
||||
{
|
||||
BitStream *bstream;
|
||||
|
||||
bstream = (BitStream *)malloc(sizeof(BitStream));
|
||||
if(bstream == NULL) return NULL;
|
||||
|
||||
bstream->length = 0;
|
||||
bstream->data = (unsigned char *)malloc(DEFAULT_BUFSIZE);
|
||||
if(bstream->data == NULL) {
|
||||
free(bstream);
|
||||
return NULL;
|
||||
}
|
||||
bstream->datasize = DEFAULT_BUFSIZE;
|
||||
|
||||
return bstream;
|
||||
}
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
BitStream *BitStream_newWithBits(size_t size, unsigned char *bits)
|
||||
{
|
||||
BitStream *bstream;
|
||||
|
||||
if(size == 0) return BitStream_new();
|
||||
|
||||
bstream = (BitStream *)malloc(sizeof(BitStream));
|
||||
if(bstream == NULL) return NULL;
|
||||
|
||||
bstream->data = (unsigned char *)malloc(size);
|
||||
if(bstream->data == NULL) {
|
||||
free(bstream);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bstream->length = size;
|
||||
bstream->datasize = size;
|
||||
memcpy(bstream->data, bits, size);
|
||||
|
||||
return bstream;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int BitStream_expand(BitStream *bstream)
|
||||
{
|
||||
unsigned char *data;
|
||||
|
||||
data = (unsigned char *)realloc(bstream->data, bstream->datasize * 2);
|
||||
if(data == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
bstream->data = data;
|
||||
bstream->datasize *= 2;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void BitStream_writeNum(unsigned char *dest, size_t bits, unsigned int num)
|
||||
{
|
||||
unsigned int mask;
|
||||
size_t i;
|
||||
unsigned char *p;
|
||||
|
||||
p = dest;
|
||||
mask = 1U << (bits - 1);
|
||||
for(i = 0; i < bits; i++) {
|
||||
if(num & mask) {
|
||||
*p = 1;
|
||||
} else {
|
||||
*p = 0;
|
||||
}
|
||||
p++;
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
static void BitStream_writeBytes(unsigned char *dest, size_t size, unsigned char *data)
|
||||
{
|
||||
unsigned char mask;
|
||||
size_t i, j;
|
||||
unsigned char *p;
|
||||
|
||||
p = dest;
|
||||
for(i = 0; i < size; i++) {
|
||||
mask = 0x80;
|
||||
for(j = 0; j < 8; j++) {
|
||||
if(data[i] & mask) {
|
||||
*p = 1;
|
||||
} else {
|
||||
*p = 0;
|
||||
}
|
||||
p++;
|
||||
mask = mask >> 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int BitStream_append(BitStream *bstream, BitStream *arg)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if(arg == NULL) {
|
||||
return -1;
|
||||
}
|
||||
if(arg->length == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
while(bstream->length + arg->length > bstream->datasize) {
|
||||
ret = BitStream_expand(bstream);
|
||||
if(ret < 0) return ret;
|
||||
}
|
||||
|
||||
memcpy(bstream->data + bstream->length, arg->data, arg->length);
|
||||
bstream->length += arg->length;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int BitStream_appendNum(BitStream *bstream, size_t bits, unsigned int num)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if(bits == 0) return 0;
|
||||
|
||||
while(bstream->datasize - bstream->length < bits) {
|
||||
ret = BitStream_expand(bstream);
|
||||
if(ret < 0) return ret;
|
||||
}
|
||||
BitStream_writeNum(bstream->data + bstream->length, bits, num);
|
||||
bstream->length += bits;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int BitStream_appendBytes(BitStream *bstream, size_t size, unsigned char *data)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if(size == 0) return 0;
|
||||
|
||||
while(bstream->datasize - bstream->length < size * 8) {
|
||||
ret = BitStream_expand(bstream);
|
||||
if(ret < 0) return ret;
|
||||
}
|
||||
BitStream_writeBytes(bstream->data + bstream->length, size, data);
|
||||
bstream->length += size * 8;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned char *BitStream_toByte(BitStream *bstream)
|
||||
{
|
||||
size_t i, j, size, bytes, oddbits;
|
||||
unsigned char *data, v;
|
||||
unsigned char *p;
|
||||
|
||||
size = BitStream_size(bstream);
|
||||
if(size == 0) {
|
||||
return NULL;
|
||||
}
|
||||
data = (unsigned char *)malloc((size + 7) / 8);
|
||||
if(data == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bytes = size / 8;
|
||||
|
||||
p = bstream->data;
|
||||
for(i = 0; i < bytes; i++) {
|
||||
v = 0;
|
||||
for(j = 0; j < 8; j++) {
|
||||
v = (unsigned char)(v << 1);
|
||||
v |= *p;
|
||||
p++;
|
||||
}
|
||||
data[i] = v;
|
||||
}
|
||||
oddbits = size & 7;
|
||||
if(oddbits > 0) {
|
||||
v = 0;
|
||||
for(j = 0; j < oddbits; j++) {
|
||||
v = (unsigned char)(v << 1);
|
||||
v |= *p;
|
||||
p++;
|
||||
}
|
||||
data[bytes] = (unsigned char)(v << (8 - oddbits));
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void BitStream_free(BitStream *bstream)
|
||||
{
|
||||
if(bstream != NULL) {
|
||||
free(bstream->data);
|
||||
free(bstream);
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* qrencode - QR Code encoder
|
||||
*
|
||||
* Binary sequence class.
|
||||
* Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef BITSTREAM_H
|
||||
#define BITSTREAM_H
|
||||
|
||||
typedef struct {
|
||||
size_t length;
|
||||
size_t datasize;
|
||||
unsigned char *data;
|
||||
} BitStream;
|
||||
|
||||
extern BitStream *BitStream_new(void);
|
||||
#ifdef WITH_TESTS
|
||||
extern BitStream *BitStream_newWithBits(size_t size, unsigned char *bits);
|
||||
#endif
|
||||
extern int BitStream_append(BitStream *bstream, BitStream *arg);
|
||||
extern int BitStream_appendNum(BitStream *bstream, size_t bits, unsigned int num);
|
||||
extern int BitStream_appendBytes(BitStream *bstream, size_t size, unsigned char *data);
|
||||
#define BitStream_size(__bstream__) (__bstream__->length)
|
||||
#define BitStream_reset(__bstream__) (__bstream__->length = 0)
|
||||
extern unsigned char *BitStream_toByte(BitStream *bstream);
|
||||
extern void BitStream_free(BitStream *bstream);
|
||||
|
||||
#endif /* BITSTREAM_H */
|
@ -0,0 +1,13 @@
|
||||
#ifndef QRENCODER_CONFIG_H
|
||||
#define QRENCODER_CONFIG_H
|
||||
|
||||
#include "awtk.h"
|
||||
#include "tkc/mem.h"
|
||||
|
||||
#define STATIC_IN_RELEASE static
|
||||
#define MAJOR_VERSION 4
|
||||
#define MINOR_VERSION 1
|
||||
#define MICRO_VERSION 0
|
||||
#define VERSION "1.0"
|
||||
|
||||
#endif/*QRENCODER_CONFIG_H*/
|
@ -0,0 +1,355 @@
|
||||
/*
|
||||
* qrencode - QR Code encoder
|
||||
*
|
||||
* Masking.
|
||||
* Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
# include "config.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "qrencode.h"
|
||||
#include "qrspec.h"
|
||||
#include "mask.h"
|
||||
|
||||
STATIC_IN_RELEASE int Mask_writeFormatInformation(int width, unsigned char *frame, int mask, QRecLevel level)
|
||||
{
|
||||
unsigned int format;
|
||||
unsigned char v;
|
||||
int i;
|
||||
int blacks = 0;
|
||||
|
||||
format = QRspec_getFormatInfo(mask, level);
|
||||
|
||||
for(i = 0; i < 8; i++) {
|
||||
if(format & 1) {
|
||||
blacks += 2;
|
||||
v = 0x85;
|
||||
} else {
|
||||
v = 0x84;
|
||||
}
|
||||
frame[width * 8 + width - 1 - i] = v;
|
||||
if(i < 6) {
|
||||
frame[width * i + 8] = v;
|
||||
} else {
|
||||
frame[width * (i + 1) + 8] = v;
|
||||
}
|
||||
format= format >> 1;
|
||||
}
|
||||
for(i = 0; i < 7; i++) {
|
||||
if(format & 1) {
|
||||
blacks += 2;
|
||||
v = 0x85;
|
||||
} else {
|
||||
v = 0x84;
|
||||
}
|
||||
frame[width * (width - 7 + i) + 8] = v;
|
||||
if(i == 0) {
|
||||
frame[width * 8 + 7] = v;
|
||||
} else {
|
||||
frame[width * 8 + 6 - i] = v;
|
||||
}
|
||||
format= format >> 1;
|
||||
}
|
||||
|
||||
return blacks;
|
||||
}
|
||||
|
||||
/**
|
||||
* Demerit coefficients.
|
||||
* See Section 8.8.2, pp.45, JIS X0510:2004.
|
||||
*/
|
||||
#define N1 (3)
|
||||
#define N2 (3)
|
||||
#define N3 (40)
|
||||
#define N4 (10)
|
||||
|
||||
#define MASKMAKER(__exp__) \
|
||||
int x, y;\
|
||||
int b = 0;\
|
||||
\
|
||||
for(y = 0; y < width; y++) {\
|
||||
for(x = 0; x < width; x++) {\
|
||||
if(*s & 0x80) {\
|
||||
*d = *s;\
|
||||
} else {\
|
||||
*d = *s ^ ((__exp__) == 0);\
|
||||
}\
|
||||
b += (int)(*d & 1);\
|
||||
s++; d++;\
|
||||
}\
|
||||
}\
|
||||
return b;
|
||||
|
||||
static int Mask_mask0(int width, const unsigned char *s, unsigned char *d)
|
||||
{
|
||||
MASKMAKER((x+y)&1)
|
||||
}
|
||||
|
||||
static int Mask_mask1(int width, const unsigned char *s, unsigned char *d)
|
||||
{
|
||||
MASKMAKER(y&1)
|
||||
}
|
||||
|
||||
static int Mask_mask2(int width, const unsigned char *s, unsigned char *d)
|
||||
{
|
||||
MASKMAKER(x%3)
|
||||
}
|
||||
|
||||
static int Mask_mask3(int width, const unsigned char *s, unsigned char *d)
|
||||
{
|
||||
MASKMAKER((x+y)%3)
|
||||
}
|
||||
|
||||
static int Mask_mask4(int width, const unsigned char *s, unsigned char *d)
|
||||
{
|
||||
MASKMAKER(((y/2)+(x/3))&1)
|
||||
}
|
||||
|
||||
static int Mask_mask5(int width, const unsigned char *s, unsigned char *d)
|
||||
{
|
||||
MASKMAKER(((x*y)&1)+(x*y)%3)
|
||||
}
|
||||
|
||||
static int Mask_mask6(int width, const unsigned char *s, unsigned char *d)
|
||||
{
|
||||
MASKMAKER((((x*y)&1)+(x*y)%3)&1)
|
||||
}
|
||||
|
||||
static int Mask_mask7(int width, const unsigned char *s, unsigned char *d)
|
||||
{
|
||||
MASKMAKER((((x*y)%3)+((x+y)&1))&1)
|
||||
}
|
||||
|
||||
#define maskNum (8)
|
||||
typedef int MaskMaker(int, const unsigned char *, unsigned char *);
|
||||
static MaskMaker *maskMakers[maskNum] = {
|
||||
Mask_mask0, Mask_mask1, Mask_mask2, Mask_mask3,
|
||||
Mask_mask4, Mask_mask5, Mask_mask6, Mask_mask7
|
||||
};
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
unsigned char *Mask_makeMaskedFrame(int width, unsigned char *frame, int mask)
|
||||
{
|
||||
unsigned char *masked;
|
||||
|
||||
masked = (unsigned char *)malloc((size_t)(width * width));
|
||||
if(masked == NULL) return NULL;
|
||||
|
||||
maskMakers[mask](width, frame, masked);
|
||||
|
||||
return masked;
|
||||
}
|
||||
#endif
|
||||
|
||||
unsigned char *Mask_makeMask(int width, unsigned char *frame, int mask, QRecLevel level)
|
||||
{
|
||||
unsigned char *masked;
|
||||
|
||||
if(mask < 0 || mask >= maskNum) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
masked = (unsigned char *)malloc((size_t)(width * width));
|
||||
if(masked == NULL) return NULL;
|
||||
|
||||
maskMakers[mask](width, frame, masked);
|
||||
Mask_writeFormatInformation(width, masked, mask, level);
|
||||
|
||||
return masked;
|
||||
}
|
||||
|
||||
|
||||
//static int n1;
|
||||
//static int n2;
|
||||
//static int n3;
|
||||
//static int n4;
|
||||
|
||||
STATIC_IN_RELEASE int Mask_calcN1N3(int length, int *runLength)
|
||||
{
|
||||
int i;
|
||||
int demerit = 0;
|
||||
int fact;
|
||||
|
||||
for(i = 0; i < length; i++) {
|
||||
if(runLength[i] >= 5) {
|
||||
demerit += N1 + (runLength[i] - 5);
|
||||
//n1 += N1 + (runLength[i] - 5);
|
||||
}
|
||||
if((i & 1)) {
|
||||
if(i >= 3 && i < length-2 && (runLength[i] % 3) == 0) {
|
||||
fact = runLength[i] / 3;
|
||||
if(runLength[i-2] == fact &&
|
||||
runLength[i-1] == fact &&
|
||||
runLength[i+1] == fact &&
|
||||
runLength[i+2] == fact) {
|
||||
if(i == 3 || runLength[i-3] >= 4 * fact) {
|
||||
demerit += N3;
|
||||
//n3 += N3;
|
||||
} else if(i+4 >= length || runLength[i+3] >= 4 * fact) {
|
||||
demerit += N3;
|
||||
//n3 += N3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return demerit;
|
||||
}
|
||||
|
||||
STATIC_IN_RELEASE int Mask_calcN2(int width, unsigned char *frame)
|
||||
{
|
||||
int x, y;
|
||||
unsigned char *p;
|
||||
unsigned char b22, w22;
|
||||
int demerit = 0;
|
||||
|
||||
p = frame + width + 1;
|
||||
for(y = 1; y < width; y++) {
|
||||
for(x = 1; x < width; x++) {
|
||||
b22 = p[0] & p[-1] & p[-width] & p [-width-1];
|
||||
w22 = p[0] | p[-1] | p[-width] | p [-width-1];
|
||||
if((b22 | (w22 ^ 1))&1) {
|
||||
demerit += N2;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
|
||||
return demerit;
|
||||
}
|
||||
|
||||
STATIC_IN_RELEASE int Mask_calcRunLengthH(int width, unsigned char *frame, int *runLength)
|
||||
{
|
||||
int head;
|
||||
int i;
|
||||
unsigned char prev;
|
||||
|
||||
if(frame[0] & 1) {
|
||||
runLength[0] = -1;
|
||||
head = 1;
|
||||
} else {
|
||||
head = 0;
|
||||
}
|
||||
runLength[head] = 1;
|
||||
prev = frame[0];
|
||||
|
||||
for(i = 1; i < width; i++) {
|
||||
if((frame[i] ^ prev) & 1) {
|
||||
head++;
|
||||
runLength[head] = 1;
|
||||
prev = frame[i];
|
||||
} else {
|
||||
runLength[head]++;
|
||||
}
|
||||
}
|
||||
|
||||
return head + 1;
|
||||
}
|
||||
|
||||
STATIC_IN_RELEASE int Mask_calcRunLengthV(int width, unsigned char *frame, int *runLength)
|
||||
{
|
||||
int head;
|
||||
int i;
|
||||
unsigned char prev;
|
||||
|
||||
if(frame[0] & 1) {
|
||||
runLength[0] = -1;
|
||||
head = 1;
|
||||
} else {
|
||||
head = 0;
|
||||
}
|
||||
runLength[head] = 1;
|
||||
prev = frame[0];
|
||||
|
||||
for(i = 1; i < width; i++) {
|
||||
if((frame[i * width] ^ prev) & 1) {
|
||||
head++;
|
||||
runLength[head] = 1;
|
||||
prev = frame[i * width];
|
||||
} else {
|
||||
runLength[head]++;
|
||||
}
|
||||
}
|
||||
|
||||
return head + 1;
|
||||
}
|
||||
|
||||
STATIC_IN_RELEASE int Mask_evaluateSymbol(int width, unsigned char *frame)
|
||||
{
|
||||
int x, y;
|
||||
int demerit = 0;
|
||||
int runLength[QRSPEC_WIDTH_MAX + 1];
|
||||
int length;
|
||||
|
||||
demerit += Mask_calcN2(width, frame);
|
||||
|
||||
for(y = 0; y < width; y++) {
|
||||
length = Mask_calcRunLengthH(width, frame + y * width, runLength);
|
||||
demerit += Mask_calcN1N3(length, runLength);
|
||||
}
|
||||
|
||||
for(x = 0; x < width; x++) {
|
||||
length = Mask_calcRunLengthV(width, frame + x, runLength);
|
||||
demerit += Mask_calcN1N3(length, runLength);
|
||||
}
|
||||
|
||||
return demerit;
|
||||
}
|
||||
|
||||
unsigned char *Mask_mask(int width, unsigned char *frame, QRecLevel level)
|
||||
{
|
||||
int i;
|
||||
unsigned char *mask, *bestMask;
|
||||
int minDemerit = INT_MAX;
|
||||
int blacks;
|
||||
int bratio;
|
||||
int demerit;
|
||||
int w2 = width * width;
|
||||
|
||||
mask = (unsigned char *)malloc((size_t)w2);
|
||||
if(mask == NULL) return NULL;
|
||||
bestMask = (unsigned char *)malloc((size_t)w2);
|
||||
if(bestMask == NULL) {
|
||||
free(mask);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for(i = 0; i < maskNum; i++) {
|
||||
// n1 = n2 = n3 = n4 = 0;
|
||||
demerit = 0;
|
||||
blacks = maskMakers[i](width, frame, mask);
|
||||
blacks += Mask_writeFormatInformation(width, mask, i, level);
|
||||
bratio = (200 * blacks + w2) / w2 / 2; /* (int)(100*blacks/w2+0.5) */
|
||||
demerit = (abs(bratio - 50) / 5) * N4;
|
||||
// n4 = demerit;
|
||||
demerit += Mask_evaluateSymbol(width, mask);
|
||||
// printf("(%d,%d,%d,%d)=%d\n", n1, n2, n3 ,n4, demerit);
|
||||
if(demerit < minDemerit) {
|
||||
minDemerit = demerit;
|
||||
memcpy(bestMask, mask, (size_t)w2);
|
||||
}
|
||||
}
|
||||
free(mask);
|
||||
return bestMask;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* qrencode - QR Code encoder
|
||||
*
|
||||
* Masking.
|
||||
* Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MASK_H
|
||||
#define MASK_H
|
||||
|
||||
extern unsigned char *Mask_makeMask(int width, unsigned char *frame, int mask, QRecLevel level);
|
||||
extern unsigned char *Mask_mask(int width, unsigned char *frame, QRecLevel level);
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
extern int Mask_calcN2(int width, unsigned char *frame);
|
||||
extern int Mask_calcN1N3(int length, int *runLength);
|
||||
extern int Mask_calcRunLengthH(int width, unsigned char *frame, int *runLength);
|
||||
extern int Mask_calcRunLengthV(int width, unsigned char *frame, int *runLength);
|
||||
extern int Mask_evaluateSymbol(int width, unsigned char *frame);
|
||||
extern int Mask_writeFormatInformation(int width, unsigned char *frame, int mask, QRecLevel level);
|
||||
extern unsigned char *Mask_makeMaskedFrame(int width, unsigned char *frame, int mask);
|
||||
#endif
|
||||
|
||||
#endif /* MASK_H */
|
@ -0,0 +1,175 @@
|
||||
/*
|
||||
* qrencode - QR Code encoder
|
||||
*
|
||||
* Masking for Micro QR Code.
|
||||
* Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
# include "config.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "qrencode.h"
|
||||
#include "mqrspec.h"
|
||||
#include "mmask.h"
|
||||
|
||||
STATIC_IN_RELEASE void MMask_writeFormatInformation(int version, int width, unsigned char *frame, int mask, QRecLevel level)
|
||||
{
|
||||
unsigned int format;
|
||||
unsigned char v;
|
||||
int i;
|
||||
|
||||
format = MQRspec_getFormatInfo(mask, version, level);
|
||||
|
||||
for(i = 0; i < 8; i++) {
|
||||
v = 0x84 | (format & 1);
|
||||
frame[width * (i + 1) + 8] = v;
|
||||
format = format >> 1;
|
||||
}
|
||||
for(i = 0; i < 7; i++) {
|
||||
v = 0x84 | (format & 1);
|
||||
frame[width * 8 + 7 - i] = v;
|
||||
format = format >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
#define MASKMAKER(__exp__) \
|
||||
int x, y;\
|
||||
\
|
||||
for(y = 0; y < width; y++) {\
|
||||
for(x = 0; x < width; x++) {\
|
||||
if(*s & 0x80) {\
|
||||
*d = *s;\
|
||||
} else {\
|
||||
*d = *s ^ ((__exp__) == 0);\
|
||||
}\
|
||||
s++; d++;\
|
||||
}\
|
||||
}
|
||||
|
||||
static void Mask_mask0(int width, const unsigned char *s, unsigned char *d)
|
||||
{
|
||||
MASKMAKER(y&1)
|
||||
}
|
||||
|
||||
static void Mask_mask1(int width, const unsigned char *s, unsigned char *d)
|
||||
{
|
||||
MASKMAKER(((y/2)+(x/3))&1)
|
||||
}
|
||||
|
||||
static void Mask_mask2(int width, const unsigned char *s, unsigned char *d)
|
||||
{
|
||||
MASKMAKER((((x*y)&1)+(x*y)%3)&1)
|
||||
}
|
||||
|
||||
static void Mask_mask3(int width, const unsigned char *s, unsigned char *d)
|
||||
{
|
||||
MASKMAKER((((x+y)&1)+((x*y)%3))&1)
|
||||
}
|
||||
|
||||
#define maskNum (4)
|
||||
typedef void MaskMaker(int, const unsigned char *, unsigned char *);
|
||||
static MaskMaker *maskMakers[maskNum] = {
|
||||
Mask_mask0, Mask_mask1, Mask_mask2, Mask_mask3
|
||||
};
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
unsigned char *MMask_makeMaskedFrame(int width, unsigned char *frame, int mask)
|
||||
{
|
||||
unsigned char *masked;
|
||||
|
||||
masked = (unsigned char *)malloc((size_t)(width * width));
|
||||
if(masked == NULL) return NULL;
|
||||
|
||||
maskMakers[mask](width, frame, masked);
|
||||
|
||||
return masked;
|
||||
}
|
||||
#endif
|
||||
|
||||
unsigned char *MMask_makeMask(int version, unsigned char *frame, int mask, QRecLevel level)
|
||||
{
|
||||
unsigned char *masked;
|
||||
int width;
|
||||
|
||||
if(mask < 0 || mask >= maskNum) {
|
||||
errno = EINVAL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
width = MQRspec_getWidth(version);
|
||||
masked = (unsigned char *)malloc((size_t)(width * width));
|
||||
if(masked == NULL) return NULL;
|
||||
|
||||
maskMakers[mask](width, frame, masked);
|
||||
MMask_writeFormatInformation(version, width, masked, mask, level);
|
||||
|
||||
return masked;
|
||||
}
|
||||
|
||||
STATIC_IN_RELEASE int MMask_evaluateSymbol(int width, unsigned char *frame)
|
||||
{
|
||||
int x, y;
|
||||
unsigned char *p;
|
||||
int sum1 = 0, sum2 = 0;
|
||||
|
||||
p = frame + width * (width - 1);
|
||||
for(x = 1; x < width; x++) {
|
||||
sum1 += (p[x] & 1);
|
||||
}
|
||||
|
||||
p = frame + width * 2 - 1;
|
||||
for(y = 1; y < width; y++) {
|
||||
sum2 += (*p & 1);
|
||||
p += width;
|
||||
}
|
||||
|
||||
return (sum1 <= sum2)?(sum1 * 16 + sum2):(sum2 * 16 + sum1);
|
||||
}
|
||||
|
||||
unsigned char *MMask_mask(int version, unsigned char *frame, QRecLevel level)
|
||||
{
|
||||
int i;
|
||||
unsigned char *mask, *bestMask;
|
||||
int maxScore = 0;
|
||||
int score;
|
||||
int width;
|
||||
|
||||
width = MQRspec_getWidth(version);
|
||||
|
||||
mask = (unsigned char *)malloc((size_t)(width * width));
|
||||
if(mask == NULL) return NULL;
|
||||
bestMask = NULL;
|
||||
|
||||
for(i = 0; i < maskNum; i++) {
|
||||
score = 0;
|
||||
maskMakers[i](width, frame, mask);
|
||||
MMask_writeFormatInformation(version, width, mask, i, level);
|
||||
score = MMask_evaluateSymbol(width, mask);
|
||||
if(score > maxScore) {
|
||||
maxScore = score;
|
||||
free(bestMask);
|
||||
bestMask = mask;
|
||||
mask = (unsigned char *)malloc((size_t)(width * width));
|
||||
if(mask == NULL) break;
|
||||
}
|
||||
}
|
||||
free(mask);
|
||||
return bestMask;
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* qrencode - QR Code encoder
|
||||
*
|
||||
* Masking for Micro QR Code.
|
||||
* Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef MMASK_H
|
||||
#define MMASK_H
|
||||
|
||||
extern unsigned char *MMask_makeMask(int version, unsigned char *frame, int mask, QRecLevel level);
|
||||
extern unsigned char *MMask_mask(int version, unsigned char *frame, QRecLevel level);
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
extern int MMask_evaluateSymbol(int width, unsigned char *frame);
|
||||
extern void MMask_writeFormatInformation(int version, int width, unsigned char *frame, int mask, QRecLevel level);
|
||||
extern unsigned char *MMask_makeMaskedFrame(int width, unsigned char *frame, int mask);
|
||||
#endif
|
||||
|
||||
#endif /* MMASK_H */
|
@ -0,0 +1,230 @@
|
||||
/*
|
||||
* qrencode - QR Code encoder
|
||||
*
|
||||
* Micro QR Code specification in convenient format.
|
||||
* Copyright (C) 2006-2017 Kentaro Fukuchi <kentaro@fukuchi.org>
|
||||
*
|
||||
* The following data / specifications are taken from
|
||||
* "Two dimensional symbol -- QR-code -- Basic Specification" (JIS X0510:2004)
|
||||
* or
|
||||
* "Automatic identification and data capture techniques --
|
||||
* QR Code 2005 bar code symbology specification" (ISO/IEC 18004:2006)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
# include "config.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "mqrspec.h"
|
||||
|
||||
/******************************************************************************
|
||||
* Version and capacity
|
||||
*****************************************************************************/
|
||||
|
||||
typedef struct {
|
||||
int width; ///< Edge length of the symbol
|
||||
int ec[4]; ///< Number of ECC code (bytes)
|
||||
} MQRspec_Capacity;
|
||||
|
||||
/**
|
||||
* Table of the capacity of symbols
|
||||
* See Table 1 (pp.106) and Table 8 (pp.113) of Appendix 1, JIS X0510:2004.
|
||||
*/
|
||||
static const MQRspec_Capacity mqrspecCapacity[MQRSPEC_VERSION_MAX + 1] = {
|
||||
{ 0, {0, 0, 0, 0}},
|
||||
{ 11, {2, 0, 0, 0}},
|
||||
{ 13, {5, 6, 0, 0}},
|
||||
{ 15, {6, 8, 0, 0}},
|
||||
{ 17, {8, 10, 14, 0}}
|
||||
};
|
||||
|
||||
int MQRspec_getDataLengthBit(int version, QRecLevel level)
|
||||
{
|
||||
int w;
|
||||
int ecc;
|
||||
|
||||
w = mqrspecCapacity[version].width - 1;
|
||||
ecc = mqrspecCapacity[version].ec[level];
|
||||
if(ecc == 0) return 0;
|
||||
return w * w - 64 - ecc * 8;
|
||||
}
|
||||
|
||||
int MQRspec_getDataLength(int version, QRecLevel level)
|
||||
{
|
||||
return (MQRspec_getDataLengthBit(version, level) + 4) / 8;
|
||||
}
|
||||
|
||||
int MQRspec_getECCLength(int version, QRecLevel level)
|
||||
{
|
||||
return mqrspecCapacity[version].ec[level];
|
||||
}
|
||||
|
||||
int MQRspec_getWidth(int version)
|
||||
{
|
||||
return mqrspecCapacity[version].width;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Length indicator
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* See Table 3 (pp.107) of Appendix 1, JIS X0510:2004.
|
||||
*/
|
||||
static const int lengthTableBits[4][4] = {
|
||||
{ 3, 4, 5, 6},
|
||||
{ 0, 3, 4, 5},
|
||||
{ 0, 0, 4, 5},
|
||||
{ 0, 0, 3, 4}
|
||||
};
|
||||
|
||||
int MQRspec_lengthIndicator(QRencodeMode mode, int version)
|
||||
{
|
||||
return lengthTableBits[mode][version - 1];
|
||||
}
|
||||
|
||||
int MQRspec_maximumWords(QRencodeMode mode, int version)
|
||||
{
|
||||
int bits;
|
||||
int words;
|
||||
|
||||
bits = lengthTableBits[mode][version - 1];
|
||||
words = (1 << bits) - 1;
|
||||
if(mode == QR_MODE_KANJI) {
|
||||
words *= 2; // the number of bytes is required
|
||||
}
|
||||
|
||||
return words;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Format information
|
||||
*****************************************************************************/
|
||||
|
||||
/* See calcFormatInfo in tests/test_mqrspec.c */
|
||||
static const unsigned int formatInfo[4][8] = {
|
||||
{0x4445, 0x55ae, 0x6793, 0x7678, 0x06de, 0x1735, 0x2508, 0x34e3},
|
||||
{0x4172, 0x5099, 0x62a4, 0x734f, 0x03e9, 0x1202, 0x203f, 0x31d4},
|
||||
{0x4e2b, 0x5fc0, 0x6dfd, 0x7c16, 0x0cb0, 0x1d5b, 0x2f66, 0x3e8d},
|
||||
{0x4b1c, 0x5af7, 0x68ca, 0x7921, 0x0987, 0x186c, 0x2a51, 0x3bba}
|
||||
};
|
||||
|
||||
/* See Table 10 of Appendix 1. (pp.115) */
|
||||
static const int typeTable[MQRSPEC_VERSION_MAX + 1][3] = {
|
||||
{-1, -1, -1},
|
||||
{ 0, -1, -1},
|
||||
{ 1, 2, -1},
|
||||
{ 3, 4, -1},
|
||||
{ 5, 6, 7}
|
||||
};
|
||||
|
||||
unsigned int MQRspec_getFormatInfo(int mask, int version, QRecLevel level)
|
||||
{
|
||||
int type;
|
||||
|
||||
if(mask < 0 || mask > 3) return 0;
|
||||
if(version <= 0 || version > MQRSPEC_VERSION_MAX) return 0;
|
||||
if(level == QR_ECLEVEL_H) return 0;
|
||||
type = typeTable[version][level];
|
||||
if(type < 0) return 0;
|
||||
|
||||
return formatInfo[mask][type];
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* Frame
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* Put a finder pattern.
|
||||
* @param frame
|
||||
* @param width
|
||||
* @param ox,oy upper-left coordinate of the pattern
|
||||
*/
|
||||
static void putFinderPattern(unsigned char *frame, int width, int ox, int oy)
|
||||
{
|
||||
static const unsigned char finder[] = {
|
||||
0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1,
|
||||
0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc1,
|
||||
0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1,
|
||||
0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1,
|
||||
0xc1, 0xc0, 0xc1, 0xc1, 0xc1, 0xc0, 0xc1,
|
||||
0xc1, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc1,
|
||||
0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1, 0xc1,
|
||||
};
|
||||
int x, y;
|
||||
const unsigned char *s;
|
||||
|
||||
frame += oy * width + ox;
|
||||
s = finder;
|
||||
for(y = 0; y < 7; y++) {
|
||||
for(x = 0; x < 7; x++) {
|
||||
frame[x] = s[x];
|
||||
}
|
||||
frame += width;
|
||||
s += 7;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned char *MQRspec_createFrame(int version)
|
||||
{
|
||||
unsigned char *frame, *p, *q;
|
||||
int width;
|
||||
int x, y;
|
||||
|
||||
width = mqrspecCapacity[version].width;
|
||||
frame = (unsigned char *)malloc((size_t)(width * width));
|
||||
if(frame == NULL) return NULL;
|
||||
|
||||
memset(frame, 0, (size_t)(width * width));
|
||||
/* Finder pattern */
|
||||
putFinderPattern(frame, width, 0, 0);
|
||||
/* Separator */
|
||||
p = frame;
|
||||
for(y = 0; y < 7; y++) {
|
||||
p[7] = 0xc0;
|
||||
p += width;
|
||||
}
|
||||
memset(frame + width * 7, 0xc0, 8);
|
||||
/* Mask format information area */
|
||||
memset(frame + width * 8 + 1, 0x84, 8);
|
||||
p = frame + width + 8;
|
||||
for(y = 0; y < 7; y++) {
|
||||
*p = 0x84;
|
||||
p += width;
|
||||
}
|
||||
/* Timing pattern */
|
||||
p = frame + 8;
|
||||
q = frame + width * 8;
|
||||
for(x = 1; x < width-7; x++) {
|
||||
*p = 0x90 | (x & 1);
|
||||
*q = 0x90 | (x & 1);
|
||||
p++;
|
||||
q += width;
|
||||
}
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
unsigned char *MQRspec_newFrame(int version)
|
||||
{
|
||||
if(version < 1 || version > MQRSPEC_VERSION_MAX) return NULL;
|
||||
|
||||
return MQRspec_createFrame(version);
|
||||
}
|