----------
Custom Search

Saturday, May 19, 2012

STOP UNSUBSCRIBE GLOBE 2332

How to stop Ringback, Jokes, Qoute from Globe 2332?

TEXT: STOP ALL
TO: 2332

This cost me a lot of load.

Thursday, February 16, 2012

Hang/Freeze on Windows CE .NET

I develop a System which prints statement from Mobile Device to a Bluetooth Printer.
Device - Windows CE - CipherLab 8600
Printer - Apex 2 - Bluetooth Communication
Developmet Tool - VB.NET Mobile

Problem- When I print - occasionally System / Unit Hang/Freeze.

After Days of research and trials.
This is my solution Solution.
- Change my Framework to 3.5
- Use Thread in Printing
Why? - Because in Mobile Device the application run in threads not in process.
The Application Freeze/Hang because there are to much process in the thread.
Maybe the unit can't handle it.
How?
- The problem in thread is that in cannot save / include your variables.
- So what I did is I save my printout into a text file then open it in the new thread
Example Code:

Public Sub print()
createtxt()

Dim t As System.Threading.Thread = New System.Threading.Thread(AddressOf printbilltr) ' Create New Thread
t.Start() ' Start Thread
End Sub

Public Sub createtxt()
Dim owrite As System.IO.StreamWriter
Dim vprint

owrite = System.IO.File.CreateText("\Diskonchip\4print.txt")

vprint = vprint & "STATMENT OF ACCOUNT" & vbCrLf
vprint = vprint & "NAME " & p_name & vbCrLf
vprint = vprint & "ADDRESS " & p_addr & vbCrLf

owrite.Write(vprint)
owrite.Close()
End Sub

Public Sub printbilltr()
Dim SePo As New IO.Ports.SerialPort ' Create Port
Dim oread As System.IO.StreamReader
Dim ychar

Try
oread = System.IO.File.OpenText("\Diskonchip\4print.txt")

' Set Port Setting
With SePo
.PortName = "COM6"
.BaudRate = 115200
.DataBits = 8
.Parity = IO.Ports.Parity.None
.StopBits = IO.Ports.StopBits.Two
.Handshake = IO.Ports.Handshake.None
.WriteTimeout = 5000
.WriteBufferSize = 10000
End With

While Not oread.EndOfStream()
ychar = oread.ReadLine()

If Not SePo.IsOpen Then
SePo.Open()
End If
SePo.Write(ychar & vbCrLf)
System.Threading.Thread.Sleep(5) ' Little Delay
End While
oread.Close()
Catch ex As Exception
Dim aaa
aaa = MsgBox("Printer Error" & vbCrLf & "- See Printer Status" & vbCrLf & "- Check Bluetooth is On" & vbCrLf & "- ReseT UniT if Needed")
End Try
End Sub

Hope This Helps..