📄 carl.c
字号:
#include "main.h"
#include "excel2000.h"
#include "excelreport.h"
#include <utility.h>
#include "hp8648a.h"
#include "age441x.h"
#include <formatio.h>
#include <ansi_c.h>
#include <userint.h>
#include <visa.h>
#include "inifile.h"
//add by carl
#define FreqNum 19
extern stop;
extern micheck_state;
extern language;
extern char battery_capacity[100];
extern char mac_temp[300];
extern int testitemnum,calibrationnum,boardnum;
extern char teststarttimebuf[20][40];
extern char teststoptimebuf[20][40];
extern int module_number;
extern char *bsp,*dspp,*mcuu,*fpgaa;
char *EXCEL_ARRAY_OF_CELLS="C2::H11";
VARIANT MyCellRangeV;
VARIANT *vArray = NULL;
LPSAFEARRAY MySafeArray = NULL;
HRESULT error = 0;
#include <ansi_c.h>
#include <stdio.h>
#include <string.h>
//#include "Istate.h"
#define MD 5
#define S11 7
#define S12 12
#define S13 17
#define S14 22
#define S21 5
#define S22 9
#define S23 14
#define S24 20
#define S31 4
#define S32 11
#define S33 16
#define S34 23
#define S41 6
#define S42 10
#define S43 15
#define S44 21
static int excelLaunched = 0;
static HRESULT status;
static ExcelObj_App ExcelAppHandle = 0;
static ExcelObj_Workbooks ExcelWorkbooksHandle = 0;
static ExcelObj_Workbook ExcelWorkbookHandle = 0;
static ExcelObj_Sheets ExcelSheetsHandle = 0;
static ExcelObj_Worksheet ExcelWorksheetHandle = 0;
static ERRORINFO ErrorInfo;
extern char labeltemp[300];
extern char username[40];
extern int UK6,AMFM,ASKFSK;
int showmessage(int i);
/* F, G, H and I are basic MD5 functions.
*/
#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
#define H(x, y, z) ((x) ^ (y) ^ (z))
#define I(x, y, z) ((y) ^ ((x) | (~z)))
/* ROTATE_LEFT rotates x left n bits.
*/
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
/* FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4.
Rotation is separate from addition to prevent recomputation.
*/
#define FF(a, b, c, d, x, s, ac) { (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }
#define GG(a, b, c, d, x, s, ac) { (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }
#define HH(a, b, c, d, x, s, ac) { (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }
#define II(a, b, c, d, x, s, ac) { (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }
/* POINTER defines a generic pointer type */
typedef unsigned char *POINTER;
/* UINT2 defines a two byte word */
typedef unsigned short int UINT2;
/* UINT4 defines a four byte word */
typedef unsigned long int UINT4;
//int excelLaunched=0;
typedef struct {
UINT4 state[4]; /* state (ABCD) */
UINT4 count[2]; /* number of bits, modulo 2^64 (lsb first) */
unsigned char buffer[64]; /* input buffer */
} MD5_CTX;
void MD5Init (MD5_CTX *context);
void MD5Update (MD5_CTX *context, unsigned char *input, unsigned int inputLen);
void MD5Final (unsigned char digest[16], MD5_CTX *context);
static void MD5Print(POINTER digest);
static void MD5Transform (UINT4 state[4],unsigned char block[64]);
static void Encode (unsigned char *output,UINT4 *input,unsigned int len);
static void Decode (UINT4 *output,unsigned char *input,unsigned int len);
static void MD5_memcpy (POINTER output,POINTER input,unsigned int len);
static void MD5_memset (POINTER output,int value,unsigned int len);
static unsigned char PADDING[64] =
{
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
extern char DataDirName[MAX_PATHNAME_LEN];
extern char* testitemname[200];
extern char serial[60];
extern char username[40];
int powermetercal=0;
static int ShutdownExcel(void);
int serial_judgement_HY(char *sHY,char *sRF,char *sCT,char *sKB)
{
char cellrange[300];
int error;
int status;
int filesize,exist ;
char position[20][80];
int rownumber;
char excelfilename[300];
char temp[300];
sprintf(excelfilename,"%s\\%s",DataDirName,"Boutput_record_file.xls");
//connect excel
SetWaitCursor (1);
error = Excel_NewApp (NULL, 0, LOCALE_NEUTRAL, 0, &ExcelAppHandle);
SetWaitCursor (0);
if (error<0)
{
goto quitexcel;
}
error = Excel_SetProperty (ExcelAppHandle, NULL, Excel_AppVisible, CAVT_BOOL, VFALSE);
if (error<0)
{
goto quitexcel;
}
MakeApplicationActive ();
excelLaunched = 1;
error = Excel_GetProperty (ExcelAppHandle, NULL, Excel_AppWorkbooks,
CAVT_OBJHANDLE, &ExcelWorkbooksHandle);
if (error<0)
{
goto quitexcel;
}
exist = GetFileInfo (excelfilename, &filesize);
if (exist==0)
{
MessagePopup(""," N9340B 产出excel表未找到 \n");
goto quitexcel;
}
if (exist==1)
{
error = Excel_WorkbooksOpen (ExcelWorkbooksHandle, NULL, excelfilename, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, &ExcelWorkbookHandle);
}
error = Excel_GetProperty (ExcelAppHandle, NULL, Excel_AppSheets,
CAVT_OBJHANDLE, &ExcelSheetsHandle);
error = Excel_SheetsItem (ExcelSheetsHandle, NULL, CA_VariantInt(1),
&ExcelWorksheetHandle);
error = Excel_WorksheetActivate (ExcelWorksheetHandle, NULL);
status = ExcelRpt_Find (ExcelWorksheetHandle, ExRConst_dataString, sHY, "A1", ExRConst_Values, ExRConst_Whole,
ExRConst_ByColumns, ExRConst_Next, 1, 1, cellrange);
if (status>=0)
rownumber = strtol (&cellrange[3], NULL, 10);
if (rownumber >= 1)
{
status = ConfirmPopup ("", "此整机序列号以出货,是否重新发货?\n");
if (status == 0)
goto quitexcel;
}
status = ExcelRpt_Find (ExcelWorksheetHandle, ExRConst_dataString, sRF, "B1", ExRConst_Values, ExRConst_Whole,
ExRConst_ByColumns, ExRConst_Next, 1, 1, cellrange);
if (status>=0)
rownumber = strtol (&cellrange[3], NULL, 10);
if (rownumber >= 1)
{
status = ConfirmPopup ("", "此射频板序列号以出货,是否重新发货?\n");
if (status == 0)
goto quitexcel;
}
status = ExcelRpt_Find (ExcelWorksheetHandle, ExRConst_dataString, sCT, "C1", ExRConst_Values, ExRConst_Whole,
ExRConst_ByColumns, ExRConst_Next, 1, 1, cellrange);
if (status>=0)
rownumber = strtol (&cellrange[3], NULL, 10);
if (rownumber >= 1)
{
status = ConfirmPopup ("", "此控制板序列号以出货,是否重新发货?\n");
if (status == 0)
goto quitexcel;
}
status = ExcelRpt_Find (ExcelWorksheetHandle, ExRConst_dataString, sKB, "D1", ExRConst_Values, ExRConst_Whole,
ExRConst_ByColumns, ExRConst_Next, 1, 1, cellrange);
if (status>=0)
rownumber = strtol (&cellrange[3], NULL, 10);
if (rownumber >= 1)
{
status = ConfirmPopup ("", "此按键板序列号以出货,是否重新发货?\n");
if (status == 0)
goto quitexcel;
}
SetWaitCursor (1);
//if (exist==1)
// Excel_WorkbookSave (ExcelWorkbookHandle, NULL);
ShutdownExcel();
Delay(0.5);
SetWaitCursor (0);
return 1;
//quit file
quitexcel:
ShutdownExcel();
Delay(0.5);
SetWaitCursor (0);
return 0;
}
int serial_judgement_Module(char *sHY,char *sRF,char *sCT,char *sKB)
{
char cellrange[300];
int error;
int status;
int filesize,exist ;
char position[20][80];
int rownumber;
char excelfilename[300];
char temp[300];
sprintf(excelfilename,"%s\\%s",DataDirName,"module_output_record_file.xls");
//connect excel
SetWaitCursor (1);
error = Excel_NewApp (NULL, 0, LOCALE_NEUTRAL, 0, &ExcelAppHandle);
SetWaitCursor (0);
if (error<0)
{
goto quitexcel;
}
error = Excel_SetProperty (ExcelAppHandle, NULL, Excel_AppVisible, CAVT_BOOL, VFALSE);
if (error<0)
{
goto quitexcel;
}
MakeApplicationActive ();
excelLaunched = 1;
error = Excel_GetProperty (ExcelAppHandle, NULL, Excel_AppWorkbooks,
CAVT_OBJHANDLE, &ExcelWorkbooksHandle);
if (error<0)
{
goto quitexcel;
}
exist = GetFileInfo (excelfilename, &filesize);
if (exist==0)
{
MessagePopup(""," N9340B 模组产出excel表未找到 \n");
goto quitexcel;
}
if (exist==1)
{
error = Excel_WorkbooksOpen (ExcelWorkbooksHandle, NULL, excelfilename, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, CA_DEFAULT_VAL,
CA_DEFAULT_VAL, &ExcelWorkbookHandle);
}
error = Excel_GetProperty (ExcelAppHandle, NULL, Excel_AppSheets,
CAVT_OBJHANDLE, &ExcelSheetsHandle);
error = Excel_SheetsItem (ExcelSheetsHandle, NULL, CA_VariantInt(1),
&ExcelWorksheetHandle);
error = Excel_WorksheetActivate (ExcelWorksheetHandle, NULL);
status = ExcelRpt_Find (ExcelWorksheetHandle, ExRConst_dataString, sHY, "A1", ExRConst_Values, ExRConst_Whole,
ExRConst_ByColumns, ExRConst_Next, 1, 1, cellrange);
if (status>=0)
rownumber = strtol (&cellrange[3], NULL, 10);
if (rownumber >= 1)
{
status = ConfirmPopup ("", "此整机序列号以出货,是否重新发货?\n");
if (status == 0)
goto quitexcel;
}
status = ExcelRpt_Find (ExcelWorksheetHandle, ExRConst_dataString, sRF, "B1", ExRConst_Values, ExRConst_Whole,
ExRConst_ByColumns, ExRConst_Next, 1, 1, cellrange);
if (status>=0)
rownumber = strtol (&cellrange[3], NULL, 10);
if (rownumber >= 1)
{
status = ConfirmPopup ("", "此射频板序列号以出货,是否重新发货?\n");
if (status == 0)
goto quitexcel;
}
status = ExcelRpt_Find (ExcelWorksheetHandle, ExRConst_dataString, sCT, "C1", ExRConst_Values, ExRConst_Whole,
ExRConst_ByColumns, ExRConst_Next, 1, 1, cellrange);
if (status>=0)
rownumber = strtol (&cellrange[3], NULL, 10);
if (rownumber >= 1)
{
status = ConfirmPopup ("", "此控制板序列号以出货,是否重新发货?\n");
if (status == 0)
goto quitexcel;
}
status = ExcelRpt_Find (ExcelWorksheetHandle, ExRConst_dataString, sKB, "D1", ExRConst_Values, ExRConst_Whole,
ExRConst_ByColumns, ExRConst_Next, 1, 1, cellrange);
if (status>=0)
rownumber = strtol (&cellrange[3], NULL, 10);
if (rownumber >= 1)
{
status = ConfirmPopup ("", "此按键板序列号以出货,是否重新发货?\n");
if (status == 0)
goto quitexcel;
}
SetWaitCursor (1);
//if (exist==1)
// Excel_WorkbookSave (ExcelWorkbookHandle, NULL);
ShutdownExcel();
Delay(0.5);
SetWaitCursor (0);
return 1;
//quit file
quitexcel:
ShutdownExcel();
Delay(0.5);
SetWaitCursor (0);
return 0;
}
int AMD_DMD_judge(char *serial)
{
char temp[300];
//am/fm judge
{
fpos_t currentpo,currentpo2;
int handle;
FILE *stream;
sprintf(temp,"%s\\%s\\%s",DataDirName, serial,"AM_FM.txt");
stream = fopen (temp, "r");
if (stream==NULL)
goto amfmend;
fseek (stream, 0, SEEK_END);
fgetpos (stream, ¤tpo);
fseek (stream, 0, SEEK_SET);
fgets (temp, 50, stream);
fgetpos (stream, ¤tpo2);
while (currentpo2._offset != currentpo._offset)
{
fgets (temp, 50, stream);
fgetpos (stream, ¤tpo2);
}
amfmend:
if ( CompareStrings(temp,0,"Test Result:PASS.\n",0,1)!=0 )
{
MessagePopup(""," AM/FM 测试未完成 ");
return 0;
}
}
//ASK judge
{
fpos_t currentpo,currentpo2;
int handle;
FILE *stream;
sprintf(temp,"%s\\%s\\%s",DataDirName, serial,"ask.txt");
stream = fopen (temp, "r");
if (stream==NULL)
goto ASKend;
fseek (stream, 0, SEEK_END);
fgetpos (stream, ¤tpo);
fseek (stream, 0, SEEK_SET);
fgets (temp, 50, stream);
fgetpos (stream, ¤tpo2);
while (currentpo2._offset != currentpo._offset)
{
fgets (temp, 50, stream);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -