Beispiel #1
0
void post_cmd(u16 index, u16 cmd)
{
	en_lcd_index();
	post_data(index);
	en_lcd_data();
	post_data(cmd);
}
/** \brief compare 2 objects (ala memcmp) - as in rfc2616.3.2.3
 * 
 * - it return a value <  0 if the local object is less than the external one
 * - it return a value == 0 if the local object is equal to the external one
 * - it return a value >  0 if the local object is greater than the external one
 */
int http_sresp_ctx_t::compare(const http_sresp_ctx_t & other)  const throw()
{
	// handle the case where at least one is null
	if(  is_null() && !other.is_null() )	return -1;
	if( !is_null() &&  other.is_null() )	return +1;
	if(  is_null() &&  other.is_null() )	return  0;
	// NOTE: here both are NOT null
	
	// compare the reqhd
	if( reqhd()	< other.reqhd() )	return -1;
	if( reqhd()	> other.reqhd() )	return +1;

	// compare the rephd
	if( rephd()	< other.rephd() )	return -1;
	if( rephd()	> other.rephd() )	return +1;

	// compare the post_data
	if( post_data()	< other.post_data() )	return -1;
	if( post_data()	> other.post_data() )	return +1;

	// compare the response_body
	if( response_body().str()	< other.response_body().str() )	return -1;
	if( response_body().str()	> other.response_body().str() )	return +1;
	
	// note: here both are considered equal
	return 0;
}
Beispiel #3
0
u8 draw_lcd(void)
{
	u8 n;
	init_lcd_spi();
	en_lcd();
	if(touch_counter==0){
		return 0;
	}
	
	touch_counter--;

	post_cmd(0x210,touch_xy_buffer[touch_rd_index].x);
	post_cmd(0x212,touch_xy_buffer[touch_rd_index].y);
	post_cmd(0x211,touch_xy_buffer[touch_rd_index].x+(DOT_WIDTH-1));
	post_cmd(0x213,touch_xy_buffer[touch_rd_index].y+(DOT_WIDTH-1));
	if(touch_rd_index < (TOUCH_MAX_CACHE-1)){
		touch_rd_index++;
	}else{
		touch_rd_index = 0;
	}
	//post_cmd(0x0005,0x0010);

	en_lcd_index();
	post_data(0x202);
	en_lcd_data();
	for(n=0; n< (DOT_WIDTH*DOT_WIDTH); n++)
	{
		post_data(COLOR_BLACK);
	}
	dis_lcd();
	return 1;
}
Beispiel #4
0
void LCD_test(void)
{
	u16  temp,num;
	u8 n,i;

	en_lcd();	

	post_cmd(0x210,0x00);
	post_cmd(0x212,0x0000);
	post_cmd(0x211,0xEF);
	post_cmd(0x213,0x013F);
	
	post_cmd(0x200,0x0000);
	post_cmd(0x201,0x0000);

	en_lcd_index();
	post_data(0x202);
	en_lcd_data();
	for(n=0;n<8;n++)
	{
	    temp=colorfol[n];
		for(num=40*240;num>0;num--)
		{
			post_data(temp);
		}
	}
	bcm2835_delay(500);
	for(n=0;n<1;n++)
	{
		post_cmd(0x210,0x00);
		post_cmd(0x212,0x0000);
		post_cmd(0x211,0xEF);
		post_cmd(0x213,0x013F);

		post_cmd(0x200,0x0000);
		post_cmd(0x201,0x0000);
		
		en_lcd_index();
		post_data(0x202);
		en_lcd_data();
	    temp=colorfol[n];
		for(i=0;i<240;i++)
		{
			for(num=0;num<320;num++)
			{
		  		post_data(temp);
			}
		}
	//	bcm2835_delay(50);
	}
	dis_lcd();
}
/** \brief Copy the other object into the local one	
 */
void http_sresp_ctx_t::copy(const http_sresp_ctx_t &other)	throw()
{
	// copy the normal fields
	reqhd		( other.reqhd() );
	rephd		( other.rephd() );	
	post_data	( other.post_data() );	
	// special case of response_body
	response_body_val << other.response_body().str();
}	
Beispiel #6
0
void DisplayChar_Reverse(u8 casc,u8 postion_x,u8 postion_y)
{
	u8 i,j,b;
	const u8 *p;
	
	en_lcd();
	post_cmd(0x210,postion_x*8); 	//x start point
	post_cmd(0x212,postion_y*16); 	//y start point
	post_cmd(0x211,postion_x*8+7);	//x end point
	post_cmd(0x213,postion_y*16+15);	//y end point

	post_cmd(0x200,postion_x*8);	
	post_cmd(0x201,postion_y*16);
	
	en_lcd_index();
	post_data(0x202);
	en_lcd_data();
	p=ascii;
	p+=casc*16;
	for(j=16;j>0;j--)
	{
		b=*(p+j-1);
		for(i=0;i<8;i++)
		{
			if(b&0x01)
			{
				post_data(COLOR_BLACK);
			}
			else
			{
				post_data(COLOR_YELLOW);
			}
			b=b>>1;
			
		}	
	}
	dis_lcd();
}
Beispiel #7
0
BOOL SimpleBrowser::Navigate(LPCTSTR URL)
{
	ASSERT(m_pBrowser != NULL);
	if (m_pBrowser != NULL) 
	{
		CString		url(URL);
		_variant_t	flags(0L,VT_I4);
		_variant_t	target_frame_name(_T(""));
		_variant_t	post_data(_T(""));
		_variant_t	headers(_T(""));
		return m_pBrowser->Navigate(url.AllocSysString(), &flags, &target_frame_name, &post_data, &headers) == S_OK;
	}
	return FALSE;
}
/** \brief convert the object into a string
 */
std::string http_sresp_ctx_t::to_string()			const throw()
{
	std::ostringstream	oss;
	// handle the null case
	if( is_null() )	return "null";
	// build the string
	oss << "[";
	oss << "reqhd="			<< reqhd();
	oss << " rephd="		<< rephd();
	oss << " post_data="		<< post_data();
	oss << " response_body="	<< response_body().str();
	oss << "]";
	// return the just built string
	return oss.str();
}
NPError 
NPP_New(NPMIMEType pluginType,
	NPP instance,
	uint16 mode,
	int16 argc,
	char* argn[],
	char* argv[],
	NPSavedData* saved)
{
        PluginInstance* This = NULL;
	NPError rv;
	int r, i, datalen, b64datalen;
	u8 *data = NULL, *b64data = NULL;
	char *postUrl = NULL, *dataToSign = NULL, *fieldName = NULL;

	printf("NPP_New()\n");
	if (instance == NULL)
		return NPERR_INVALID_INSTANCE_ERROR;
	instance->pdata = NPN_MemAlloc(sizeof(PluginInstance));
	
	This = (PluginInstance*) instance->pdata;

	if (This == NULL)
		return NPERR_OUT_OF_MEMORY_ERROR;

	This->ctx = NULL;
	This->card = NULL;
	This->p15card = NULL;
	
	for (i = 0; i < argc; i++) {
		if (strcmp(argn[i], "wsxaction") == 0) {
			postUrl = strdup(argv[i]);
		} else if (strcmp(argn[i], "wsxdatatosign") == 0) {
			dataToSign = strdup(argv[i]);
		} else if (strcmp(argn[i], "wsxname") == 0) {
			fieldName = strdup(argv[i]);
		} else
			printf("'%s' = '%s'\n", argn[i], argv[i]);
	}
	if (postUrl == NULL || dataToSign == NULL) {
		r = NPERR_GENERIC_ERROR;
		goto err;
	}
	if (fieldName == NULL)
		fieldName = strdup("SignedData");
	This->signdata = dataToSign;
	This->signdata_len = strlen(dataToSign);

	r = create_envelope(This, &data, &datalen);
	if (r) {
		r = NPERR_GENERIC_ERROR;
		goto err;
	}
	b64datalen = datalen * 4 / 3 + 4;
	b64data = (u8 *) malloc(b64datalen);
	r = sc_base64_encode(data, datalen, b64data, b64datalen, 0);
	if (r) {
		r = NPERR_GENERIC_ERROR;
		goto err;
	}
	printf("Posting to '%s'\n", postUrl);
	printf("Data to sign: %s\n", dataToSign);
	printf("Signed: %s\n", b64data);
	rv = post_data(instance, postUrl, "_self", strlen((char *) b64data), (char *) b64data,
		       fieldName);
	printf("post_data returned %d\n", rv);
	r = NPERR_NO_ERROR;
err:
	if (fieldName)
		free(fieldName);
	if (dataToSign)
		free(dataToSign);
	if (postUrl)
		free(postUrl);
	if (data)
		free(data);
	if (b64data)
		free(b64data);
	return r;
}