Quote:
But I don't know how to frame a packet and send it to serial port.
You can consider that every single AT command you have already send is a frame.
Your frame is simply a string containing what you want, an AT command or [Type+Opcode+Parameter+CheckSum].
you just have to make sure that the string is made of 8 bits chars and will not get encoded as utf 8 if you have some special chars.